Commit 82d8153a authored by Nils Goroll's avatar Nils Goroll

use 0/0 healthy for "no probe" in the probe field

Add another column for the probe result

Ref #2896
parent 7b658a48
......@@ -461,12 +461,11 @@ vbe_list(VRT_CTX, const struct director *d, struct vsb *vsb, int pflag,
else if (jflag && pflag)
VSB_printf(vsb, "{},\n");
else if (jflag)
VSB_printf(vsb, "\"%s\"", bp->sick ? "sick" : "healthy");
VSB_printf(vsb, "[0, 0, \"healthy\"]");
else if (pflag)
return;
else
VSB_printf(vsb, "%s",
bp->sick ? "sick" : "healthy");
VSB_cat(vsb, "0/0\thealthy");
}
/*--------------------------------------------------------------------
......
......@@ -519,7 +519,7 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json)
vt->good, vt->window,
vt->backend->sick ? "sick" : "healthy");
else
VSB_printf(vsb, "%u/%u %s", vt->good, vt->window,
VSB_printf(vsb, "%u/%u\t%s", vt->good, vt->window,
vt->backend->sick ? "sick" : "healthy");
return;
}
......
......@@ -327,13 +327,14 @@ do_list(struct cli *cli, struct director *d, void *priv)
ctx = VCL_Get_CliCtx(0);
// XXX admin health "probe" for the no-probe case is confusing
VSB_printf(la->vsb, "%s\t%s\t", d->vdir->cli_name, VDI_Ahealth(d));
if (d->vdir->methods->list != NULL)
d->vdir->methods->list(ctx, d, la->vsb, 0, 0);
else if (d->vdir->methods->healthy != NULL)
VSB_printf(la->vsb, "0/0\t%s", cli_health(ctx, d));
else
VSB_printf(la->vsb, "%s", cli_health(ctx, d));
VSB_cat(la->vsb, "0/0\thealthy");
VTIM_format(d->vdir->health_changed, time_str);
VSB_printf(la->vsb, "\t%s", time_str);
......@@ -372,8 +373,11 @@ do_list_json(struct cli *cli, struct director *d, void *priv)
VCLI_Out(cli, "\"probe_message\": ");
if (d->vdir->methods->list != NULL)
d->vdir->methods->list(ctx, d, cli->sb, 0, 1);
else if (d->vdir->methods->healthy != NULL)
VCLI_Out(cli, "[0, 0, \"%s\"]", cli_health(ctx, d));
else
VCLI_Out(cli, "\"%s\"", cli_health(ctx, d));
VCLI_Out(cli, "[0, 0, \"healthy\"]");
VCLI_Out(cli, ",\n");
if (la->p && d->vdir->methods->list != NULL) {
......@@ -431,8 +435,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv)
} else {
la->vsb = VSB_new_auto();
AN(la->vsb);
VSB_printf(la->vsb, "%s\t%s\t%s\t%s\n",
"Backend name", "Admin", "Probe", "Last change");
VSB_printf(la->vsb, "%s\t%s\t%s\t%s\t%s\n",
"Backend name", "Admin", "Probe", "Health", "Last change");
(void)VCL_IterDirector(cli, av[i], do_list, la);
VCLI_VTE(cli, &la->vsb, 80);
}
......
......@@ -259,7 +259,7 @@ vdir_list(VRT_CTX, struct vdir *vd, struct vsb *vsb, int pflag, int jflag)
VSB_printf(vsb, "[%u, %u, \"%s\"]", nh, u,
nh ? "healthy" : "sick");
else
VSB_printf(vsb, "%u/%u %s", nh, u, nh ? "healthy" : "sick");
VSB_printf(vsb, "%u/%u\t%s", nh, u, nh ? "healthy" : "sick");
}
static unsigned
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment