1
0
monitoring-plugins/monitoring-plugins-2.3.5-check_swap_wrong_percent.patch

45 lines
1.6 KiB
Diff
Raw Normal View History

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
Accepting request 1144413 from home:adaugherity:branches:server:monitoring - enable check_curl by BuildRequiring its dependencies - restore patches not yet applied upstream (and rename to 2.3.5): + monitoring-plugins-2.3.3-check_log_-_quoting.patch + monitoring-plugins-2.3.3-check_http-proxy.patch - drop upstreamed patches: + monitoring-plugins-2.3.3-check_by_ssh.patch (GitHub #1774) + monitoring-plugins-2.3.3-check_disk_on_btrfs.patch (GH #1388) - GitHub issues for patches upstreamed on 2023-12-05: + monitoring-plugins-2.3.3-check_snmp.arrayaddress.patch (GH #1870) + monitoring-plugins-2.3.3-mariadb_102_build_fix.patch (GH #1522) + monitoring-plugins-2.3.3-check_dhcp_-_detect_rogue_dhcp_servers.patch (GH #1906) + monitoring-plugins-2.3.3-check_icmp.patch (GH #1807) + systemd-not-utmp.patch (GH #1888) - Repair the "no chown" patch to actually avoid calling chown; avoid automake build deps by patching Makefile.in rather than Makefile.am. + After upstream updated the gl subdir, it complains that the automake in SLE 12 SP5 is too old. - Fix build on SLE 12 SP5 (link failure due to mixing OpenSSL 1.0 & 1.1) by using only OpenSSL 1.1, and excluding curl subpackage (needs uriparser). - Rename patch files to match version number. - sync check_mssql package description with plugin's help output + Note that not all distros contain perl-DBD-Sybase and/or freetds - remove obsolete configure options + --with-ntp{q,dc,date}-command dropped upstream in 1.4.4 (e667553) + --with-proc-loadavg dropped in 1.4.6 (fe856aa) - remove unnecessary chmod commands during build - disable gettextize as upstream has (temporarily?) removed translations (GH #1947) OBS-URL: https://build.opensuse.org/request/show/1144413 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=119
2024-02-09 15:04:24 +01:00
@@ -134,7 +134,7 @@ main (int argc, char **argv)
free_swap_mb += dskfree_mb;
if (allswaps) {
if (dsktotal_mb == 0)
- percent=100.0;
Accepting request 1144413 from home:adaugherity:branches:server:monitoring - enable check_curl by BuildRequiring its dependencies - restore patches not yet applied upstream (and rename to 2.3.5): + monitoring-plugins-2.3.3-check_log_-_quoting.patch + monitoring-plugins-2.3.3-check_http-proxy.patch - drop upstreamed patches: + monitoring-plugins-2.3.3-check_by_ssh.patch (GitHub #1774) + monitoring-plugins-2.3.3-check_disk_on_btrfs.patch (GH #1388) - GitHub issues for patches upstreamed on 2023-12-05: + monitoring-plugins-2.3.3-check_snmp.arrayaddress.patch (GH #1870) + monitoring-plugins-2.3.3-mariadb_102_build_fix.patch (GH #1522) + monitoring-plugins-2.3.3-check_dhcp_-_detect_rogue_dhcp_servers.patch (GH #1906) + monitoring-plugins-2.3.3-check_icmp.patch (GH #1807) + systemd-not-utmp.patch (GH #1888) - Repair the "no chown" patch to actually avoid calling chown; avoid automake build deps by patching Makefile.in rather than Makefile.am. + After upstream updated the gl subdir, it complains that the automake in SLE 12 SP5 is too old. - Fix build on SLE 12 SP5 (link failure due to mixing OpenSSL 1.0 & 1.1) by using only OpenSSL 1.1, and excluding curl subpackage (needs uriparser). - Rename patch files to match version number. - sync check_mssql package description with plugin's help output + Note that not all distros contain perl-DBD-Sybase and/or freetds - remove obsolete configure options + --with-ntp{q,dc,date}-command dropped upstream in 1.4.4 (e667553) + --with-proc-loadavg dropped in 1.4.6 (fe856aa) - remove unnecessary chmod commands during build - disable gettextize as upstream has (temporarily?) removed translations (GH #1947) OBS-URL: https://build.opensuse.org/request/show/1144413 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=119
2024-02-09 15:04:24 +01:00
+ percent = 0.0;
else
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
result = max_state (result, check_swap (dskfree_mb, dsktotal_mb));