Below is a working patch. Sorry for the confusion. Regards,
Allard Hoeve
diff -urb nagios-plugins-1.4/plugins/check_swap.c nagios-plugins-1.4.new/plugins/check_swap.c --- nagios-plugins-1.4/plugins/check_swap.c 2005-01-19 22:14:47.000000000 +0100 +++ nagios-plugins-1.4.new/plugins/check_swap.c 2005-09-16 12:14:18.762122808 +0200 @@ -311,6 +311,7 @@ # endif /* HAVE_SWAP */ #endif /* HAVE_PROC_MEMINFO */ + if (total_swap > 0) { percent_used = 100 * ((double) used_swap) / ((double) total_swap); result = max_state (result, check_swap (percent_used, free_swap)); /* broken into two steps because of funkiness with builtin asprintf */ @@ -323,6 +324,14 @@ TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap), TRUE, 0, TRUE, (long) total_swap)); + } + else + { + result = STATE_OK; + asprintf (&status, "no swap installed"); + asprintf (&perf, "(N/A)"); + } + printf ("SWAP %s:%s |%s\n", state_text (result), status, perf); return result; }