dd6cd0cb02
- update to 2.4.0 General + Use C99 booleans @RincewindsHat + Improve negate plugin helptext @euniceremoquillo + Add new test function for percentage expressions @RincewindsHat Single Plugins + check_mailq: remove trailing whitespaces @sni + check_mailq: unify tabs/spaces @sni + check_oracle: Shellcheck fixes @RincewindsHat + check_ups: output ups.realpower if supported @sbraz + check_disk: add -n short option for --ignore-missing @sni + check_procs: Improve help text, mentioning excluded processes @shartge + check_procs: Generalise wording, remove mentioning of nrpe @shartge + check_curl: add haproxy protocol option @emriver + check_disk: increase alert precision @sni + check_ircd: IPv6 support @oxzi + check_nwstat: adds percentage used space + check_swap: Possibility to run check_swap without thresholds @Napsty + check_ups: additional alarm conditions @RincewindsHat + check_http/check_curl: added a --regex-state option to change the state of a regex check @andreasbaumann General Fixes + Fixes for -Wsign-compare @RincewindsHat + Fix logic in is_uint64_t to fix type-limit warning @RincewindsHat + Prevent -lcrypto from showing up in Makefile dependencies @EricFromCanada + Change irritating NULL assignment @RincewindsHat Single Plugin Fixes + check_dbi: Compiler warning for uninitialized variable @RincewindsHat + check_curl: Initialize pointer before usage @RincewindsHat + check_ntp: Initialize intermediate results in any case @RincewindsHat + check_tcp: Fixes an error with using the wrong type for a variable @RincewindsHat OBS-URL: https://build.opensuse.org/request/show/1194151 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=123
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
From f3e6c9663369d011b241c6fb2c8fd5312f98cacf Mon Sep 17 00:00:00 2001
|
|
From: Jan ONDREJ <ondrejj@salstar.sk>
|
|
Date: Thu, 7 Oct 2010 17:28:48 +0400
|
|
Subject: [PATCH 6/6] Prevent check_swap from returning OK, if no swap activated
|
|
|
|
My swap was not activated on boot for unknown reason and nagios does not
|
|
report this as a problem. Here is an example:
|
|
|
|
[root@kecom ~]# rpm -q nagios-plugins
|
|
nagios-plugins-1.4.13-11.fc10.i386
|
|
[root@kecom ~]# /usr/lib/nagios/plugins/check_swap -w 80% -c 40% -c 1 -w 2
|
|
SWAP CRITICAL - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
|
|
|
|
If there is no swap and users is trying to test percentage of free swap,
|
|
consider 0 MB free swap space as problem, or of free/total raises division
|
|
by zero, then set percentage to 0%, not to 100%.
|
|
|
|
Steps to Reproduce:
|
|
1. make sure, your swap is empty or it's usage is not large
|
|
2. swapoff -a
|
|
3. /usr/lib/nagios/plugins/check_swap -w 80% -c 40%
|
|
|
|
Actual results:
|
|
SWAP OK - 100% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
|
|
|
|
Expected results:
|
|
SWAP CRITICAL - 0% free (0 MB out of 0 MB) |swap=0MB;0;0;0;0
|
|
|
|
Additional info:
|
|
https://bugzilla.redhat.com/512559
|
|
|
|
Index: monitoring-plugins-2.3.3/plugins/check_swap.c
|
|
===================================================================
|
|
--- monitoring-plugins-2.3.3.orig/plugins/check_swap.c
|
|
+++ monitoring-plugins-2.3.3/plugins/check_swap.c
|
|
@@ -134,7 +134,7 @@ main (int argc, char **argv)
|
|
free_swap_mb += dskfree_mb;
|
|
if (allswaps) {
|
|
if (dsktotal_mb == 0)
|
|
- percent=100.0;
|
|
+ percent = 0.0;
|
|
else
|
|
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
|
|
result = max_state (result, check_swap (dskfree_mb, dsktotal_mb));
|