forked from pool/monitoring-plugins
7e6efb42c5
Enhancements General + using PRId64 and PRIu64 instead of %ld directly Single Plugins + check_http: Make faster with larger files + check_snmp: add 'multiplier' to modify current value + check_http: Implement chunked encoding decoding + check_http/check_curl: add chunked encoding test + check_log: Added --exclude to exclude patterns + check_log: Add tests + check_disk: Clarify usage possibilites Fixes General + fixed two PRId64 to PRIu64 in perfdata_uint64 Single Plugins + check_pgsql: Removing is_pg_dbname alltogether,using postgres API. + check_http: Remove superflous CRLF in HTTP-Requests + check_curl: detect ipv6 + check_icmp: fix parsing help/version long options + check_http: fix test plan + check_disk: Find accessible mount path if multiple are available + check_apt: Fix unknown escape sequence error output + check_curl: fix checking large bodys + check_snmp: Improve tests for check_snmp & multiply option + check_snmp: always apply format when applying multiplier + check_http: Use real booleans instead of ints + check_http: Document process_arguments a little bit better + check_http: Remove dead code + check_http: Fix several bug in the implementation of unchunking OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=101
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
|
|
@@ -137,7 +137,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));
|