[nagios-plugins] Merged check_udp into check_tcp and fixed check_swap

Peter Lemenkov peter at fedoraproject.org
Thu Oct 7 14:59:03 UTC 2010


commit 3d8a254f591db80ea2c373d54f1acbbc2c4bdf9a
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Thu Oct 7 18:59:01 2010 +0400

    Merged check_udp into check_tcp and fixed check_swap
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 .gitignore                                         |    1 +
 ...lugins-0001-Do-not-use-usr-local-for-perl.patch |    8 +-
 ...Remove-assignment-of-not-parsed-to-jitter.patch |    6 +-
 ...ific-fixes-for-searching-for-diff-and-tai.patch |    6 +-
 ...ific-patch-for-not-to-fixing-fully-qualif.patch |    6 +-
 ...heck_linux_raid-with-on-linear-raid0-arra.patch |   53 +++++++++++++++
 ...ck_swap-from-returning-OK-if-no-swap-acti.patch |   50 ++++++++++++++
 nagios-plugins.spec                                |   71 +++++++++++--------
 8 files changed, 158 insertions(+), 43 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a2bba48..cf52aaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 nagios-plugins-1.4.14.tar.gz
 nagios-plugins-1.4.15.tar.gz
+/nagios-plugins-1.4.15.tar.gz
diff --git a/nagios-plugins-0001-Do-not-use-usr-local-for-perl.patch b/nagios-plugins-0001-Do-not-use-usr-local-for-perl.patch
index 8ed789d..8fb9fc2 100644
--- a/nagios-plugins-0001-Do-not-use-usr-local-for-perl.patch
+++ b/nagios-plugins-0001-Do-not-use-usr-local-for-perl.patch
@@ -1,14 +1,14 @@
-From 7db89e0edeeb9006234ee8b8a92065acca0d02a5 Mon Sep 17 00:00:00 2001
+From 09c8c8357094670da50fa517342be72e5a16226d Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Wed, 10 Mar 2010 12:02:00 +0300
-Subject: [PATCH 1/5] Do not use /usr/local for perl
+Subject: [PATCH 1/6] Do not use /usr/local for perl
 
 ---
  contrib/check_linux_raid.pl |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl
-index da1aff8..11bc3cd 100644
+index d2e5b46..1647b8b 100644
 --- a/contrib/check_linux_raid.pl
 +++ b/contrib/check_linux_raid.pl
 @@ -23,7 +23,7 @@
@@ -21,5 +21,5 @@ index da1aff8..11bc3cd 100644
  
  # die with an error if we're not on Linux
 -- 
-1.6.6.1
+1.7.2.3
 
diff --git a/nagios-plugins-0002-Remove-assignment-of-not-parsed-to-jitter.patch b/nagios-plugins-0002-Remove-assignment-of-not-parsed-to-jitter.patch
index 5e35ba4..2059976 100644
--- a/nagios-plugins-0002-Remove-assignment-of-not-parsed-to-jitter.patch
+++ b/nagios-plugins-0002-Remove-assignment-of-not-parsed-to-jitter.patch
@@ -1,7 +1,7 @@
-From 85fb9c0abeb554568c2e3f27a9fe215a6e9fb77d Mon Sep 17 00:00:00 2001
+From 926b133a5207ea9113f5b2ca9e4c440f8bad59ec Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Wed, 10 Mar 2010 12:08:35 +0300
-Subject: [PATCH 2/5] Remove assignment of (not parsed) to jitter
+Subject: [PATCH 2/6] Remove assignment of (not parsed) to jitter
 
 ---
  plugins-scripts/check_ntp.pl |    1 -
@@ -20,5 +20,5 @@ index 5c87e0a..0733a63 100755
  			
  		}
 -- 
-1.6.6.1
+1.7.2.3
 
