check_snmp problem

hi all
when i trying to get information from host

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

if i enter this in console
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] xx.xx.xx.xx:161 ifAdminStatus.1
have

@localhost libexec]# /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] xx.xx.xx.xx:161 ifAdminStatus.1
No community name specified.

command like
@localhost libexec]# /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c public xx.xx.xx.xx:161 ifAdminStatus.1
works just fine

why check_snmp insert [authpriv] instead of real community and how can i solve this?
thanks

nagios-3.0.6
nagios-plugins-1.4.13
NET-SNMP version: 5.4.2

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
}

‘check_snmp’ command definition

define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}

Try to do it this way:

[code]define service{
use generic-service
host_name router
service_description Port 1 Link Status
check_command check_snmp!public!ifAdminStatus.1!1
}

‘check_snmp’ command definition

define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -r $ARG3$
}[/code]

nothing changes (
CMD: /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] xx.xx.xx.xx:161 ifAdminStatus.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:

with --verbose

[code]@localhost plugins]# ./check_snmp -H xx.xx.xx.xx -C public -o sysUpTime.0 -v -P 2c
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c -c public xx.xx.xx.xx:161 sysUpTime.0
DISMAN-EVENT-MIB::sysUpTimeInstance 4002505

SNMP problem - No data received from host
CMD: /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c [authpriv] xx.xx.xx.xx:161 sysUpTime.0
[/code]

host sends to monitoring machine MIB , but script ‘says’ – SNMP problem - No data received from host –
what’s wrong? :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:

check_command    check_snmp!public!2c!.1.3.6.1.2.1.2.2.1.7.1

in numeric format , just the same problem ((

[code]@localhost ~]# /usr/lib/nagios/plugins/check_snmp -H xx.xx.xx.xx -C public -P 2c -o .1.3.6.1.2.1.1.3.0 -v
/usr/bin/snmpget -t 1 -r 5 -m ‘’ -v 2c -c public xx.xx.xx.xx:161 .1.3.6.1.2.1.1.3.0
iso.3.6.1.2.1.1.3.0 20741023

SNMP problem - No data received from host
CMD: /usr/bin/snmpget -t 1 -r 5 -m ‘’ -v 2c [authpriv] xx.xx.xx.xx:161 .1.3.6.1.2.1.1.3.0[/code]

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.