新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > net-snmp移植到arm

net-snmp移植到arm

作者:时间:2016-11-21来源:网络收藏
关于net-snmp移植,是基于静态编译的,动态的没有做成功,在arm上的移植过程大致如下:

如果没有涉及到扩展agent,则蓝色字体不需要理会。

本文引用地址:http://www.eepw.com.cn/article/201611/319384.htm

1.将源码包另找一个路径放下,解压
tar -xzvf net-snmp-5.4.1.tar.gz,
若想扩展agent,则可以将此模块的.c和.h文件先放到net-snmp-5.4.4/agent/mibgroup下一起配置编译;

例如我这里想用代理读写encoder模块,那么先将写好的encoder源文件复制到net-snmp-5.4.4/agent/mibgroup路径下

2.CC=arm-linux-gcc ./configure --prefix=/home/arm_for_snmp/ --build=i386-linux --host=arm-linux --enable-mini-agent --disable-ipv6 --with-endianness=little --disable-manuals --disable-ucd-snmp-compatibility --enable-as-needed --disable-embedded-perl --without-perl-modules --disable-snmptrapd-subagent --disable-applications --disable-scripts --with-default-snmp-version="2" --with-sys-contact="lgao@cti.com.cn" --with-sys-location="china" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"

若想扩展agent,则可以再末尾继续添加

--with-mib-modules="encoder"

如何添加多个模块,没有试过
3.make LDFLAGS="-static"
如果不指出静态编译,那么直接放到板子上的程序会提示:can’t load library ‘libnetsnmpmibs.so.15’.
4.make install
5.arm-linux-strip snmpd
压缩,节省空间

在arm端执行
1.cd /usr/local/share/snmp/snmp.conf
mibs +NET-SNMP-ENCODER-MIB
2.cd /usr/sbin
./snmpd -c /usr/local/share/snmp/snmpd.conf -M /usr/local/share/snmp/mibs

3.和在虚拟机端一样,开启snmpd进程后,可以

cat /var/log/snmpd.log

来查看代理进程是否成功开启;若出现了版本信息,开启成功。
4.因为在./configure 的选项中是配置了最小的snmpd,所以如果想用到

snmpwalk /snmpget/snmptrap等应用时,可以直接从虚拟机端net-snmp的交叉编译版本的/bin路径下拷过来就可以了。

说明:

在用snmptrap 命令工具测试我加入的encoder模块的时候,会出现报错情况,说是找不到节点什么的,这时可以尝试把类似SNMPv2-MIB:sysLocation.0用OID来表示。这一点更多的是涉及到扩展agent的东西,后面会详细提到的。




关键词: net-snmp移植ar

评论


相关推荐

技术专区

关闭