check_snmp_load and check_snmp_mem output (null) issue.

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
Digitalmocking
Posts: 4
Joined: Thu Nov 08, 2012 3:58 pm

check_snmp_load and check_snmp_mem output (null) issue.

Post 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.
Digitalmocking
Posts: 4
Joined: Thu Nov 08, 2012 3:58 pm

Re: check_snmp_load and check_snmp_mem output (null) issue.

Post 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.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: check_snmp_load and check_snmp_mem output (null) issue.

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_snmp_load and check_snmp_mem output (null) issue.

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Digitalmocking
Posts: 4
Joined: Thu Nov 08, 2012 3:58 pm

Re: check_snmp_load and check_snmp_mem output (null) issue.

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_snmp_load and check_snmp_mem output (null) issue.

Post by slansing »

Strange, thank you for letting us know what your resolution was!
Locked