Bug 268891

Summary: net-mgmt/nagios-snmp-plugins-extras: Net::SNMP->VERSION format has changed
Product: Ports & Packages Reporter: Dan Langille <dvl>
Component: Individual Port(s)Assignee: Dan Langille <dvl>
Status: Closed FIXED    
Severity: Affects Many People CC: joneum
Priority: --- Flags: dvl: maintainer-feedback? (joneum)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Allow for non-numeric versions none

Description Dan Langille freebsd_committer freebsd_triage 2023-01-11 18:43:52 UTC
I'm seeing this error:

Argument "v6.0.1" isn't numeric in numeric lt (<) at /usr/local/libexec/nagios/check_snmp_storage.pl line 420.
Argument "v6.0.1" isn't numeric in numeric lt (<) at /usr/local/libexec/nagios/check_snmp_storage.pl line 494.

This affect other scripts with this package as well.

The lines in question look like this:

  if (Net::SNMP->VERSION < 4) {

I think the problem is caused by a change in format for Net::SNMP->VERSION - it is now alphanumeric and was previously numeric.

I have this code snippet to demonstrate a potential fix:

#!/usr/local/bin/perl

use strict;
use Net::SNMP;


print (Net::SNMP->VERSION);
print"\n";

if (Net::SNMP->VERSION lt "v4.0.0.0") {
     print "it is less than\n";
} else {
     print "it is NOT less than\n";
}

$ perl test-snmp-version.pl
v6.0.1
it is NOT less than


$ pkg info -x nagios-snmp-plugins-extras
nagios-snmp-plugins-extras-1.1.2_1


 pkg info -x net-snmp
net-snmp-5.9.1_1,1
p5-Net-SNMP-6.0.1_1
Comment 1 Dan Langille freebsd_committer freebsd_triage 2023-01-11 18:53:05 UTC
> it is now alphanumeric and was previously numeric.

I have no proof of that. The problem script in question dates from 2007. See

  http://nagios.manubulon.com/check_snmp_storage.pl

Going back to 4.0.0 of Net-SNMP, they used v4.0.0 - so I don't know why this was not caught earlier.
Comment 2 Dan Langille freebsd_committer freebsd_triage 2023-01-11 18:56:30 UTC
This is the scope of the problem:

 grep -r 'Net::SNMP->VERSION' *
work/plugins/check_snmp_css_main.pl:my $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:my $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:	$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:	$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:  $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_env.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_env.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_env.pl:my $result_ps = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_mem.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_mem.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_mem.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_win.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_win.pl:$result = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_boostedge.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_boostedge.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_nsbox.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_nsbox.pl:$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_process.pl:  $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_process.pl:  $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_process.pl:    $resultat_param = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_process.pl:  $getall_run = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_process.pl:  $getall_cpu = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_process.pl:  $getall_mem = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_process.pl:      $tmp_result = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_process.pl:    $result = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_storage.pl:  if (Net::SNMP->VERSION < 4) {
work/plugins/check_snmp_storage.pl:  if (Net::SNMP->VERSION < 4) {
work/plugins/check_snmp_storage.pl:  if (Net::SNMP->VERSION < 4) {
work/plugins/check_snmp_storage.pl:if (Net::SNMP->VERSION < 4) {
work/plugins/install.sh:    SNMPVER=`$PERLHOME -e 'require Net::SNMP;print Net::SNMP->VERSION'`
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_load.pl:my $resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_load.pl:my $resultat =  (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_linkproof_nhr.pl:my $resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_linkproof_nhr.pl:if (Net::SNMP->VERSION < 4) {
work/plugins/check_snmp_css.pl:	$resultat = (Net::SNMP->VERSION < 4) ? 
work/plugins/check_snmp_css.pl:$resultat = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_css.pl:$resultat2 = (Net::SNMP->VERSION < 4) ?
work/plugins/check_snmp_vrrp.pl:if (Net::SNMP->VERSION < 4) {
work/plugins/check_snmp_vrrp.pl:if (Net::SNMP->VERSION < 4) {
Comment 3 Dan Langille freebsd_committer freebsd_triage 2023-01-11 19:22:01 UTC
Created attachment 239410 [details]
Allow for non-numeric versions

Tested here, works.
Comment 4 Dan Langille freebsd_committer freebsd_triage 2023-01-11 21:19:59 UTC
I sent an email upstream.
Comment 5 Dan Langille freebsd_committer freebsd_triage 2023-04-25 20:53:42 UTC
joneum: How do you feel about this patch?
Comment 6 Dan Langille freebsd_committer freebsd_triage 2023-08-02 14:51:37 UTC
Today maintainer timeout occurs.
Comment 7 Dan Langille freebsd_committer freebsd_triage 2023-10-17 19:49:18 UTC
Proceeding.
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-10-17 20:08:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4f8ce8f7eca6e0d4c9dad32b34e4b73965457e44

commit 4f8ce8f7eca6e0d4c9dad32b34e4b73965457e44
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-10-17 20:04:02 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-10-17 20:07:51 +0000

    net-mgmt/nagios-snmp-plugins-extras: use lt not <

    The problem is caused by a change in format for Net::SNMP->VERSION - it
    is now alphanumeric and was previously numeric.

    PR:             268891
    Approved by:    maintainer timeout (12 weeks)

 net-mgmt/nagios-snmp-plugins-extras/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)