SNMP defines neither package nor VERSION

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ab3pu
Posts: 54
Joined: Fri Sep 30, 2016 1:51 pm

SNMP defines neither package nor VERSION

Post by ab3pu »

I am trying to migrate from Core 4 to Nagios XI after migrating from Nagios 3.

The original system has been installed for quite a while, and it uses some plugins that I am migrating over. In particular (but not limited to) the plugin check_snmp_apc_pdu.pl when run gives me an error:

SNMP defines neither package nor VERSION--version check failed at /usr/local/nagios/libexec/check_snmp_apc_pdu.pl line 7.
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/check_snmp_apc_pdu.pl line 7.


The beginning of that plugin is shown here:

Code: Select all

#!/usr/bin/perl

use strict;
require 5.6.0;
use lib qw( /opt/nagios/libexec );
use utils qw(%ERRORS $TIMEOUT &print_revision &support &usage);
use SNMP 5.0;
use Getopt::Long;
use vars qw( $exit $message $opt_host $opt_help $opt_community $opt_phases $opt_phase_1 $opt_phase_3 $opt_status_A $opt_status_B $opt_status_C $opt_return_ok $opt_return_warn $opt_return_crit $PROGNAME $TIMEOUT );

$PROGNAME      = "check_snmp_liebert_alarms.pl";
$opt_host      = undef;
$opt_community = 'public';
$message       = undef;
$exit          = 'UNKNOWN';
$opt_return_ok = 'phaseLoadNormal';
$opt_return_warn = 'phaseLoadNearOverload';
$opt_return_crit = 'phaseLoadOverload';
$opt_phases    = undef;
$opt_phase_1   = 'INTEGER: 1';
$opt_phase_3   = 'INTEGER: 3';
$opt_status_A  = undef;
I am new to perl and still wet behind the ears with Linux.

Can anyone explain why I am getting this error, and more importantly how to fix it?

Thanks in Advance
Last edited by tmcdonald on Wed Oct 19, 2016 2:13 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around code output
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: SNMP defines neither package nor VERSION

Post by mcapra »

You'll likely need to make sure the SNMP package is installed:

Code: Select all

cpan -i SNMP
It's hard to say exactly where modifications should be made without seeing the full script, but I would start with some of the includes (specifically lines 4 and 7):

Code: Select all

#!/usr/bin/perl

use strict;
# require 5.6.0; # -- removed
use lib qw( /opt/nagios/libexec );
use utils qw(%ERRORS $TIMEOUT &print_revision &support &usage);
use SNMP; # -- removed version number
use Getopt::Long;
use vars qw( $exit $message $opt_host $opt_help $opt_community $opt_phases $opt_phase_1 $opt_phase_3 $opt_status_A $opt_status_B $opt_status_C $opt_return_ok $opt_return_warn $opt_return_crit $PROGNAME $TIMEOUT );

$PROGNAME      = "check_snmp_liebert_alarms.pl";
$opt_host      = undef;
$opt_community = 'public';
$message       = undef;
$exit          = 'UNKNOWN';
$opt_return_ok = 'phaseLoadNormal';
$opt_return_warn = 'phaseLoadNearOverload';
$opt_return_crit = 'phaseLoadOverload';
$opt_phases    = undef;
$opt_phase_1   = 'INTEGER: 1';
$opt_phase_3   = 'INTEGER: 3';
$opt_status_A  = undef;
Without knowing exactly what parts of the previous SNMP package were being used, it's hard to say what the best course of action is.
Former Nagios employee
https://www.mcapra.com/
ab3pu
Posts: 54
Joined: Fri Sep 30, 2016 1:51 pm

Re: SNMP defines neither package nor VERSION

Post by ab3pu »

I commented out line 7 on all the files presenting the problem. It seems to have corrected the situation. Thanks for the assist.

Be Well
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: SNMP defines neither package nor VERSION

Post by avandemore »

Sounds good. You may wish to update that plugin, but yes that defined version of SNMP is quite outdated. Is it okay to close this thread?
Previous Nagios employee
Locked