Perl

在模組 SNMPv2-SMI 中未找到“zeroDotZero”

  • October 19, 2012

我有一個 perl 腳本,它可以搜尋我們的交換機以查找哪個主機擁有給定的 IP 地址;該腳本使用net-snmp庫來輪詢乙太網交換機的菊花鏈(想想核心/分發/訪問),直到找到連接主機的正確交換機。

這個腳本在我們的大多數 linux 機器上都可以正常工作,但我有一個會拋出 STDERR 消息,抱怨缺少 ‘zeroDotZero’SNMPv2-SMI

[mpenning@lnxlmf ietf]$ perl ~/findhost2.pl 192.0.2.30
192.0.2.30, 192.0.2.30, No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
0:1e:b:26:78:d9, No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
No log handling enabled - turning on stderr logging
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/IP-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/cisco/EVENT-MIB.my)
Did not find 'zeroDotZero' in module SNMPv2-SMI (/usr/share/snmp/mibs/DISMAN-SCHEDULE-MIB.txt)
192.0.2.254, Gi5/44

[mpenning@lnxlmf ietf]$

如何停止錯誤消息?

的預設net-snmp副本SNMPv2-SMI具有 zeroDotZero 的定義…

[mpenning@lnxlmf ietf]$ cd /usr/share/snmp/mibs/
[mpenning@lnxlmf mibs]$ grep zeroDotZero SNMPv2-SMI.txt
zeroDotZero    OBJECT-IDENTITY
[mpenning@lnxlmf mibs]$

事實證明,我已經SNMPv2-SMI.my在我的 Cisco MIBs 目錄中安裝了一個舊副本……這個副本SNMPv2-SMI.my沒有 zeroDotZero 並且覆蓋了net-snmp的副本,所以我刪除了它。

[mpenning@lnxlmf mibs]$ cd /usr/share/snmp/mibs/cisco/
[mpenning@lnxlmf cisco]$ grep zeroDotZero SNMPv2-SMI.my
[mpenning@lnxlmf cisco]$ sudo rm SNMPv2-SMI.my

現在腳本執行沒有問題……

[mpenning@lnxlmf ~]$ perl findhost2.pl 192.0.2.29
192.0.2.29, 192.0.2.29, 0:27:e:22:9a:d5, core-switch2, 7/37

[mpenning@lnxlmf ~]$

引用自:https://serverfault.com/questions/440319