summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c24fba)
raw | patch | inline | side by side (parent: 8c24fba)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Tue, 11 Nov 2003 10:27:16 +0000 (10:27 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Tue, 11 Nov 2003 10:27:16 +0000 (10:27 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@761 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_swap.c | patch | blob | history |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index b8f82db1e7156a09ba2db62f0227133cec73802c..3bf7d432c9f63839bdcde92cd759c833fdcbea00 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
long unsigned int dsktotal, dskused, dskfree;
int result = STATE_OK;
char input_buffer[MAX_INPUT_BUFFER];
+ char *perf;
#ifdef HAVE_PROC_MEMINFO
FILE *fp;
#else
textdomain (PACKAGE);
status = strdup("");
+ perf = strdup("");
if (process_arguments (argc, argv) != OK)
usage (_("Invalid command arguments supplied\n"));
asprintf (&status, _(" %d%% free (%lu MB out of %lu MB)%s"),
(100 - percent_used), free_swap, total_swap, status);
- die (result, "SWAP %s:%s\n", state_text (result), status);
+ asprintf (&perf, "%s", perfdata ("swap", free_swap, "MB",
+ TRUE, max (warn_size/1024, warn_percent/100.0*total_swap),
+ TRUE, max (crit_size/1024, crit_percent/100.0*total_swap),
+ TRUE, 0,
+ TRUE, total_swap));
+ die (result, "SWAP %s:%s |%s\n", state_text (result), status, perf);
return STATE_UNKNOWN;
}
c = optind;
if (c == argc)
return validate_arguments ();
- if (warn_percent > 100 && is_intnonneg (argv[c]))
+ if (warn_percent == 0 && is_intnonneg (argv[c]))
warn_percent = atoi (argv[c++]);
if (c == argc)
return validate_arguments ();
- if (crit_percent > 100 && is_intnonneg (argv[c]))
+ if (crit_percent == 0 && is_intnonneg (argv[c]))
crit_percent = atoi (argv[c++]);
if (c == argc)
int
validate_arguments (void)
{
- if (warn_percent > 100 && crit_percent > 100 && warn_size == 0
+ if (warn_percent == 0 && crit_percent == 0 && warn_size == 0
&& crit_size == 0) {
return ERROR;
}