net-snmp在linux下的安装及snmp开发
2009-05-14 11:32
429 查看
http://avery-leo.javaeye.com/blog/218504
一.环境
OS:RHEL AS4
net-snmp version:5.3.2
二.步骤
1.用root帐户登录
2.运行snmpwalk和snmpget命令,看是否已经安装snmp,如果已经安装就没必要再安装了;-)
3.将net-snmp-5.3.2.tar.gz解压(tar -zxvf net-snmp-5.3.2.tar.gz)
4.进入net-snmp-5.3.2目录
5.运行./configure,根据提示输入相应信息
6.运行make
7.运行make install
8.安装完毕
三.可能遇到的问题
1.找不到libbeecrypt.la,在make时可能出现如下error
解决办法:
到http://sourceforge.net/projects/beecrypt下载beecrypt-4.1.2.tar.gz
然后运行如下命令:
#tar -zxvf beecrypt-4.1.2.tar.gz
#./configure -prefix=/usr(默认是安装在/usr/local,我们需要安装在/usr目录下)
#make
#make install
2./usr/bin/ld: cannot find -lelf,在make时可能出现如下error
解决办法:
#ln -s libelf.so.1 /usr/lib/libelf.so
3.我在安装的过程中没有碰到这个问题,在此作为参考
echo /usr/local/lib >/etc/ld.so.conf.d/libnetsnmp.conf
#/sbin/ldconfig -v
#make install
开发注意事项:
1.使用mib2c, mib文件须放在/usr/local/share/snmp/mibs/下。
2.流程:写mib文件,mib2c转换成c代码,加入工程,注册,并修改makefile。
3.header_xxxTable函数的实现?table_size为entry的个数,如几个端口。
4.新加的oid节点是用户自己定义的。
5.判断oid节点是否有效的函数header_generic(简单变量),header_simple_table(简单表)等如果使用不当,会导致找不到节点。
6.返回给管理端的数据是通过下面的过程实现的:
switch(vp->magic) {
case ETHERSTATSDROPEVENTS:
long_ret = 0;
return (unsigned char *) &long_ret;
case ETHERSTATSOCTETS:
long_ret = 0;
return (unsigned char *) &long_ret;
......
}
当然,这些值是需要调用相应的底层函数取得的。
links:
http://groups.google.com/group/ems-nms?hl=zh-CN%3Fhl%3Den
http://www.net-snmp.org/wiki/index.php/Tutorials
一.环境
OS:RHEL AS4
net-snmp version:5.3.2
二.步骤
1.用root帐户登录
2.运行snmpwalk和snmpget命令,看是否已经安装snmp,如果已经安装就没必要再安装了;-)
3.将net-snmp-5.3.2.tar.gz解压(tar -zxvf net-snmp-5.3.2.tar.gz)
4.进入net-snmp-5.3.2目录
5.运行./configure,根据提示输入相应信息
6.运行make
7.运行make install
8.安装完毕
三.可能遇到的问题
1.找不到libbeecrypt.la,在make时可能出现如下error
libtool: link: cannot find the library `/usr/lib/libbeecrypt.la' (librpmio.la: /usr/lib/libbeecrypt.la) make[1]: *** [snmpd] Error 1 make[1]: Leaving directory `/home/xxx/net-snmp-5.3.2/agent' make: *** [subdirs] Error 1 |
到http://sourceforge.net/projects/beecrypt下载beecrypt-4.1.2.tar.gz
然后运行如下命令:
#tar -zxvf beecrypt-4.1.2.tar.gz
#./configure -prefix=/usr(默认是安装在/usr/local,我们需要安装在/usr目录下)
#make
#make install
2./usr/bin/ld: cannot find -lelf,在make时可能出现如下error
/usr/bin/ld: cannot find -lelf collect2: ld returned 1 exit status make[1]: *** [snmpd] Error 1 make[1]: Leaving directory `/home/xxx/net-snmp-5.3.2/agent' make: *** [subdirs] Error 1 |
#ln -s libelf.so.1 /usr/lib/libelf.so
3.我在安装的过程中没有碰到这个问题,在此作为参考
echo /usr/local/lib >/etc/ld.so.conf.d/libnetsnmp.conf
#/sbin/ldconfig -v
#make install
开发注意事项:
1.使用mib2c, mib文件须放在/usr/local/share/snmp/mibs/下。
2.流程:写mib文件,mib2c转换成c代码,加入工程,注册,并修改makefile。
3.header_xxxTable函数的实现?table_size为entry的个数,如几个端口。
4.新加的oid节点是用户自己定义的。
5.判断oid节点是否有效的函数header_generic(简单变量),header_simple_table(简单表)等如果使用不当,会导致找不到节点。
6.返回给管理端的数据是通过下面的过程实现的:
switch(vp->magic) {
case ETHERSTATSDROPEVENTS:
long_ret = 0;
return (unsigned char *) &long_ret;
case ETHERSTATSOCTETS:
long_ret = 0;
return (unsigned char *) &long_ret;
......
}
当然,这些值是需要调用相应的底层函数取得的。
links:
http://groups.google.com/group/ems-nms?hl=zh-CN%3Fhl%3Den
http://www.net-snmp.org/wiki/index.php/Tutorials
相关文章推荐
- net-snmp在linux下的安装及snmp开发
- Linux安装net-snmp
- Linux下安装和配置net-snmp
- Linux下安装和配置net-snmp
- 在linux4.7上安装net-snmp编译遇到的问题
- linux下net-snmp的源码编译安装与配置
- linux net snmp 安装
- Linux下RPM方式安装net-snmp
- Linux---net-snmp安装遇到的错误
- Linux下RPM方式安装net-snmp
- net-snmp在Linux下的安装过程
- Linux net-snmp-5.7.2安装配置
- [转]linux系统下安装配置net-snmp
- linux下安装与配置net-snmp服务
- Centos net-snmp开发包的安装及配置 .
- linux下安装net-snmp以及遇到的问题
- Linux下基于net-snmp的Agent扩展开发
- net-snmp在Linux下的安装过程【转】
- linux net-snmp安装与配置
- linux下安装配置net-snmp