check_snmp works from CLI but not in the web page


Hi all,

I am trying to monitor Cisco router 5 minutes CPU usage via check_snmp plugin.

I have this in commands.cfg

# 'check_snmp_cpu' command definition define command{ command_name check_snmp_cpu command_line $USER1$/check_snmp -H $HOSTADDRESS$ -o -w 80 -c 90 -l CPU -u% -d iso. -C $ARG1$

running as user nagios

uid=181(nagios) gid=181(nagios) groups=181(nagios)
%/usr/local/nagios/libexec/check_snmp -H my-router -o -w 80 -c 90 -l CPU -u% -d iso. -C community
CPU OK - 30 % | =30

running without the other flags

%/usr/local/nagios/libexec/check_snmp -H my-router -o -w 80 -c 90 -C community
SNMP OK - 30 | iso.

running with the -v flag

%/usr/local/nagios/libexec/check_snmp -H my-router -o -w 80 -c 90 -C community -v
/usr/local/bin/snmpget -t 1 -r 5 -m ‘’ -v 1 [authpriv] my-router:161
iso. = INTEGER: 30
SNMP OK - 30 | iso.

But in the nagios web site the status is always CRITICAL and the STATUS INFORMATION is (Return code of 127 is out of bounds - plugin may be missing). What does this mean? In the hosts.cfg file i have this

define service{ use generic-service host_name my-router service_description CPU 5min check_period 24x7 max_check_attempts 4 normal_check_interval 5 retry_check_interval 1 contact_groups nagadmin servicegroups CPU-USAGE notification_interval 60 check_command check_snmp_cpu!community

i can’t figure out what is wrong. Net-SNMP is installed. I am using FreeBSD. can somebody pls help?



not sure if that solves. but i’d try removing the -u% from the check_snmp_cpu command. That % might need some escaping.

If that fails:

put the command line command in a bash script. pipe the output to a txt fil ein /tmp.
run by crontab and check the output.

Might be some user context variable which isn’t correctly set when you are not logged in :slight_smile:


changed the command to

command_line $USER1$/check_snmp -H $HOSTADDRESS$ -o -w 80 -c 90 -C $ARG1$

with same result.

now trying wit the script. will keep you posted


my script

%cat check_router_cpu

check router cpu via cron

/usr/local/nagios/libexec/check_snmp -H my-router -o -w 80 -c 90 -C community >> /tmp/routercpu.txt

my cron

%crontab -l
*/5 * * * * /usr/home/nagios/check_router_cpu

my output

%cat /tmp/routercpu.txt
SNMP OK - 20 | iso.
SNMP OK - 19 | iso.


ls -la check_snmp ?

you did reload after modifying your cfg files?


forgot to reload
reloaded now

%ls -la /usr/local/nagios/libexec/check_snmp
-rwxr-xr-x 1 nagios nagios 227278 Aug 12 2010 /usr/local/nagios/libexec/check_snmp
%ls -la check_router_cpu
-rwxr-xr-x 1 nagios nagios 161 Mar 14 17:39 check_router_cpu


still no changes in output after reload


not sure if it has anything to do but my check_snmp is way smaller 167K only… and you are porbably not running the latest version with those dates.

Is there anything in the nagios log maybe? curious as the 127 is usually related to missing plugins… no problems on other plugins?


my nagios version is 3.2.1
i’ll try updating to the latest and see .


working now…

checked the resource.cfg and found that the path was incorrect.

Sets $USER1$ to be the path to the plugins


there were actually two folders containing the plugins… /usr/local/nagios/libexec and /usr/local/libexec/nagios…
the /usr/local/libexec/nagios has all the files except the check_snmp file…
no wonder i could run it manually because i was defining the other path and nagios never found this file…
just copied the file to this folder and now the web is showing the output correctly …
god knows how come its got two folders. probably while setting up initially some mistakes

Thanks for your help.



was this an RPM install?