check_snmp_int.pl Return code 127

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
bbzz
Posts: 10
Joined: Thu Feb 13, 2014 3:24 am

check_snmp_int.pl Return code 127

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

Re: check_snmp_int.pl Return code 127

Post 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
}
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.
bbzz
Posts: 10
Joined: Thu Feb 13, 2014 3:24 am

Re: check_snmp_int.pl Return code 127

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

Re: check_snmp_int.pl Return code 127

Post 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]"
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.
bbzz
Posts: 10
Joined: Thu Feb 13, 2014 3:24 am

Re: check_snmp_int.pl Return code 127

Post 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
bbzz
Posts: 10
Joined: Thu Feb 13, 2014 3:24 am

Re: check_snmp_int.pl Return code 127

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

Re: check_snmp_int.pl Return code 127

Post 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.
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.
bbzz
Posts: 10
Joined: Thu Feb 13, 2014 3:24 am

Re: check_snmp_int.pl Return code 127

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

Re: check_snmp_int.pl Return code 127

Post 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?
Locked