码迷,mamicode.com
首页 > Web开发 > 详细

移植net-snmp到开发板(mini210)

时间:2014-08-10 12:34:50      阅读:388      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   使用   os   io   文件   for   

1.安装交叉编译工具arm-linux-gcc

2.下载net-snmp源码安装包

3.解压安装包

4../configure --build=i686-linux --host=arm-linux  CC=arm-linux-gcc  --with-endianness=little --enable-mini-agent  --with-install-prefix=/usr/local/snmp_arm_install --with-ar=arm-linux-ar LDFLAGS="-static" --disable-embedded-perl --without-perl-modules具体要增加或者删除查看./configure --help

5.make 编译源码

6.make install 

7.移动Example.conf到intstall_dir/usr/local/share/snmp(install_dir是指定的安装路径)为snmpd.conf, 修改snmpd.conf

  #       sec.name  source          community

  com2sec local     localhost       COMMUNITY

  com2sec mynetwork NETWORK/24      COMMUNITY

  改为

  #       sec.name  source          community

  #com2sec local     localhost  COMMUNITY

  com2sec mynetwork 210.38.235.173      public

  其中210.38.235.173是开发板的ip

8.在移植前确定snmpd(install_dir/usr/local/sbin), snmpd(install_dir/usr/local/share/snmp), mibs(install_dir/usr/local/share/snmp),snmpwalk等命令(install_dir/usr/local/bin)存在

  在移植之前用arm-linux-strip命令压缩一下snmpd,snmpwalk等命令

9.将snmpd,snmpwalk等拷贝到开发板/usr/bin中, snmpd.conf和mib文件夹及文件夹中的内容拷贝到开发板/usr/local/share/snmp/中

  没有的文件夹自己创建,注意使用chmod 777 snmpd,snmpwalk

10.运行 snmpd -Cc /usr/local/share/snmp/snmpd.conf

  如果出现snmpd: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory类似内容,将计算机上面的库文件考到开发板的/lib目录下即可

11.ps -w|grep snmp查看snmpd是否运行成功

12.测试snmpwalk命令

[root@FriendlyARM snmp]# snmpwalk -c public -v 2c 210.38.235.173
SNMPv2-MIB::sysDescr.0 = STRING: Linux FriendlyARM 3.0.8-FriendlyARM #1 PREEMPT Sun Jul 6 20:51:22 EDT 2014 armv7l
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.8072.3.2.10
SNMPv2-MIB::sysUpTime.0 = Timeticks: (4243) 0:00:42.43
SNMPv2-MIB::sysContact.0 = STRING: G. S. Marzot <gmarzot@marzot.net>
SNMPv2-MIB::sysName.0 = STRING: FriendlyARM
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.2 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.3 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.5 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.2 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.4 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.5 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::snmpInPkts.0 = Counter32: 23
SNMPv2-MIB::snmpOutPkts.0 = Counter32: 23
SNMPv2-MIB::snmpInBadVersions.0 = Counter32: 0
SNMPv2-MIB::snmpInBadCommunityNames.0 = Counter32: 0
SNMPv2-MIB::snmpInBadCommunityUses.0 = Counter32: 0
SNMPv2-MIB::snmpInASNParseErrs.0 = Counter32: 0
SNMPv2-MIB::snmpInTooBigs.0 = Counter32: 0
SNMPv2-MIB::snmpInNoSuchNames.0 = Counter32: 0
SNMPv2-MIB::snmpInBadValues.0 = Counter32: 0
SNMPv2-MIB::snmpInReadOnlys.0 = Counter32: 0
SNMPv2-MIB::snmpInGenErrs.0 = Counter32: 0
SNMPv2-MIB::snmpInTotalReqVars.0 = Counter32: 33
SNMPv2-MIB::snmpInTotalSetVars.0 = Counter32: 0
SNMPv2-MIB::snmpInGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetNexts.0 = Counter32: 37
SNMPv2-MIB::snmpInSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetResponses.0 = Counter32: 0
SNMPv2-MIB::snmpInTraps.0 = Counter32: 0
SNMPv2-MIB::snmpOutTooBigs.0 = Counter32: 0
SNMPv2-MIB::snmpOutNoSuchNames.0 = Counter32: 0
SNMPv2-MIB::snmpOutBadValues.0 = Counter32: 0
SNMPv2-MIB::snmpOutGenErrs.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetNexts.0 = Counter32: 0
SNMPv2-MIB::snmpOutSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetResponses.0 = Counter32: 47
SNMPv2-MIB::snmpOutTraps.0 = Counter32: 0
SNMPv2-MIB::snmpEnableAuthenTraps.0 = INTEGER: disabled(2)
SNMPv2-MIB::snmpSilentDrops.0 = Counter32: 0
SNMPv2-MIB::snmpProxyDrops.0 = Counter32: 0

okay,移植成功。

参考文章:http://fajun1216.blog.163.com/blog/static/207405106201262104843794/

移植net-snmp到开发板(mini210),布布扣,bubuko.com

移植net-snmp到开发板(mini210)

标签:des   blog   http   使用   os   io   文件   for   

原文地址:http://www.cnblogs.com/luckygxf/p/3902512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!