[packages/nagios-plugin-check_snmp_mem] fix Net::SNMP version comparision on v6.0.1

glen glen at pld-linux.org
Mon Sep 15 21:05:49 CEST 2014


commit acc286c5f653261858957c9884243b862c2ec9a7
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Sep 15 22:05:13 2014 +0300

    fix Net::SNMP version comparision on v6.0.1
    
    Argument "v6.0.1" isn't numeric in numeric lt (<) at /usr/lib/nagios/plugins/check_snmp_mem line 414.

 nagios-plugin-check_snmp_mem-path.patch |  4 ++--
 nagios-plugin-check_snmp_mem.spec       |  8 +++++---
 net-snmp-version.patch                  | 21 +++++++++++++++++++++
 3 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/nagios-plugin-check_snmp_mem.spec b/nagios-plugin-check_snmp_mem.spec
index 52b12d8..4e1dd99 100644
--- a/nagios-plugin-check_snmp_mem.spec
+++ b/nagios-plugin-check_snmp_mem.spec
@@ -10,6 +10,7 @@ Group:		Networking
 Source0:	http://nagios.proy.org/check_snmp_mem.pl
 # Source0-md5:	f4b03cf520e6e4eab9dc6a67c88032d9
 Patch0:		%{name}-path.patch
+Patch1:		net-snmp-version.patch
 Source1:	%{plugin}.cfg
 URL:		http://nagios.proy.org/snmp_mem.html
 BuildRequires:	rpm-perlprov >= 4.1-13
@@ -34,15 +35,16 @@ systemach Linux/Unix, Cisco, HP Procurve.
 
 %prep
 %setup -qcT
-install -p %{SOURCE0} %{plugin}
+install -p %{SOURCE0} .
 %patch0 -p1
+%patch1 -p1
 
-%{__sed} -i -e 's, at plugindir@,%{plugindir},' %{plugin}
+%{__sed} -i -e 's, at plugindir@,%{plugindir},' %{plugin}.pl
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
-install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}
+install -p %{plugin}.pl $RPM_BUILD_ROOT%{plugindir}/%{plugin}
 %{__sed} -e 's, at plugindir@,%{plugindir},' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
 
 %clean
diff --git a/nagios-plugin-check_snmp_mem-path.patch b/nagios-plugin-check_snmp_mem-path.patch
index 27052e4..07c0165 100644
--- a/nagios-plugin-check_snmp_mem-path.patch
+++ b/nagios-plugin-check_snmp_mem-path.patch
@@ -1,5 +1,5 @@
---- nagios-plugin-check_snmp_mem-0.9.orig/check_snmp_mem	2006-03-06 14:06:54.000000000 +0100
-+++ nagios-plugin-check_snmp_mem-0.9/check_snmp_mem	2006-03-06 14:33:17.000000000 +0100
+--- nagios-plugin-check_snmp_mem-0.9.orig/check_snmp_mem.pl	2006-03-06 14:06:54.000000000 +0100
++++ nagios-plugin-check_snmp_mem-0.9/check_snmp_mem.pl	2006-03-06 14:33:17.000000000 +0100
 @@ -17,7 +17,7 @@
  
  # Nagios specific
diff --git a/net-snmp-version.patch b/net-snmp-version.patch
new file mode 100644
index 0000000..0cfd0ec
--- /dev/null
+++ b/net-snmp-version.patch
@@ -0,0 +1,21 @@
+--- ./check_snmp_mem.pl	2012-02-06 20:44:24.000000000 +0200
++++ ./check_snmp_mem.pl	2014-09-15 22:02:18.000000000 +0300
+@@ -13,6 +13,6 @@
+ #
+ 
+ use strict;
+-use Net::SNMP;
++use Net::SNMP 5;
+ use Getopt::Long;
+ 
+@@ -462,9 +462,7 @@
+ if (defined ($o_netsnmp)) {
+ 
+   # Get NetSNMP memory values
+-  $resultat = (Net::SNMP->VERSION < 4) ?
+-		$session->get_request(@nets_oids)
+-		:$session->get_request(-varbindlist => \@nets_oids);
++  $resultat = $session->get_request(-varbindlist => \@nets_oids);
+   
+   if (!defined($resultat)) {
+     printf("ERROR: netsnmp : %s.\n", $session->error);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_snmp_mem.git/commitdiff/acc286c5f653261858957c9884243b862c2ec9a7



More information about the pld-cvs-commit mailing list