diff --git a/nagios-plugins-0003-Fedora-specific-fixes-for-searching-for-diff-and-tai.patch b/nagios-plugins-0003-Fedora-specific-fixes-for-searching-for-diff-and-tai.patch
index eaf588a..b86594c 100644
--- a/nagios-plugins-0003-Fedora-specific-fixes-for-searching-for-diff-and-tai.patch
+++ b/nagios-plugins-0003-Fedora-specific-fixes-for-searching-for-diff-and-tai.patch
@@ -1,7 +1,7 @@
-From 5e778e429ee782992f1eaa862df095fd3b353576 Mon Sep 17 00:00:00 2001
+From 8b87821cd7c6df328ec60662047720bba0673889 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Wed, 10 Mar 2010 12:10:16 +0300
-Subject: [PATCH 3/5] Fedora-specific fixes for searching for diff and tail
+Subject: [PATCH 3/6] Fedora-specific fixes for searching for diff and tail
 
 ---
  plugins-scripts/check_log.sh |    4 ++--
@@ -23,5 +23,5 @@ index a1bfb48..20fc2b2 100755
  RM="/bin/rm"
  CHMOD="/bin/chmod"
 -- 
-1.6.6.1
+1.7.2.3
 
diff --git a/nagios-plugins-0004-Fedora-specific-patch-for-not-to-fixing-fully-qualif.patch b/nagios-plugins-0004-Fedora-specific-patch-for-not-to-fixing-fully-qualif.patch
index c265a0a..5449271 100644
--- a/nagios-plugins-0004-Fedora-specific-patch-for-not-to-fixing-fully-qualif.patch
+++ b/nagios-plugins-0004-Fedora-specific-patch-for-not-to-fixing-fully-qualif.patch
@@ -1,7 +1,7 @@
-From 28a32b3e87ac5489a544e6727a65ff98a9dfaeb3 Mon Sep 17 00:00:00 2001
+From e0df8721cb3571cc6a91d042e52addb8abbd39c8 Mon Sep 17 00:00:00 2001
 From: Peter Lemenkov <lemenkov at gmail.com>
 Date: Wed, 10 Mar 2010 12:15:08 +0300
-Subject: [PATCH 4/5] Fedora-specific patch for not to fixing fully qualified paths in scripts
+Subject: [PATCH 4/6] Fedora-specific patch for not to fixing fully qualified paths in scripts
 
 ---
  plugins-scripts/subst.in |   10 +++++-----
@@ -29,5 +29,5 @@ index a70ad88..08f2895 100644
  # add to libexecdir to INC for perl utils.pm
  /^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } }
 -- 
-1.6.6.1
+1.7.2.3
 
