Can't locate Net/SNMP.pm

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Can't locate Net/SNMP.pm

Post by RockerMan »

Hi

I setup script check_snmp_netint.pl.
Start in console from root and nagios - work.

Code: Select all

[root@centos libexec]# ./check_snmp_netint.pl -H 172.**.**.2 -C public -2 -k -M -w5,5 -c8,8 -n "GigabitEthernet0/1"
GigabitEthernet0/1:UP (0.1MBps/0.0MBps):(1 UP): OK |
... from nagios

Code: Select all

[root@centos libexec]# su - nagios
[nagios@centos ~]$ /usr/local/nagios/libexec/check_snmp_netint.pl -H 172.**.**.2 -C public -2 -k -M -w5,5 -c8,8 -n "GigabitEthernet0/1"
GigabitEthernet0/1:UP (0.1MBps/0.1MBps):(1 UP): OK |
Write command in commands.cfg

Code: Select all

define command {
        command_name    check_snmp_netint01
        command_line   /usr/local/nagios/libexec/check_snmp_netint.pl -H 172.**.**.2 -C public -2 -k -M -w5,5 -c8,8 -n "GigabitEthernet0/1"
        }
Write service in switch.cfg

Code: Select all

define service{
        use                     generic-service
        host_name               c1921
        service_description     Ge0/1 Bandwidth
        check_command           check_snmp_netint01
        }
restart nagios service... not work

Code: Select all

Ge0/1 Bandwidth   UNKNOWN	10-03-2018 13:57:50	0d 0h 0m 18s	1/3	Can't locate Net/SNMP.pm
I have already install the library through cPAN:

Code: Select all

[root@centos ~]# cpan
cpan>install Net::SNMP
from user root and from user nagios.

check from these users

Code: Select all

[nagios@centos ~]$ perl -e "use Net::SNMP"
[nagios@centos ~]$
[root@centos ~]# perl -e "use Net::SNMP"
[root@centos ~]#
check that there are packages in the system

Code: Select all

yum provides '*/Net/SNMP.pm'
...
File   : /usr/share/perl5/vendor_perl/Net/SNMP.pm
there is no library in this place, created symlinc from user nagios

Code: Select all

# ln -s /home/nagios/perl5/lib/perl5/Net/SNMP.pm /usr/share/perl5/vendor_perl/Net/SNMP.pm
restart nagios

Code: Select all

#systemctl restart nagios
not work...

Help me please setup this plugin
Thx
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can't locate Net/SNMP.pm

Post by scottwilkerson »

Generally the install would be

Code: Select all

yum install 'perl(Net::SNMP)'
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Can't locate Net/SNMP.pm

Post by RockerMan »

did
working

thx
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Can't locate Net/SNMP.pm

Post by scottwilkerson »

RockerMan wrote:did
working

thx
great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked