compile net-snmp on debian lenny

[不指定 2009/09/23 16:16 | by askwan ]
net-snmp
下载地址:http://ncu.dl.sourceforge.net/project/net-snmp/net-snmp/5.4.2.1/net-snmp-5.4.2.1.tar.gz
解压然后编译,编译参数
./configure --prefix=/usr/local/net-snmp/ --with-sys-contact="askwan@askwan.com" --with-sys-location="pudong shanghai China" --enable-shared --with-default-snmp-version=2 --enable-mfd-rewrites --with-mib-modules="misc/ipfwacc mibII host disman/event-mib ucd_snmp agent_mibs agentx notification target utilities ucd-snmp/diskio tunnel mibII/mta_sendmail" --with-sysconfdir="/usr/local/net-snmp/etc/"

如编译报错:
Quotation
/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status

这是缺少libperl-dev开发库,安装上
apt-get install libperl-dev

然后make ;make install
可以用snmpconf配置snmpd.conf,也可用例子文件
cp  EXAMPLE.conf /usr/local/net-snmp/etc/snmpd.conf

然后根据需要修改此文件
com2sec local     localhost       askwan
com2sec mynetwork 192.168.0.0/24      askwan

group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

view all    included  .1                               80
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

syslocation shanghai pu dong
syscontact Me askwan@askwan.com

启动
/usr/local/net-snmp/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a -c /usr/local/net-snmp/etc/snmpd.conf


测试
snmpwalk -c askwan -v2c 192.168.0.5 if

Quotation
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
....


---------END------------

作者:askwan@『AskWan』
地址:http://www.askwan.com/debian_net-snmp_compile/
可以转载,转载时请以链接形式注明作者和原始出处及本声明!

Tags: ,
Oprating System | Comments(0) | Trackbacks(0) | Reads(673)
收藏到网摘:百度搜藏 Google书签 Yahoo收藏 新浪ViVi收藏夹 365天天网摘 天极网摘 我摘·网摘·网络书签 POCO网摘 和讯网摘 Bolaa博拉博客收录中心 天下图摘
Add a comment
Emots
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
Enable HTML
Enable UBB
Enable Emots
Hidden
Remember
Nickname   Password   Optional
Site URI   Email   [Register]