netsnmp 安装与配置

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 ::= BEGIN

IMPORTS
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

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值