ITPub博客

首页 > Linux操作系统 > Linux操作系统 > netsnmp 安装与配置 (zt)

netsnmp 安装与配置 (zt)

原创 Linux操作系统 作者:tonykorn97 时间:2007-07-08 00:00:00 0 删除 编辑

net-snmp installation and configuration
Recently I spent much time to learn SNMP to try to setup a snmp server for the developers. The following is the steps of installation and configuration of net-snmp, a popular and open source snmp server and agent .

http://www.myfaq.com.cn/2005September/2005-09-13/208338.html


DOWNLOAD AND INSTALL

1.download the source.
http://sourceforge.net/projects/net-snmp
or the official web: http://www.net-snmp.org/

2.Extract the packet.
tar -zxvf net-snmp-5.4.tar.gz

3.Compile the packet.
cd net-snmp-5.4
./configure (for example ./configure --with-mib-modules="agentx")
make
make test
make install

4.Copy the example configure file
cp EXAMPLE.conf /usr/local/share/snmp/snmpd.conf

5.Modify the configure file as following
Change the COMMUNITY to democommunity which is a community string

6.check the process of snmpd and kill it and then run it
ps -A | grep snmp kill xxxx snmpd -d -L

7.have a try.
snmpget -v 1 -c democommunity localhost system.sysUpTime.0

INSTALL A MIB

1. A mibs file like JM-TEST-1-MIB.txt. the following is the content.


JM-TEST-1-MIB DEFINITIONS ::= BEGINIMPORTS MODULE-IDENTITY, OBJECT-TYPE, INTEGER FROM SNMPv2-SMI;jmtest MODULE-IDENTITY LAST-UPDATED "200203210000Z" ORGANIZATION "Temple U" CONTACT-INFO "None yet." DESCRIPTION "AgentX testing MIB" REVISION "200203210000Z" DESCRIPTION "None yet." ::= { experimental 72}firstKey OBJECT-TYPE SYNTAX INTEGER (0..100) MAX-ACCESS read-write STATUS current DESCRIPTION "Value initialized to 0 and on each access: - Return current val. - increment" ::= { jmtest 1 }END
2.Copy the mib file to the correct locations
cp JM-TEST-1-MIB.txt /usr/local/share/snmp/mibs

3.Let the snmp tools to recognize the mibs
echo "mibs +JM-TEST-1-MIB" >> /usr/local/share/snmp/snmp.conf

4.Use the snmptranslate to verify if the mib is loaded.
snmptranslate -IR -Tp experimental
and should get the following show:

Unlinked OID in JM-TEST-1-MIB: jmtest ::= { experimental 72 }
+--experimental(3)
|
+--jmtest(72)
+-- -RW- INTEGER firstKey(1)
Range: 0..100

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/312079/viewspace-245715/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-05

  • 博文量
    1854
  • 访问量
    2088382