Page 1 of 1

Can't locate Net/SNMP.pm

Posted: Wed Oct 03, 2018 6:35 am
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

Re: Can't locate Net/SNMP.pm

Posted: Wed Oct 03, 2018 10:17 am
by scottwilkerson
Generally the install would be

Code: Select all

yum install 'perl(Net::SNMP)'

Re: Can't locate Net/SNMP.pm

Posted: Thu Oct 04, 2018 5:07 am
by RockerMan
did
working

thx

Re: Can't locate Net/SNMP.pm

Posted: Thu Oct 04, 2018 7:09 am
by scottwilkerson
RockerMan wrote:did
working

thx
great!

Locking thread