From 9df90042e2c68d934c2c0572d0098cf50fb91215 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 25 Nov 2012 17:58:43 +0000 Subject: [PATCH] build-sys: make alarm warning & critical default configurable Signed-off-by: Sami Kerola --- configure.ac | 14 ++++++++++++++ man/dhcpd-pools.1.in | 4 ++-- src/defaults.h | 4 ---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index fbf4178..9299cb1 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,20 @@ AC_ARG_WITH([output-limit], AC_DEFINE_UNQUOTED([OUTPUT_LIMIT], ["$output_limit"], [default output limit]) AC_SUBST([OUTPUT_LIMIT], [$output_limit]) +AC_ARG_WITH([warning], + [AC_HELP_STRING([--with-warning=NUM], [monitoring warning default])], + [warning_percent="$withval"], + [warning_percent="80"]) +AC_DEFINE_UNQUOTED([ALARM_WARN], [$warning_percent], [monitoring warning default]) +AC_SUBST([ALARM_WARN], [$warning_percent]) + +AC_ARG_WITH([critical], + [AC_HELP_STRING([--with-critical=NUM], [monitoring critical default])], + [critical_percent="$withval"], + [critical_percent="90"]) +AC_DEFINE_UNQUOTED([ALARM_CRIT], [$critical_percent], [monitoring critical default]) +AC_SUBST([ALARM_CRIT], [$critical_percent]) + AC_CONFIG_FILES([ Makefile lib/Makefile diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index 9862e54..f5687b1 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -134,7 +134,7 @@ If only range monitoring is needed one can limit output by using option and for shared network monitoring similar is .IR \-L20 . If critical level is not speficied it defaults to -.BR 90 . +.BR @ALARM_WARN@ . The .I percent argument allows fractions to be used. Alarm output is intended to be @@ -145,7 +145,7 @@ The option is similar to warning, with exception of return value which is .BR 2 . If warning level is not specified it defaults to -.BR 80 . +.BR @ALARM_CRIT@ . .TP \fB\-v\fR, \fB\-\-version\fR Print version information to standard output and exit successfully. diff --git a/src/defaults.h b/src/defaults.h index 6d0a9c5..76e1ec5 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -45,8 +45,4 @@ static const unsigned int SHARED_NETWORKS = 8192; /* Maximum number of ranges */ unsigned int RANGES; -/* Alarming defaults */ -#define ALARM_WARN 80 -#define ALARM_CRIT 90 - #endif /* DEFAULTS_H */