alarming: add additional performance data

Options -p or --perfdata (in alarming mode) now enable the output of
additional performance data, i.e.  used, touched and backup addresses per
subnet.

Signed-off-by: Manuel Hachtkemper <hacman@math.uni-bonn.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Manuel Hachtkemper 2016-03-29 14:49:06 +02:00 committed by Sami Kerola
parent c305e2f82c
commit 32e2d399a0
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
12 changed files with 103 additions and 4 deletions

View file

@ -129,6 +129,7 @@ int main(int argc, char **argv)
{"warn-count", required_argument, NULL, OPT_WARN_COUNT},
{"crit-count", required_argument, NULL, OPT_CRIT_COUNT},
{"minsize", required_argument, NULL, OPT_MINSIZE},
{"perfdata", no_argument, NULL, 'p'},
{NULL, 0, NULL, 0}
};
@ -148,6 +149,7 @@ int main(int argc, char **argv)
config.critical = ALARM_CRIT;
config.warn_count = 0x100000000; /* == 2^32 that is the entire IPv4 space */
config.crit_count = 0x100000000; /* basically turns off the count criteria */
config.perfdata = false;
/* File location defaults */
strncpy(config.dhcpdconf_file, DHCPDCONF_FILE, MAXLEN - 1);
strncpy(config.dhcpdlease_file, DHCPDLEASE_FILE, MAXLEN - 1);
@ -165,7 +167,7 @@ int main(int argc, char **argv)
while (1) {
int c;
c = getopt_long(argc, argv, "c:l:f:o:s:rL:vh", long_options, &option_index);
c = getopt_long(argc, argv, "c:l:f:o:s:rL:pvh", long_options, &option_index);
if (c == EOF)
break;
switch (c) {
@ -235,6 +237,10 @@ int main(int argc, char **argv)
case OPT_MINSIZE:
config.minsize = strtod_or_err(optarg, "illegal argument");
break;
case 'p':
/* Print additional performance data in alarming mode */
config.perfdata = true;
break;
case 'v':
/* Print version */
print_version();