diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index fcd2fdb..9964dd8 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -161,6 +161,12 @@ is If critical percentage is not specified it defaults to .BR @ALARM_CRIT@ . .TP +\fB\-\-snet\-alarms +Suppress range alarms that are part of shared networks. Use of this option +will keep alarm criteria applied to ranges that are not part of shared-net +along with shared-net alarms. This option may help reducing alarm noise for +configurations that has lots of small ranges in big shared-networks. +.TP \fB\-\-minsize\fR=\fIsize\fR Ignore ranges and shared networks that are smaller or equal to the defined size. This option is meaningful only in context of alarming, and diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 267d185..3aef093 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -94,7 +94,8 @@ int main(int argc, char **argv) char const *tmp; struct range_t *tmp_ranges; enum { - OPT_WARN = CHAR_MAX + 1, + OPT_SNET_ALARMS = CHAR_MAX + 1, + OPT_WARN, OPT_CRIT, OPT_MINSIZE }; @@ -110,6 +111,7 @@ int main(int argc, char **argv) {"limit", required_argument, NULL, 'L'}, {"version", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, + {"snet-alarms", no_argument, NULL, OPT_SNET_ALARMS}, {"warning", required_argument, NULL, OPT_WARN}, {"critical", required_argument, NULL, OPT_CRIT}, {"minsize", required_argument, NULL, OPT_MINSIZE}, @@ -127,6 +129,7 @@ int main(int argc, char **argv) * command line option */ config.output_file[0] = '\0'; /* Alarming defaults. */ + config.snet_alarms = false; config.warning = ALARM_WARN; config.critical = ALARM_CRIT; /* File location defaults */ @@ -194,6 +197,9 @@ int main(int argc, char **argv) } } break; + case OPT_SNET_ALARMS: + config.snet_alarms = true; + break; case OPT_WARN: strcpy(config.output_format, "a"); config.warning = strtod_or_err(optarg, "illegal argument"); diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index 4c61273..f24b150 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -130,6 +130,7 @@ struct configuration_t { char *output_file; int output_limit[2]; bool backups_found; + bool snet_alarms; double warning; double critical; double minsize; diff --git a/src/output.c b/src/output.c index 06a5469..78a9cc7 100644 --- a/src/output.c +++ b/src/output.c @@ -1000,6 +1000,9 @@ int output_alarming(void) if (config.output_limit[1] & BIT1) { for (i = 0; i < num_ranges; i++) { + if (config.snet_alarms && range_p->shared_net != shared_networks) { + continue; + } if (config.minsize < range_size) { perc = (float)(100 * range_p->count) / range_size; if (config.critical < perc)