Triky snmp problem


#1

Hi,
I`m working quite some hours now to get the plug in working witch i downloaded from the nagios exchange page.
I use the plug in check_cisco_envmon.0.4.pl. I shorten the name to check_cisco.pl
I copyed the file to the directory where all the other are located (/usr/local/nagios/libexec/)

change the permissions to
user: nagios
group : nagios
chmod 755

In the check_cisco.pl file i changed the line to the correct path: use lib ‘/usr/local/nagios/libexec/’;

in the commands.cfg i added the following

# 'Check_envmon' command definition
define command{
	command_name	 check_cisco
	command_line	/usr/local/nagios/libexec/check_cisco.pl -H $HOSTADDRESS$ -C private
	}

and of course if added the commando definition to the switch nodes

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       swichname
        service_description             CISCO Chassis Environment Check
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              2
        normal_check_interval           2
        retry_check_interval            1
        contact_groups                  admins
        notification_options            w,u,c,r
        notification_interval           960
        notification_period             24x7
        check_command                   check_cisco
        }

did a verification check and restarted nagios,

after a wile i ended up witch the following error:

Switchname CISCO Chassis Environment Check CRITICAL 06-17-2009 09:17:26 0d 15h 53m 33s 2/2 (null)

if i execute the file in the shell like this : ./check_cisco.pl -H 192.168.2.2 -C private

i got this error:

[root@NEXTGEN libexec]# ./check_cisco.pl -H 192.168.2.2 -C private
Can’t locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec/ /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at ./check_cisco.pl line 74.
BEGIN failed–compilation aborted at ./check_cisco.pl line 74.
[root@NEXTGEN libexec]#

I think thats what the (null) error is coming up.

i hope that someone can help me… it is a very important plug in for me…
thx in advanced


#2

looks like SNMP for Perl is missing…


#3

Hi,
Do you know witch dependency i need to install?

greets
Palermo


#4

looking in google i suppose Net::SNMP
search for “perl snmp”

Luca


#5

Well.
If installed the net-snmp-perl module indeed it was not installed. but still no luck. keep getting the same error.

Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec/ /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl .) at ./check_cisco.pl line 74. BEGIN failed--compilation aborted at ./check_cisco.pl line 74.

This is what the line 74 says

# Setup SNMP object <line 74 --------------->use Net::SNMP qw(INTEGER OCTET_STRING IPADDRESS OBJECT_IDENTIFIER NULL);<--------------- line 74> my ($snmp, $snmperror); if ($snmp_version == 2) { ($snmp, $snmperror) = Net::SNMP->session( -hostname => $hostname, -version => 'snmpv2c', -community => $community

If installed version “net-snmp-perl-5.4.2.1-4.fc10.i386”


#6

well problem solved.

finally after a long search i got it working.
Luca suggested to install Net::snmp
but i could not find is for fedora distro.

[quote=“luca”]looking in google i suppose Net::SNMP
search for "perl snmp"
Luca[/quote]

the problem was that i needed to install Net::snmp in the perl shell.

got an error. could not open the shell for perl.

than i tried yum install perl-CPAN

and now it is possible to enter the shell of perl.

next install snmp module

restart the machine en vola… problem solved.

thx for the little push