1. 程式人生 > >net-snmp常見的兩個錯誤及解決辦法

net-snmp常見的兩個錯誤及解決辦法

第一個:

Warning: noaccess control information configured.

  It's unlikely this agent can serve any usefulpurpose in this state.

  Run "snmpconf -g basic_setup" tohelp you configure the snmpd.conf file for this agent.

   這個錯誤是找不到配置檔案,解決辦法有兩個:

   1、  在該放配置檔案的目錄下沒有放配置檔案,配置目錄在net-snmp-config.h中

        #define SNMPLIBPATH "/usr/lib"

#define SNMPSHAREPATH "/usr/share/snmp"

#define SNMPCONFPATH "/usr/etc/snmp"

#define SNMPDLMODPATH "/usr/lib/snmp/dlmod"

        檢視這幾個目錄下是否有snmpd.conf檔案,如果沒有就加上;

   2、差不多,就是目錄問題,將配置檔案的目錄改變,然後讓其能找到配置檔案,也是上述位置的幾個巨集

比如我改成下面這個樣子:

#define SNMPLIBPATH "/lib"

#define SNMPSHAREPATH "/tmp"

#define SNMPCONFPATH "/tmp"

#define SNMPDLMODPATH "/tmp/dlmod"

第二個:

找不到相應模組出現如下錯誤提示:

Cannot findmodule (IP-MIB): At line 0 in (none)

Cannot findmodule (IF-MIB): At line 0 in (none)

Cannot findmodule (TCP-MIB): At line 0 in (none)

Cannot findmodule (UDP-MIB): At line 0 in (none)

Cannot findmodule (HOST-RESOURCES-MIB): At line 0 in (none)

Cannot findmodule (SNMPv2-MIB): At line 0 in (none)

Cannot findmodule (SNMPv2-SMI): At line 0 in (none)

Cannot findmodule (NOTIFICATION-LOG-MIB): At line 0 in (none)

Cannot findmodule (UCD-SNMP-MIB): At line 0 in (none)

Cannot findmodule (UCD-DEMO-MIB): At line 0 in (none)

Cannot findmodule (SNMP-TARGET-MIB): At line 0 in (none)

Cannot findmodule (NET-SNMP-AGENT-MIB): At line 0 in (none)

Cannot findmodule (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)

Cannot findmodule (SNMP-COMMUNITY-MIB): At line 0 in (none)

Cannot findmodule (NET-SNMP-PASS-MIB): At line 0 in (none)

Cannot findmodule (NET-SNMP-EXTEND-MIB): At line 0 in (none)

Cannot findmodule (UCD-DLMOD-MIB): At line 0 in (none)

Cannot findmodule (SNMP-FRAMEWORK-MIB): At line 0 in (none)

Cannot findmodule (SNMP-MPD-MIB): At line 0 in (none)

Cannot findmodule (SNMP-USER-BASED-SM-MIB): At line 0 in (none)

Cannot findmodule (SNMP-NOTIFICATION-MIB): At line 0 in (none)

Cannot findmodule (SNMPv2-TM): At line 0 in (none)


這裡也有兩種情況:

一個是設定好系統環境變數,這個網上都有;

第二個也是net-snmp-config.h的配置檔案中的問題:


#define DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/share/snmp/mibs:/tmp/snmp/mibs"

如果不願意設定環境變數,那麼就修改這裡,然後編譯,再呼叫靜態庫編譯新的agent就可以了,當然,如果不是移植,那更簡單,只要修改這裡就可以了

NOTE

新編譯的agent是否更換了靜態庫,上述幾個修改的地方是與庫有關;agent端修改net-snmp-config.h檔案無效;


by stephen 2013#07#18