mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 09:00:55 +00:00
watchfrr: add status command
Just to see WTF is going on inside watchfrr... Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
75f8b0e41b
commit
af568444cb
@ -73,7 +73,7 @@ typedef enum {
|
||||
} restart_phase_t;
|
||||
|
||||
static const char *phase_str[] = {
|
||||
"None",
|
||||
"Idle",
|
||||
"Startup",
|
||||
"Stop jobs running",
|
||||
"Waiting for other daemons to come down",
|
||||
@ -970,6 +970,31 @@ bool check_all_up(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
void watchfrr_status(struct vty *vty)
|
||||
{
|
||||
struct daemon *dmn;
|
||||
struct timeval delay;
|
||||
|
||||
vty_out(vty, "watchfrr global phase: %s\n", phase_str[gs.phase]);
|
||||
if (gs.restart.pid)
|
||||
vty_out(vty, " global restart running, pid %ld\n",
|
||||
(long)gs.restart.pid);
|
||||
|
||||
for (dmn = gs.daemons; dmn; dmn = dmn->next) {
|
||||
vty_out(vty, " %-20s %s\n", dmn->name, state_str[dmn->state]);
|
||||
if (dmn->restart.pid)
|
||||
vty_out(vty, " restart running, pid %ld\n",
|
||||
(long)dmn->restart.pid);
|
||||
else if (dmn->state == DAEMON_DOWN &&
|
||||
time_elapsed(&delay, &dmn->restart.time)->tv_sec
|
||||
< dmn->restart.interval)
|
||||
vty_out(vty, " restarting in %ld seconds"
|
||||
" (%lds backoff interval)\n",
|
||||
dmn->restart.interval - delay.tv_sec,
|
||||
dmn->restart.interval);
|
||||
}
|
||||
}
|
||||
|
||||
static void sigint(void)
|
||||
{
|
||||
zlog_notice("Terminating on signal");
|
||||
|
@ -29,6 +29,10 @@ extern void watchfrr_vty_init(void);
|
||||
|
||||
extern pid_t integrated_write_pid;
|
||||
extern void integrated_write_sigchld(int status);
|
||||
|
||||
struct vty;
|
||||
extern void watchfrr_status(struct vty *vty);
|
||||
|
||||
/*
|
||||
* Check if all daemons we are monitoring are in the DAEMON_UP state.
|
||||
*
|
||||
|
@ -124,6 +124,16 @@ DEFUN_NOSH (show_debugging_watchfrr,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (show_watchfrr,
|
||||
show_watchfrr_cmd,
|
||||
"show watchfrr",
|
||||
SHOW_STR
|
||||
WATCHFRR_STR)
|
||||
{
|
||||
watchfrr_status(vty);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void integrated_write_sigchld(int status)
|
||||
{
|
||||
uint8_t reply[4] = {0, 0, 0, CMD_WARNING};
|
||||
@ -159,4 +169,5 @@ void watchfrr_vty_init(void)
|
||||
install_element(ENABLE_NODE, &config_write_integrated_cmd);
|
||||
install_element(ENABLE_NODE, &show_debugging_watchfrr_cmd);
|
||||
install_element(CONFIG_NODE, &show_debugging_watchfrr_cmd);
|
||||
install_element(VIEW_NODE, &show_watchfrr_cmd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user