
我們有一台 Cisco 交換機,多年來一直使用 Nagios 透過 snmpv2 進行監控。最近,我們的審核團隊迫使我們在所有網路設備上遷移到 snmpv3。
Cisco 工程師進來並在交換器上設定了 snmpv3,但此後 snmpwalk 停止工作:
當我嘗試 snmpwalk 時出現以下錯誤:
[root@nagios libexec]# snmpwalk -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3
SNMPv2-SMI::mib-2 = No more variables left in this MIB View (It is past the end of the MIB tree)
上面的憑證是正確的,因為當它們錯誤時會引發以下錯誤:
[root@nagios libexec]# snmpwalk -u snmprouser -A gs11snmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3
snmpwalk: Authentication failure (incorrect password, community or key)
當我嘗試獲得正常運行時間時:
[root@nagios libexec]# snmpwalk -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3 1.3.6.1.2.1.1.3.0
DISMAN-EVENT-MIB::sysUpTimeInstance = No more variables left in this MIB View (It is past the end of the MIB tree)
也:
[root@nagios ~]# snmpwalk -v3 -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 mib-2.interfaces
IF-MIB::interfaces = No more variables left in this MIB View (It is past the end of the MIB tree)
答案1
我使用 Linux 和 Ruby 編寫的一些程式碼:
def snmp_cmd(cmd)
`#{cmd} -Oq -v3 -u #{@user} -l authpriv -a MD5 \
-A #{@auth} -x DES -X #{@priv} #{@name} #{@oid}`
end
在 oid 為「1」的 Linux 主機上執行它會產生整個 mib。不知道為什麼要這樣做,因為需要很長時間才能完成。您的問題可能是“以思科為中心”,因為此程式碼片段也適用於 HP 交換器和 Windows 主機(不是 oid=1 部分)。
您可能希望將查詢範圍縮小到特定項目。
答案2
看來問題確實出在交換器上的 SNMP 設定上。另一位思科工程師進來幫我們解決了這個問題。我「僅僅」浪費了兩週的時間,認為這是 Linux 方面的問題。 :(