define service{
use generic-service
host_name router
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifAdminStatus.1 -r 1
}
Are you sure you’re using the right command within Nagios?
Because there are no -t or -m switches in command definition I’ve posted… Have you reloaded Nagios configuration after those changes in .cfg files? Are all of your .cfg files (includin those of nagios-plugins) specified correctly within nagios.cfg file?
switches -t -m insert check_snmp when executing i think
i’m trying to use it w/o nagios from console
and get @localhost plugins]# ./check_snmp -H xx.xx.xx.xx -C public -o ifAdminStatus.1
SNMP problem - No data received from host
CMD: /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] xx.xx.xx.xx:161 ifAdminStatus.1
:shock:
Ok, think I’ve got it. You shouldn’t use symbolic names after the -o switch. It should be numeric OID, and also you have to specify the protocol. Try to run this from the terminal:
Then define check_snmp command in /etc/nagios-plugins/config/my_snmp.cfg like this (Create a new my_snmp.cfg file within directory. Set the right permissions on it, make ti as all other files within directory are set. It is advisable for you to create your own files when defining your own commands and host/service definition because when you will be upgrading Nagios or Nagios-plugins package it could overwrite it’s original files.):
# 'check_snmp_my' command definition
define command{
command_name check_snmp
command_line /usr/lib/nagios/plugins/check_snmp -H '$HOSTADDRESS$' -C '$ARG1$' -P '$ARG2$' -o '$ARG3$'
}
Be sure you have specified the right path to your check_snmp plugin executable file.
(I assumed you have defined the whole plugins configuration directory as cfg_dir in nagios.cfg file, so this newly created file, my_snmp.cfg, would be read by Nagios when reloading.)
And your cehck_command variable within service definition would be:
Have you tried to reinstall your nagios-plugins package. Maybe it is not compiled well…
Try to reinstall it, or make your own shell script with snmpget query for a quick solution.