smford22 has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have a custom check_snmp check that I use for Nagios that works great when called via the command line, but when used with the embedded perl interpreter in Nagios I am getting an error showing that the "Service check did not exit properly."

I turned on debugging on the embedded perl for Nagios and found that the embedded Perl interpreter cannot find Net::SNMP in @INC. However, I have verified that it is indeed in my path, and it is the latest version...

ERROR:
Wed Mar 14 17:36:59 2012 eval_file: syntax error in /usr/local/nagios/libexec/check_snmp.pl: "Can't locate Net/SNMP.pm in @INC (@INC contains:
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 2) line 9, BEGIN failed--compilation aborted at (eval 2) line 16.".

NET::SNMP in my @INC...
root@server Net# pwd
/usr/lib/perl5/site_perl/5.8.8/Net
root@venda Net# ls
SNMP SNMP.pm

CONFIRMING LATEST VERSION OF NET::SNMP for Perl
root@server Net-SNMP-v6.0.1# yum install net-snmp-perl.x86_64 Loaded plugins: product-id, security, subscription-manager Updating Red Hat repositories.
Setting up Install Process
Package 1:net-snmp-perl-5.3.2.2-14.el5_7.1.x86_64 already installed and latest version
Nothing to do

CHECK RUNNING VIA COMMAND LINE
root@server ~# /usr/local/nagios/libexec/check_snmp.pl -H <IPADDRESS> -C -w 90 -c 95
OK 1% load

Does anyone have any experience with this?

Replies are listed 'Best First'.
Re: Help with Embedded Perl - Nagios
by Eliya (Vicar) on Mar 15, 2012 at 19:03 UTC

    Under what user account does your nagios run?  I'm asking because it might be a permission problem (directory not searchable for nagios user, or similar).  Just a guess, though.