diff options
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | plugins/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/check_swap.c | 18 |
3 files changed, 18 insertions, 10 deletions
diff --git a/configure.in b/configure.in index df516c5..b209d19 100644 --- a/configure.in +++ b/configure.in | |||
@@ -137,6 +137,11 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") | |||
137 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") | 137 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") |
138 | AC_SUBST(SOCKETLIBS) | 138 | AC_SUBST(SOCKETLIBS) |
139 | 139 | ||
140 | dnl | ||
141 | dnl check for math-related functions needing -lm | ||
142 | AC_CHECK_LIB(m,floor,MATHLIBS="-lm") | ||
143 | AC_SUBST(MATHLIBS) | ||
144 | |||
140 | dnl Check for PostgreSQL libraries | 145 | dnl Check for PostgreSQL libraries |
141 | _SAVEDLIBS="$LIBS" | 146 | _SAVEDLIBS="$LIBS" |
142 | _SAVEDCPPFLAGS="$CPPFLAGS" | 147 | _SAVEDCPPFLAGS="$CPPFLAGS" |
@@ -567,7 +572,7 @@ AC_TRY_COMPILE([#include <sys/time.h>], | |||
567 | AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed]))) | 572 | AC_DEFINE(NEED_GETTIMEOFDAY,1,[Define if gettimeofday is needed]))) |
568 | 573 | ||
569 | dnl Checks for library functions. | 574 | dnl Checks for library functions. |
570 | AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul) | 575 | AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul, floor) |
571 | 576 | ||
572 | AC_MSG_CHECKING(return type of socket size) | 577 | AC_MSG_CHECKING(return type of socket size) |
573 | AC_TRY_COMPILE([#include <stdlib.h> | 578 | AC_TRY_COMPILE([#include <stdlib.h> |
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index d983192..87a97a9 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -9,6 +9,7 @@ datadir = @datadir@ | |||
9 | localedir = $(datadir)/locale | 9 | localedir = $(datadir)/locale |
10 | DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ | 10 | DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ |
11 | LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@ | 11 | LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@ |
12 | MATHLIBS = @MATHLIBS@ | ||
12 | 13 | ||
13 | libexec_PROGRAMS = check_dhcp check_disk check_dummy check_http check_load \ | 14 | libexec_PROGRAMS = check_dhcp check_disk check_dummy check_http check_load \ |
14 | check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \ | 15 | check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \ |
@@ -72,7 +73,7 @@ check_real_LDADD = $(NETLIBS) | |||
72 | check_snmp_LDADD = $(BASEOBJS) popen.o | 73 | check_snmp_LDADD = $(BASEOBJS) popen.o |
73 | check_smtp_LDADD = $(NETLIBS) $(SSLLIBS) | 74 | check_smtp_LDADD = $(NETLIBS) $(SSLLIBS) |
74 | check_ssh_LDADD = $(NETLIBS) | 75 | check_ssh_LDADD = $(NETLIBS) |
75 | check_swap_LDADD = $(BASEOBJS) popen.o | 76 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o |
76 | check_tcp_LDADD = $(NETLIBS) $(SSLLIBS) | 77 | check_tcp_LDADD = $(NETLIBS) $(SSLLIBS) |
77 | check_time_LDADD = $(NETLIBS) | 78 | check_time_LDADD = $(NETLIBS) |
78 | check_udp_LDADD = $(NETLIBS) | 79 | check_udp_LDADD = $(NETLIBS) |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index fe9254d..8f5ebf8 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -42,8 +42,8 @@ void print_help (void); | |||
42 | 42 | ||
43 | int warn_percent = 0; | 43 | int warn_percent = 0; |
44 | int crit_percent = 0; | 44 | int crit_percent = 0; |
45 | float warn_size = 0; | 45 | double warn_size = 0; |
46 | float crit_size = 0; | 46 | double crit_size = 0; |
47 | int verbose; | 47 | int verbose; |
48 | int allswaps; | 48 | int allswaps; |
49 | 49 | ||
@@ -376,12 +376,13 @@ process_arguments (int argc, char **argv) | |||
376 | switch (c) { | 376 | switch (c) { |
377 | case 'w': /* warning size threshold */ | 377 | case 'w': /* warning size threshold */ |
378 | if (is_intnonneg (optarg)) { | 378 | if (is_intnonneg (optarg)) { |
379 | warn_size = (float) atoi (optarg); | 379 | warn_size = (double) atoi (optarg); |
380 | break; | 380 | break; |
381 | } | 381 | } |
382 | else if (strstr (optarg, ",") && | 382 | else if (strstr (optarg, ",") && |
383 | strstr (optarg, "%") && | 383 | strstr (optarg, "%") && |
384 | sscanf (optarg, "%.0f,%d%%", &warn_size, &warn_percent) == 2) { | 384 | sscanf (optarg, "%g,%d%%", &warn_size, &warn_percent) == 2) { |
385 | warn_size = floor(warn_size); | ||
385 | break; | 386 | break; |
386 | } | 387 | } |
387 | else if (strstr (optarg, "%") && | 388 | else if (strstr (optarg, "%") && |
@@ -393,12 +394,13 @@ process_arguments (int argc, char **argv) | |||
393 | } | 394 | } |
394 | case 'c': /* critical size threshold */ | 395 | case 'c': /* critical size threshold */ |
395 | if (is_intnonneg (optarg)) { | 396 | if (is_intnonneg (optarg)) { |
396 | crit_size = (float) atoi (optarg); | 397 | crit_size = (double) atoi (optarg); |
397 | break; | 398 | break; |
398 | } | 399 | } |
399 | else if (strstr (optarg, ",") && | 400 | else if (strstr (optarg, ",") && |
400 | strstr (optarg, "%") && | 401 | strstr (optarg, "%") && |
401 | sscanf (optarg, "%.0f,%d%%", &crit_size, &crit_percent) == 2) { | 402 | sscanf (optarg, "%g,%d%%", &crit_size, &crit_percent) == 2) { |
403 | crit_size = floor(crit_size); | ||
402 | break; | 404 | break; |
403 | } | 405 | } |
404 | else if (strstr (optarg, "%") && | 406 | else if (strstr (optarg, "%") && |
@@ -439,12 +441,12 @@ process_arguments (int argc, char **argv) | |||
439 | if (c == argc) | 441 | if (c == argc) |
440 | return validate_arguments (); | 442 | return validate_arguments (); |
441 | if (warn_size == 0 && is_intnonneg (argv[c])) | 443 | if (warn_size == 0 && is_intnonneg (argv[c])) |
442 | warn_size = (float) atoi (argv[c++]); | 444 | warn_size = (double) atoi (argv[c++]); |
443 | 445 | ||
444 | if (c == argc) | 446 | if (c == argc) |
445 | return validate_arguments (); | 447 | return validate_arguments (); |
446 | if (crit_size == 0 && is_intnonneg (argv[c])) | 448 | if (crit_size == 0 && is_intnonneg (argv[c])) |
447 | crit_size = atoi (argv[c++]); | 449 | crit_size = (double) atoi (argv[c++]); |
448 | 450 | ||
449 | return validate_arguments (); | 451 | return validate_arguments (); |
450 | } | 452 | } |