我在使用check_snmp插件连接并返回值时遇到问题。我正在运行CentOS7,Nagios 4.0.8,check_snmp 2.0.3。虽然可以从命令行snmpget和snmpwalk,但check_snmp失败。以下是一些例子......
SNMPGET:
# snmpget -v 3 -u myuser -x aes -X mypasswd -a md5 -A mypasswd -c Public -l AuthPriv 111.222.333.111 sysUpTime.0
...返回...
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (10475998) 1 day, 5:05:59.98
snmpwalk的:
# snmpwalk -v 3 -u myuser -x aes -X mypasswd -a md5 -A mypasswd -c Public -l AuthPriv 111.222.333.111 sysUptime
...返回...
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (10473493) 1 day, 5:06:10.93
check_snmp:
/usr/lib64/nagios/plugins/check_snmp -H 111.222.333.111 -o sysUpTime.0 -P 3 -l AuthPriv -U myuser -A mypasswd -a md5 -X mypasswd -x aes
...返回...
External command error: Error in packet
Reason: authorizationError (access denied to that object)
Failed object: DISMAN-EVENT-MIB::sysUpTimeInstance
当我运行带有详细信息的check_snmp时,我得到......
/usr/bin/snmpget -Le -t 1 -r 5 -m ALL -v 3 [authpriv] 156.128.2.250:161 sysUpTime.0
check_snmp显然没有使用传递给它的args构造snmpget命令。我为什么不知所措。
答案 0 :(得分:1)
check_snmp sec级别的语法略有不同。尝试:
-L authPriv
而不是:
-l AuthPriv
您可以通过使用-h:
调用插件的帮助来确认这一点./check_snmp -h
check_snmp v2.0.3 (nagios-plugins 2.0.3)
...
-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]
...