From: Andrew Bays Date: Thu, 8 Feb 2018 21:14:43 +0000 (-0500) Subject: Properly detect which interfaces to monitor X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=116944fa0cc487ba8c387da525f7af67a36118ed;p=collectd.git Properly detect which interfaces to monitor --- diff --git a/src/connectivity.c b/src/connectivity.c index e58ffde1..e39bce17 100644 --- a/src/connectivity.c +++ b/src/connectivity.c @@ -112,7 +112,7 @@ typedef struct interface_list_s interface_list_t; static ignorelist_t *ignorelist = NULL; static interface_list_t *interface_list_head = NULL; -static int monitor_all_interfaces = 0; +static int monitor_all_interfaces = 1; static int connectivity_thread_loop = 0; static int connectivity_thread_error = 0; @@ -705,10 +705,9 @@ static int stop_thread(int shutdown) /* {{{ */ static int connectivity_init(void) /* {{{ */ { - if (interface_list_head == NULL) { + if (monitor_all_interfaces) { NOTICE("connectivity plugin: No interfaces have been selected, so all will " "be monitored"); - monitor_all_interfaces = 1; } return (start_thread()); @@ -716,11 +715,13 @@ static int connectivity_init(void) /* {{{ */ static int connectivity_config(const char *key, const char *value) /* {{{ */ { - if (ignorelist == NULL) + if (ignorelist == NULL) { ignorelist = ignorelist_create(/* invert = */ 1); + } if (strcasecmp(key, "Interface") == 0) { ignorelist_add(ignorelist, value); + monitor_all_interfaces = 0; } else { return (-1); }