mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
add --snet-alarms option to suppress excess range alarms
Some users may not want to have alarms about ranges that are part of a shared-network, so allow them to suppress such. Requested-by: Frank Bulk <fbulk@mypremieronline.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
99b6af70ef
commit
7f3d553c7f
4 changed files with 17 additions and 1 deletions
|
|
@ -161,6 +161,12 @@ is
|
||||||
If critical percentage is not specified it defaults to
|
If critical percentage is not specified it defaults to
|
||||||
.BR @ALARM_CRIT@ .
|
.BR @ALARM_CRIT@ .
|
||||||
.TP
|
.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
|
\fB\-\-minsize\fR=\fIsize\fR
|
||||||
Ignore ranges and shared networks that are smaller or equal to the
|
Ignore ranges and shared networks that are smaller or equal to the
|
||||||
defined size. This option is meaningful only in context of alarming, and
|
defined size. This option is meaningful only in context of alarming, and
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@ int main(int argc, char **argv)
|
||||||
char const *tmp;
|
char const *tmp;
|
||||||
struct range_t *tmp_ranges;
|
struct range_t *tmp_ranges;
|
||||||
enum {
|
enum {
|
||||||
OPT_WARN = CHAR_MAX + 1,
|
OPT_SNET_ALARMS = CHAR_MAX + 1,
|
||||||
|
OPT_WARN,
|
||||||
OPT_CRIT,
|
OPT_CRIT,
|
||||||
OPT_MINSIZE
|
OPT_MINSIZE
|
||||||
};
|
};
|
||||||
|
|
@ -110,6 +111,7 @@ int main(int argc, char **argv)
|
||||||
{"limit", required_argument, NULL, 'L'},
|
{"limit", required_argument, NULL, 'L'},
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{"snet-alarms", no_argument, NULL, OPT_SNET_ALARMS},
|
||||||
{"warning", required_argument, NULL, OPT_WARN},
|
{"warning", required_argument, NULL, OPT_WARN},
|
||||||
{"critical", required_argument, NULL, OPT_CRIT},
|
{"critical", required_argument, NULL, OPT_CRIT},
|
||||||
{"minsize", required_argument, NULL, OPT_MINSIZE},
|
{"minsize", required_argument, NULL, OPT_MINSIZE},
|
||||||
|
|
@ -127,6 +129,7 @@ int main(int argc, char **argv)
|
||||||
* command line option */
|
* command line option */
|
||||||
config.output_file[0] = '\0';
|
config.output_file[0] = '\0';
|
||||||
/* Alarming defaults. */
|
/* Alarming defaults. */
|
||||||
|
config.snet_alarms = false;
|
||||||
config.warning = ALARM_WARN;
|
config.warning = ALARM_WARN;
|
||||||
config.critical = ALARM_CRIT;
|
config.critical = ALARM_CRIT;
|
||||||
/* File location defaults */
|
/* File location defaults */
|
||||||
|
|
@ -194,6 +197,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPT_SNET_ALARMS:
|
||||||
|
config.snet_alarms = true;
|
||||||
|
break;
|
||||||
case OPT_WARN:
|
case OPT_WARN:
|
||||||
strcpy(config.output_format, "a");
|
strcpy(config.output_format, "a");
|
||||||
config.warning = strtod_or_err(optarg, "illegal argument");
|
config.warning = strtod_or_err(optarg, "illegal argument");
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ struct configuration_t {
|
||||||
char *output_file;
|
char *output_file;
|
||||||
int output_limit[2];
|
int output_limit[2];
|
||||||
bool backups_found;
|
bool backups_found;
|
||||||
|
bool snet_alarms;
|
||||||
double warning;
|
double warning;
|
||||||
double critical;
|
double critical;
|
||||||
double minsize;
|
double minsize;
|
||||||
|
|
|
||||||
|
|
@ -1000,6 +1000,9 @@ int output_alarming(void)
|
||||||
|
|
||||||
if (config.output_limit[1] & BIT1) {
|
if (config.output_limit[1] & BIT1) {
|
||||||
for (i = 0; i < num_ranges; i++) {
|
for (i = 0; i < num_ranges; i++) {
|
||||||
|
if (config.snet_alarms && range_p->shared_net != shared_networks) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (config.minsize < range_size) {
|
if (config.minsize < range_size) {
|
||||||
perc = (float)(100 * range_p->count) / range_size;
|
perc = (float)(100 * range_p->count) / range_size;
|
||||||
if (config.critical < perc)
|
if (config.critical < perc)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue