Commit 90946abd authored by arianna-aondio's avatar arianna-aondio

Merge pull request #1886 from aondio/adm_be_health

Add "last updated" timestamp for backend health in varnishadm
parents 67d57391 977f15c4
...@@ -324,6 +324,7 @@ static int __match_proto__() ...@@ -324,6 +324,7 @@ static int __match_proto__()
do_list(struct cli *cli, struct backend *b, void *priv) do_list(struct cli *cli, struct backend *b, void *priv)
{ {
int *probes; int *probes;
char time_str[VTIM_FORMAT_SIZE];
AN(priv); AN(priv);
probes = priv; probes = priv;
...@@ -334,16 +335,17 @@ do_list(struct cli *cli, struct backend *b, void *priv) ...@@ -334,16 +335,17 @@ do_list(struct cli *cli, struct backend *b, void *priv)
VCLI_Out(cli, " %-10s", b->admin_health); VCLI_Out(cli, " %-10s", b->admin_health);
if (b->probe == NULL) if (b->probe == NULL)
VCLI_Out(cli, " %s", "Healthy (no probe)"); VCLI_Out(cli, " %-20s", "Healthy (no probe)");
else { else {
if (b->healthy) if (b->healthy)
VCLI_Out(cli, " %s", "Healthy "); VCLI_Out(cli, " %-20s", "Healthy ");
else else
VCLI_Out(cli, " %s", "Sick "); VCLI_Out(cli, " %-20s", "Sick ");
VBP_Status(cli, b, *probes); VBP_Status(cli, b, *probes);
} }
/* XXX: report b->health_changed */ VTIM_format(b->health_changed, time_str);
VCLI_Out(cli, " %s", time_str);
return (0); return (0);
} }
...@@ -367,7 +369,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv) ...@@ -367,7 +369,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv)
VCLI_SetResult(cli, CLIS_PARAM); VCLI_SetResult(cli, CLIS_PARAM);
return; return;
} }
VCLI_Out(cli, "%-30s %-10s %s", "Backend name", "Admin", "Probe"); VCLI_Out(cli, "%-30s %-10s %-20s %s", "Backend name", "Admin",
"Probe", "Last updated");
(void)backend_find(cli, av[2], do_list, &probes); (void)backend_find(cli, av[2], do_list, &probes);
} }
......
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