]> git.puffer.fish Git - matthieu/frr.git/commitdiff
watchfrr: Modify some stderr messages to zlog_warn
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 20 Sep 2018 15:31:14 +0000 (11:31 -0400)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 25 Sep 2018 17:11:25 +0000 (19:11 +0200)
The stderr output is not being displayed as part of watchfrr invocation
in system startup.  Specifically if the user has not properly sent
1 or more daemons to monitor.  If the end-user is using tools/frr
this stderr is dropped( and systemd appears to drop stderr too? )

Modify the two stderr calls in this situation and use the zlog system.
Now I can clearly see an error message that tells me what has gone wrong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
[DL: fixed typo]

watchfrr/watchfrr.c
watchfrr/watchfrr_errors.c
watchfrr/watchfrr_errors.h

index 9bbe04c338c97888d5c6589f8132cd63a2320e87..ec922490e2af60db4709476303f0c051cfa9a700 100644 (file)
@@ -1217,12 +1217,13 @@ int main(int argc, char **argv)
                }
        }
        if (!gs.daemons) {
-               fputs("Must specify one or more daemons to monitor.\n", stderr);
+               flog_err(EC_WATCHFRR_UNEXPECTED_DAEMONS,
+                         "Must specify one or more daemons to monitor.");
                frr_help_exit(1);
        }
        if (!watch_only && !gs.special) {
-               fprintf(stderr, "\"%s\" daemon must be in daemon list\n",
-                       special);
+               flog_err(EC_WATCHFRR_UNEXPECTED_DAEMONS,
+                         "\"%s\" daemon must be in daemon lists", special);
                frr_help_exit(1);
        }
 
index c720b65099c8b575a233a09d7589545e00be1efb..0aa27ef661a8f9e81c3d4fe5d5348be45bf2aeac 100644 (file)
@@ -31,6 +31,12 @@ static struct log_ref ferr_watchfrr_err[] = {
                .description = "WATCHFRR has detected a connectivity issue with one of the FRR daemons",
                .suggestion = "Ensure that FRR is still running and if not please open an Issue"
        },
+       {
+               .code = EC_WATCHFRR_UNEXPECTED_DAEMONS,
+               .title = "WATCHFRR wrong daemons to watch",
+               .description = "As part of WATCHFRR startup you must specify 1 or more daemons to monitor",
+               .suggestion = "Update your startup scripts to include zebra and any other daemon you would like to monitor",
+       },
        {
                .code = END_FERR,
        }
index 93103b6551b1d44f9426b3e60dea606ec136f723..9d5abde52b7eb774d1b5ad1e7907568c38abdf1e 100644 (file)
@@ -25,6 +25,7 @@
 
 enum watchfrr_log_refs {
        EC_WATCHFRR_CONNECTION = WATCHFRR_FERR_START,
+       EC_WATCHFRR_UNEXPECTED_DAEMONS,
 };
 
 extern void watchfrr_error_init(void);