SteScho / manubulon-snmp

Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol.
GNU General Public License v2.0
73 stars 71 forks source link

Net::SNMP version string no longer numeric in CentOS 7 #9

Closed morgajel closed 8 years ago

morgajel commented 9 years ago

on the new EL7 systems, the EPEL package perl-Net-SNMP-6.0.1-7.el7.noarch now has the variable Net::SNMP->VERSION set as a string rather than a number:

/usr/share/perl5/vendor_perl/Net/SNMP.pm:109:   our $VERSION = 'v6.0.1';

perl -e 'use Net::SNMP; print Net::SNMP->VERSION ."\n" ;'
v6.0.1

This is a problem for check_snmp_load.pl, which now throws Argument "v6.0.1" isn't numeric in numeric lt (<) at /opt/manubulon/plugins/check_snmp_load.pl line 368.

The comparison (Net::SNMP->VERSION < 4) is no longer valid, and is used in multiple checks.

It may make sense to use something like http://search.cpan.org/~bdfoy/Perl-Version-1.013/lib/Perl/Version.pm, although that would create another dependency.

dnsmichi commented 8 years ago

Found a thread over at https://monitoring-portal.org/index.php?thread/21733-check-snmp-load-argument-v6-0-1-isn-t-numeric-in-numeric-lt-at-check-snmp-load-l/&postID=188173#post188173

find . -type f -name '*.pl' -exec gsed -i 's/Net::SNMP->VERSION lt 4/version->parse\(Net::SNMP->VERSION\) < 4/g' {} \;

Works for me.