diff --git a/nagios-plugins-0005-Patch-for-check_linux_raid-with-on-linear-raid0-arra.patch b/nagios-plugins-0005-Patch-for-check_linux_raid-with-on-linear-raid0-arra.patch
new file mode 100644
index 0000000..779d84f
--- /dev/null
+++ b/nagios-plugins-0005-Patch-for-check_linux_raid-with-on-linear-raid0-arra.patch
@@ -0,0 +1,53 @@
+From e84e5e6caafb1ac02cb8a4a7b18a2d8eebf298b2 Mon Sep 17 00:00:00 2001
+From: Thomas Guyot-Sionnest <dermoth at aei.ca>
+Date: Tue, 5 Oct 2010 23:19:03 -0400
+Subject: [PATCH 5/6] Patch for check_linux_raid with on linear/raid0 arrays
+
+Fixes bug #3049988, Debian bug #579049
+---
+ contrib/check_linux_raid.pl |   12 +++++++++---
+ 1 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/contrib/check_linux_raid.pl b/contrib/check_linux_raid.pl
+index 1647b8b..3a15ac8 100644
+--- a/contrib/check_linux_raid.pl
++++ b/contrib/check_linux_raid.pl
+@@ -71,7 +71,8 @@ while(defined $nextdev){
+ 		} elsif (/^($nextdev)\s*:/) {
+ 			$device=$1;
+ 			$devices{$device}=$device;
+-			if (/active/) {
++			if (/\sactive/) {
++				$status{$device} = ''; # Shall be filled later if available
+ 				$active{$device} = 1;
+ 			}
+ 		}
+@@ -80,7 +81,11 @@ while(defined $nextdev){
+ }
+ 
+ foreach my $k (sort keys %devices){
+-	if ($status{$k} =~ /_/) {
++	if (!exists($status{$k})) {
++		$msg .= sprintf " %s inactive with no status information.",
++			$devices{$k};
++		$code = max_state($code, "CRITICAL");
++	} elsif ($status{$k} =~ /_/) {
+ 		if (defined $recovery{$k}) {
+ 			$msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
+ 				$devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
+@@ -94,10 +99,11 @@ foreach my $k (sort keys %devices){
+ 		$code = max_state($code, "OK");
+ 	} else {
+ 		if ($active{$k}) {
+-			$msg .= sprintf " %s active with no status information.\n",
++			$msg .= sprintf " %s active with no status information.",
+ 				$devices{$k};
+ 			$code = max_state($code, "OK");
+ 		} else {
++			# This should't run anymore, but is left as a catch-all
+ 			$msg .= sprintf " %s does not exist.\n", $devices{$k};
+ 			$code = max_state($code, "CRITICAL");
+ 		}
+-- 
+1.7.2.3
+
diff --git a/nagios-plugins-0006-Prevent-check_swap-from-returning-OK-if-no-swap-acti.patch b/nagios-plugins-0006-Prevent-check_swap-from-returning-OK-if-no-swap-acti.patch
new file mode 100644
index 0000000..41f791c
--- /dev/null
+++ b/nagios-plugins-0006-Prevent-check_swap-from-returning-OK-if-no-swap-acti.patch
@@ -0,0 +1,50 @@
+From f3e6c9663369d011b241c6fb2c8fd5312f98cacf Mon Sep 17 00:00:00 2001
+From: Jan ONDREJ <ondrejj at 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 at kecom ~]# rpm -q nagios-plugins
+nagios-plugins-1.4.13-11.fc10.i386
+[root at 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
+---
+ plugins/check_swap.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/plugins/check_swap.c b/plugins/check_swap.c
+index ce1f602..6d1d0c1 100644
+--- a/plugins/check_swap.c
++++ b/plugins/check_swap.c
+@@ -124,7 +124,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 (percent, dskfree_mb));
+-- 
+1.7.2.3
+
diff --git a/nagios-plugins.spec b/nagios-plugins.spec
index be222b5..d33c6a5 100644
--- a/nagios-plugins.spec
+++ b/nagios-plugins.spec
@@ -1,6 +1,6 @@
 Name: nagios-plugins
 Version: 1.4.15
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Host/service/network monitoring program plugins for Nagios
 
 Group: Applications/System
@@ -12,6 +12,10 @@ Patch1:	nagios-plugins-0001-Do-not-use-usr-local-for-perl.patch
 Patch2: nagios-plugins-0002-Remove-assignment-of-not-parsed-to-jitter.patch
 Patch3: nagios-plugins-0003-Fedora-specific-fixes-for-searching-for-diff-and-tai.patch
 Patch4: nagios-plugins-0004-Fedora-specific-patch-for-not-to-fixing-fully-qualif.patch
+# Backported from upstream
+Patch5: nagios-plugins-0005-Patch-for-check_linux_raid-with-on-linear-raid0-arra.patch
+# https://bugzilla.redhat.com/512559
+Patch6: nagios-plugins-0006-Prevent-check_swap-from-returning-OK-if-no-swap-acti.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -40,7 +44,6 @@ Requires: nagios-common
 
 
 %description
-
 Nagios is a program that will monitor hosts and services on your
 network, and to email or page you when a problem arises or is
 resolved. Nagios runs on a Unix server as a background or daemon
@@ -52,7 +55,7 @@ contains those plugins.
 %package all
 Summary: Nagios Plugins - All plugins
 Group: Applications/System
-Requires: nagios-plugins-breeze, nagios-plugins-by_ssh, nagios-plugins-dhcp, nagios-plugins-dig, nagios-plugins-disk, nagios-plugins-disk_smb, nagios-plugins-dns, nagios-plugins-dummy, nagios-plugins-file_age, nagios-plugins-flexlm, nagios-plugins-fping, nagios-plugins-hpjd, nagios-plugins-http, nagios-plugins-icmp, nagios-plugins-ide_smart, nagios-plugins-ircd, nagios-plugins-ldap, nagios-plugins-load, nagios-plugins-log, nagios-plugins-mailq, nagios-plugins-mrtg, nagios-plugins-mrtgtraf, nagios-plugins-mysql, nagios-plugins-nagios, nagios-plugins-nt, nagios-plugins-ntp, nagios-plugins-nwstat, nagios-plugins-oracle, nagios-plugins-overcr, nagios-plugins-pgsql, nagios-plugins-ping, nagios-plugins-procs, nagios-plugins-game, nagios-plugins-real, nagios-plugins-rpc, nagios-plugins-smtp, nagios-plugins-snmp, nagios-plugins-ssh, nagios-plugins-swap, nagios-plugins-tcp, nagios-plugins-time, nagios-plugins-udp, nagios-plugins-ups, nagios-plugins-users, nagios-plugins-wave, nagios-
 plugins-cluster
+Requires: nagios-plugins-breeze, nagios-plugins-by_ssh, nagios-plugins-dhcp, nagios-plugins-dig, nagios-plugins-disk, nagios-plugins-disk_smb, nagios-plugins-dns, nagios-plugins-dummy, nagios-plugins-file_age, nagios-plugins-flexlm, nagios-plugins-fping, nagios-plugins-hpjd, nagios-plugins-http, nagios-plugins-icmp, nagios-plugins-ide_smart, nagios-plugins-ircd, nagios-plugins-ldap, nagios-plugins-load, nagios-plugins-log, nagios-plugins-mailq, nagios-plugins-mrtg, nagios-plugins-mrtgtraf, nagios-plugins-mysql, nagios-plugins-nagios, nagios-plugins-nt, nagios-plugins-ntp, nagios-plugins-nwstat, nagios-plugins-oracle, nagios-plugins-overcr, nagios-plugins-pgsql, nagios-plugins-ping, nagios-plugins-procs, nagios-plugins-game, nagios-plugins-real, nagios-plugins-rpc, nagios-plugins-smtp, nagios-plugins-snmp, nagios-plugins-ssh, nagios-plugins-swap, nagios-plugins-tcp, nagios-plugins-time, nagios-plugins-ups, nagios-plugins-users, nagios-plugins-wave, nagios-plugins-cluster
 %ifnarch ppc ppc64 sparc sparc64
 Requires: nagios-plugins-sensors
 %endif
@@ -475,11 +478,22 @@ Provides check_swap support for Nagios.
 Summary: Nagios Plugin - check_tcp
 Group: Applications/System
 Requires: nagios-plugins = %{version}-%{release}
-Provides: nagios-plugins-ftp, nagios-plugins-imap, nagios-plugins-jabber, nagios-plugins-nntp, nagios-plugins-nntps, nagios-plugins-pop, nagios-plugins-simap, nagios-plugins-spop, nagios-plugins-ssmtp, nagios-plugins-udp2
+Provides: nagios-plugins-ftp = %{version}-%{release}
+Provides: nagios-plugins-imap = %{version}-%{release}
+Provides: nagios-plugins-jabber = %{version}-%{release}
+Provides: nagios-plugins-nntp = %{version}-%{release}
+Provides: nagios-plugins-nntps = %{version}-%{release}
+Provides: nagios-plugins-pop = %{version}-%{release}
+Provides: nagios-plugins-simap = %{version}-%{release}
+Provides: nagios-plugins-spop = %{version}-%{release}
+Provides: nagios-plugins-ssmtp = %{version}-%{release}
+Provides: nagios-plugins-udp = %{version}-%{release}
+Provides: nagios-plugins-udp2 = %{version}-%{release}
+Obsoletes: nagios-plugins-udp < 1.4.15-2
 
 %description tcp
-Provides check_tcp, check_ftp, check_imap, check_jabber, check_nntp, 
-check_nntps, check_pop, check_simap, check_spop, check_ssmtp, check_udp2
+Provides check_tcp, check_ftp, check_imap, check_jabber, check_nntp,
+check_nntps, check_pop, check_simap, check_spop, check_ssmtp, check_udp
 and check_clamd support for Nagios.
 
 %package time
@@ -490,14 +504,6 @@ Requires: nagios-plugins = %{version}-%{release}
 %description time
 Provides check_time support for Nagios.
 
-%package udp
-Summary: Nagios Plugin - check_udp
-Group: Applications/System
-Requires: nagios-plugins = %{version}-%{release}
-
-%description udp
-Provides check_udp support for Nagios.
-
 %package ups
 Summary: Nagios Plugin - check_ups
 Group: Applications/System
@@ -528,6 +534,8 @@ Provides check_wave support for Nagios.
 %patch2 -p1 -b .not_parsed
 %patch3 -p1 -b .proper_paths
 %patch4 -p1 -b .no_need_fo_fix_paths
+%patch5 -p1 -b .fix_linear_raid
+%patch6 -p1 -b .fix_missing_swap
 
 %build
 %configure \
@@ -563,24 +571,24 @@ cp %{SOURCE1} ./README.Fedora
 
 %install
 sed -i 's,^MKINSTALLDIRS.*,MKINSTALLDIRS = ../mkinstalldirs,' po/Makefile
-%{__rm} -rf %{buildroot}
-%{__make} AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=%{buildroot} install
-%{__install} -m 0755 plugins-root/check_icmp %{buildroot}/%{_libdir}/nagios/plugins
-%{__install} -m 0755 plugins-root/check_dhcp %{buildroot}/%{_libdir}/nagios/plugins
-%{__install} -m 0755 contrib/check_linux_raid %{buildroot}/%{_libdir}/nagios/plugins
-%{__install} -m 0755 plugins/check_ide_smart %{buildroot}/%{_libdir}/nagios/plugins
-%{__install} -m 0755 plugins/check_ldap %{buildroot}/%{_libdir}/nagios/plugins
+rm -rf %{buildroot}
+make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=%{buildroot} install
+install -m 0755 plugins-root/check_icmp %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 plugins-root/check_dhcp %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 contrib/check_linux_raid %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 plugins/check_ide_smart %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 plugins/check_ldap %{buildroot}/%{_libdir}/nagios/plugins
 %if 0%{?el4}
 %else
-%{__install} -m 0755 plugins/check_radius %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 plugins/check_radius %{buildroot}/%{_libdir}/nagios/plugins
 %endif
-%{__install} -m 0755 plugins/check_pgsql %{buildroot}/%{_libdir}/nagios/plugins
+install -m 0755 plugins/check_pgsql %{buildroot}/%{_libdir}/nagios/plugins
 
 %ifarch ppc ppc64 sparc sparc64
-%{__rm} -f %{buildroot}/%{_libdir}/nagios/plugins/check_sensors
+rm -f %{buildroot}/%{_libdir}/nagios/plugins/check_sensors
 %endif
 
-%{__chmod} 644 %{buildroot}/%{_libdir}/nagios/plugins/utils.pm
+chmod 644 %{buildroot}/%{_libdir}/nagios/plugins/utils.pm
 
 %find_lang %{name}
 
@@ -796,7 +804,6 @@ rm -rf %{buildroot}
 
 %files tcp
 %defattr(-,root,root,-)
-%{_libdir}/nagios/plugins/check_tcp
 %{_libdir}/nagios/plugins/check_clamd
 %{_libdir}/nagios/plugins/check_ftp
 %{_libdir}/nagios/plugins/check_imap
@@ -807,15 +814,13 @@ rm -rf %{buildroot}
 %{_libdir}/nagios/plugins/check_simap
 %{_libdir}/nagios/plugins/check_spop
 %{_libdir}/nagios/plugins/check_ssmtp
+%{_libdir}/nagios/plugins/check_tcp
+%{_libdir}/nagios/plugins/check_udp
 
 %files time
 %defattr(-,root,root,-)
 %{_libdir}/nagios/plugins/check_time
 
-%files udp
-%defattr(-,root,root,-)
-%{_libdir}/nagios/plugins/check_udp
-
 %files ups
 %defattr(-,root,root,-)
 %{_libdir}/nagios/plugins/check_ups
@@ -829,6 +834,12 @@ rm -rf %{buildroot}
 %{_libdir}/nagios/plugins/check_wave
 
 %changelog
+* Thu Oct  7 2010 Peter Lemenkov <lemenkov at gmail.com> - 1.4.15-2
+- Dropped check_udp sub-package (see rhbz #634067). Anyway it
+  provided just a symlink to check_tcp.
+- Fixed weird issue with check_swap returning ok in case of
+  missing swap (see rhbz #512559).
+
 * Wed Aug 18 2010 Peter Lemenkov <lemenkov at gmail.com> - 1.4.15-1
 - Ver. 1.4.15
 - Dropped patch for restoration of behaviour in case of ssl checks


More information about the scm-commits mailing list