summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am3
-rw-r--r--plugins/check_swap.c18
2 files changed, 12 insertions, 9 deletions
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@
9localedir = $(datadir)/locale 9localedir = $(datadir)/locale
10DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ 10DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
11LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@ 11LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@
12MATHLIBS = @MATHLIBS@
12 13
13libexec_PROGRAMS = check_dhcp check_disk check_dummy check_http check_load \ 14libexec_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)
72check_snmp_LDADD = $(BASEOBJS) popen.o 73check_snmp_LDADD = $(BASEOBJS) popen.o
73check_smtp_LDADD = $(NETLIBS) $(SSLLIBS) 74check_smtp_LDADD = $(NETLIBS) $(SSLLIBS)
74check_ssh_LDADD = $(NETLIBS) 75check_ssh_LDADD = $(NETLIBS)
75check_swap_LDADD = $(BASEOBJS) popen.o 76check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o
76check_tcp_LDADD = $(NETLIBS) $(SSLLIBS) 77check_tcp_LDADD = $(NETLIBS) $(SSLLIBS)
77check_time_LDADD = $(NETLIBS) 78check_time_LDADD = $(NETLIBS)
78check_udp_LDADD = $(NETLIBS) 79check_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
43int warn_percent = 0; 43int warn_percent = 0;
44int crit_percent = 0; 44int crit_percent = 0;
45float warn_size = 0; 45double warn_size = 0;
46float crit_size = 0; 46double crit_size = 0;
47int verbose; 47int verbose;
48int allswaps; 48int 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}