Page 1 of 1

check_snmp_load and check_snmp_mem output (null) issue.

Posted: Fri Feb 08, 2013 2:57 pm
by Digitalmocking
So I have an odd issue.

I'm getting the following trying to check an SNMP enabled firewall:

Code: Select all

[1360352407.069695] [016.1] [pid=23937] HOST: clk_astaro, SERVICE: Firewall Load , CHECK TYPE: Active, OPTIONS: 0, SCHEDULED: Yes, RESCHEDULE: Yes, EXITED OK: Yes, RETURN CODE: 2, OUTPUT: (null)
If I run the command by hand, it works fine:

Code: Select all

nagios@monitor:/usr/local/nagios#  /usr/local/nagios/libexec/check_snmp_load.pl -H 192.168.0.2 -C public -T stand -w 25 -c 90
2 CPU, average load 5.0% < 25% : OK
Here's the command:

Code: Select all

define command{
  command_name check_snmp_load_v1
  command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}
And the service definition:

Code: Select all

define service{
        use                     generic-service ; Inherit values from a template
        host_name               clk_astaro
        service_description     Firewall Load
        check_command           check_snmp_load_v1!stand!25!90
        }
$USER1$ and $USER7$ are defined in resource.cfg:

Code: Select all

$USER1$=/usr/local/nagios/libexec
$USER7$=-C public
Any ideas? All of the other services work fine, but both check_snmp_mem.pl and check_snmp_load.pl are both doing the same thing.

Re: check_snmp_load and check_snmp_mem output (null) issue.

Posted: Sun Feb 10, 2013 4:54 am
by Digitalmocking
No one has dealt with this at all?

How about some additional steps to debug it, turning on debugging didn't tell me anything, just that it returned (null) which isn't helpful, I know that already.

Re: check_snmp_load and check_snmp_mem output (null) issue.

Posted: Mon Feb 11, 2013 6:10 am
by gshergill
Hi Digitalmocking,

Just downloaded the plugin (from nagiosexchange) and moved it to the plugin folder, created the command and service, and it ran OK.

Followed the exact same configuration as you for commands.cfg and services.cfg (even the same command_name).

All I can recommend is to make sure you have the right plugin version (http://exchange.nagios.org/directory/Pl ... ad/details).

Good luck.

Kind Regards,

Gary Shergill

Re: check_snmp_load and check_snmp_mem output (null) issue.

Posted: Mon Feb 11, 2013 3:03 pm
by abrist
Try moving your $USER7$ macro (community string) into the command itself, or wrap the the whole string with quotes. You really don't need to obfuscate the community string if it is actually set to public, as that is the default community anyways.

Re: check_snmp_load and check_snmp_mem output (null) issue.

Posted: Mon Feb 11, 2013 7:45 pm
by Digitalmocking
I thought I had run the command as the nagios user, but I never had, I only ran it as root to test, where it ran fine. I then verified the user/group ownership was nagios.nagios; However when I tried to run the command as the nagios user I got the following:

Code: Select all

nagios@monitor:~$ /usr/local/nagios/libexec/check_snmp_mem.pl -H 192.168.0.2 -C public -N -w 20,20 -c 90,90
Can't locate Net/SNMP.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/local/nagios/libexec/check_snmp_mem.pl line 16.
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/check_snmp_mem.pl line 16.
So after all that, it turns out the problem was with how the Net::SNMP perl module was installed.

Basically it was only usable by root, and no other users for some reason. I removed the Net::SNMP module that was installed via the Ubuntu apt package and installed it via CPAN so it was properly in /usr/local/share/perl/5.14.2./Net/SNMP.pm and the checks now work.

Thanks for your replies, weird error.

Re: check_snmp_load and check_snmp_mem output (null) issue.

Posted: Tue Feb 12, 2013 12:43 pm
by slansing
Strange, thank you for letting us know what your resolution was!