SNMPv3 操作手冊

 

使用net-snmp

協議SNMPv3

1,創建一個用戶(create a new snmpv3 user and give them rights to do things):

net-snmp-config --create-snmpv3-user -a "my_password" myuser

WARNING: SNMPv3 pass phrases must be at least 8 characters long!

my_password 使用(MD5和DES算法加密保護),Note that encryption support isn't enabled in the binary releases downloadable from the net-snmp web site.

測試:

Start the agent and test your setup:
    /usr/local/sbin/snmpd
[...wait a few seconds... It will run in the background and return you to your shell immediately.]

    snmpget -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0
[ this should return information about how long your agent has been up]

    snmpget -v 3 -u myuser -l authPriv -a MD5 -A my_password -x DES -X my_password localhost sysUpTime.0
[ this should return similar information, but encrypts the transmission ]

使用snmptrapd程序:

1)and the securityName and engineID must exist as a pair in the remote user table.

Stop any currently running snmptrapd
edit /var/net-snmp/snmptrapd.conf to insert the following line:
  createUser myuser MD5 mypassword DES myotherpassword
Where myuser is the security name you want to use, and mypassword is your authentication password and myotherpassword is your encryption password (or leave it blank if you want it to be the same or don't want to use encryption).
(re)start the snmptrapd program.

測試:

snmpinform -v 3 -u myuser -a MD5 -A mypassword -l authNoPriv localhost 42 coldStart.0

其中myuser必須是在localhost上的用戶。

如何自定義trap類型?

主機A上安裝有設備,由snmp管理;主機B上負責接受主機A上傳遞過來的trap(在後臺運行snmptrapd程序)

目的:自定義trap類型

1)在主機A上做mib庫的擴展,添加自定義的trap類型,然後編譯進snmpd。

那麼,是否需要在主機B上做類似的擴展?如果不需要,那麼主機B上如何識別主機A上自定義的trap類型。

Writing a net-snmp MIB Module

一, Compiling in your new MIB module

1, Compile it into the master agent.

% ./configure --with-mib-modules="nstAgentModuleObject"

    To do this, you would put the nstAgentModuleObject.h and nstAgentModuleObject.c files into the net-snmp source code directory. You do this by copying them into a agent/mibgroup/nstAgentModuleObject.h and agent/mibgroup/nstAgentModuleObject.c file.

2, % make

3, % make install

4, % /usr/local/sbin/snmpd

5,測試

snmpget -u louis -a MD5 -A wohaolouis -l authNoPriv localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0

發佈了23 篇原創文章 · 獲贊 2 · 訪問量 16萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章