Page 1 of 1

check_snmp_int.pl Return code 127

Posted: Thu Feb 13, 2014 3:35 am
by bbzz
Hello everyone,

I am trying to run mentioned plugin like this:

Code: Select all

# 'check_snmp' command definition
define command{
        command_name    check_snmp_int
        command_line    $USER1$/check_snmp_int -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -r -2
        }
and in router.cfg

Code: Select all

 check_command check_snmp_int!XXXXXXXX!'TenGigabitEthernet2/0/0'
All I want to do is get is interface status info, UP or DOWN (is there a better script that does just that?).

I get:
Warning: Return code of 127 for check of service 'Te2/0/0 Link Status' on host 'XXXXXXX' was out of bounds. Make sure the plugin you're trying to run actually exists.

Nagios is running on FreeBSD, I'm not sure if it matters.
I tried adding /usr/bin/perl in front of $USER1$ in resources.cfg, but to no avail.

When i run from shell like this, then it works:

Code: Select all

/usr/local/libexec/nagios/check_snmp_int.pl -H xxx.xxx.xxx.xxx -C xxxxxxxx -n "TenGigabitEthernet2/0/0" -r
TenGigabitEthernet2/0/0:UP:1 UP: OK

Re: check_snmp_int.pl Return code 127

Posted: Thu Feb 13, 2014 10:52 am
by abrist
You need to add .pl to the end of your command:
# 'check_snmp' command definition
define command{
command_name check_snmp_int
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -r -2
}

Re: check_snmp_int.pl Return code 127

Posted: Thu Feb 13, 2014 12:51 pm
by bbzz
Thank you. I can't believe I missed that. :oops:

Just one more question if you please.

Since I'm polling several interfaces, each by itself, for every interface, script polls router for name of interface, even though if would be enough to poll for names once each turn. Any chance this can be optimized? Or perhaps there is a simpler script that check just on interface state?

Kind Regards

Re: check_snmp_int.pl Return code 127

Posted: Thu Feb 13, 2014 1:08 pm
by abrist
You may be able to specify multiple interfaces in one check:
From the man page:

Check that all eth interface are administratively up

Code: Select all

./check_snmp_int.pl -H 127.0.0.1 -C public -n eth -a
Check that FastEternet0/11 to 0/14 are up (Cisco)

Code: Select all

./check_snmp_int.pl -H 127.0.0.1 -C public -n "Fast.*0.1[1234]"

Re: check_snmp_int.pl Return code 127

Posted: Fri Feb 14, 2014 4:55 am
by bbzz
But it seems even with that option, script check for interface description for each interface.

The problem is if you have lots of subinterfaces, when you poll for TenGigE0/0/0/1 and TenGigE0/0/0/2, for each interface it gets list of ALL interfaces, including subinterfaces, which makes NAGIOS report lots of UNKNOWN STATE messages.

Is there a way to optimize this?

Is there a way to specify ifIndex OID directly of interface, rather than poll for interface name? Maybe a differen script

Thanks again

Re: check_snmp_int.pl Return code 127

Posted: Fri Feb 14, 2014 6:29 am
by bbzz
I think high CPU is from fact that it's .pl not .c

Can't seem to find check_snmp_int.c for FreeBSD.

Re: check_snmp_int.pl Return code 127

Posted: Fri Feb 14, 2014 11:28 am
by abrist
bbzz wrote:Is there a way to optimize this?
Not really with this plugin. Most people create separate checks for each interface so they can be disabled/enabled at will - additionally, separate checks will not run into issues with rrds and datasources.
bbzz wrote:Can't seem to find check_snmp_int.c for FreeBSD.
Well, this check is a perl script. I have no idea if a c version even exists, regardless of platform.

Re: check_snmp_int.pl Return code 127

Posted: Sat Feb 15, 2014 7:55 am
by bbzz
Thanks.

Well, I ended up installing this on OpenBSD platform; it comes with check_snmp.c which directly polls for specific oid thereby reducing snmp traffic and load on router.

However, the load is still significant on host CPU. I followed recommendation for large installation tunning, but I think CPU spikes have to do mostly with snmpget requests for ifOperStatus oids. I'm not sure how to optimize this, and I don't think it has to do with Nagios itself.

Any other comment on this are welcomed. By the way I run this on SunFirev440 Sparc64 host.

Thanks again && Kind Regards

Re: check_snmp_int.pl Return code 127

Posted: Mon Feb 17, 2014 11:16 am
by slansing
Yes these checks can be quite intensive due to their nature, what kind of hardware are you running on the Nagios server? How often are you running these active SNMP checks, and how many of them are there?