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, ...@@ -461,12 +461,11 @@ vbe_list(VRT_CTX, const struct director *d, struct vsb *vsb, int pflag,
else if (jflag && pflag) else if (jflag && pflag)
VSB_printf(vsb, "{},\n"); VSB_printf(vsb, "{},\n");
else if (jflag) else if (jflag)
VSB_printf(vsb, "\"%s\"", bp->sick ? "sick" : "healthy"); VSB_printf(vsb, "[0, 0, \"healthy\"]");
else if (pflag) else if (pflag)
return; return;
else else
VSB_printf(vsb, "%s", VSB_cat(vsb, "0/0\thealthy");
bp->sick ? "sick" : "healthy");
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
......
...@@ -519,7 +519,7 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json) ...@@ -519,7 +519,7 @@ VBP_Status(struct vsb *vsb, const struct backend *be, int details, int json)
vt->good, vt->window, vt->good, vt->window,
vt->backend->sick ? "sick" : "healthy"); vt->backend->sick ? "sick" : "healthy");
else 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"); vt->backend->sick ? "sick" : "healthy");
return; return;
} }
......
...@@ -327,13 +327,14 @@ do_list(struct cli *cli, struct director *d, void *priv) ...@@ -327,13 +327,14 @@ do_list(struct cli *cli, struct director *d, void *priv)
ctx = VCL_Get_CliCtx(0); 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)); VSB_printf(la->vsb, "%s\t%s\t", d->vdir->cli_name, VDI_Ahealth(d));
if (d->vdir->methods->list != NULL) if (d->vdir->methods->list != NULL)
d->vdir->methods->list(ctx, d, la->vsb, 0, 0); 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 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); VTIM_format(d->vdir->health_changed, time_str);
VSB_printf(la->vsb, "\t%s", 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) ...@@ -372,8 +373,11 @@ do_list_json(struct cli *cli, struct director *d, void *priv)
VCLI_Out(cli, "\"probe_message\": "); VCLI_Out(cli, "\"probe_message\": ");
if (d->vdir->methods->list != NULL) if (d->vdir->methods->list != NULL)
d->vdir->methods->list(ctx, d, cli->sb, 0, 1); 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 else
VCLI_Out(cli, "\"%s\"", cli_health(ctx, d)); VCLI_Out(cli, "[0, 0, \"healthy\"]");
VCLI_Out(cli, ",\n"); VCLI_Out(cli, ",\n");
if (la->p && d->vdir->methods->list != NULL) { if (la->p && d->vdir->methods->list != NULL) {
...@@ -431,8 +435,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv) ...@@ -431,8 +435,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv)
} else { } else {
la->vsb = VSB_new_auto(); la->vsb = VSB_new_auto();
AN(la->vsb); AN(la->vsb);
VSB_printf(la->vsb, "%s\t%s\t%s\t%s\n", VSB_printf(la->vsb, "%s\t%s\t%s\t%s\t%s\n",
"Backend name", "Admin", "Probe", "Last change"); "Backend name", "Admin", "Probe", "Health", "Last change");
(void)VCL_IterDirector(cli, av[i], do_list, la); (void)VCL_IterDirector(cli, av[i], do_list, la);
VCLI_VTE(cli, &la->vsb, 80); VCLI_VTE(cli, &la->vsb, 80);
} }
......
...@@ -259,7 +259,7 @@ vdir_list(VRT_CTX, struct vdir *vd, struct vsb *vsb, int pflag, int jflag) ...@@ -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, VSB_printf(vsb, "[%u, %u, \"%s\"]", nh, u,
nh ? "healthy" : "sick"); nh ? "healthy" : "sick");
else 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 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