diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-11-11 10:27:16 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-11-11 10:27:16 +0000 |
commit | 3cf9823dfee9bdb7b6e37ebed8d535ed5ccb309b (patch) | |
tree | bab787f6d2da430a30facc30e5d14e8f9ee12089 /plugins/check_swap.c | |
parent | 8c24fba55cb9df7a6bddcc07fdee64b588f6c1ed (diff) | |
download | monitoring-plugins-3cf9823dfee9bdb7b6e37ebed8d535ed5ccb309b.tar.gz |
Added perfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@761 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r-- | plugins/check_swap.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index b8f82db1..3bf7d432 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -55,6 +55,7 @@ main (int argc, char **argv) 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 @@ -73,6 +74,7 @@ main (int argc, char **argv) textdomain (PACKAGE); status = strdup(""); + perf = strdup(""); if (process_arguments (argc, argv) != OK) usage (_("Invalid command arguments supplied\n")); @@ -222,7 +224,12 @@ main (int argc, char **argv) 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; } @@ -329,12 +336,12 @@ process_arguments (int argc, char **argv) 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) @@ -357,7 +364,7 @@ process_arguments (int argc, char **argv) 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; } |