zhenrenfengjian
驱动牛犊
驱动牛犊
  • 注册日期2007-03-08
  • 最后登录2009-08-21
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
阅读:4844回复:0

SNMP LINUX 安装

楼主#
更多 发布于:2007-03-08 16:42
  LINUX AS 4
MASTER AGENT安装
http://www.net-snmp.com/download.html
下载最新版本
$./configure --with-mib-modules="agentx"
$make
可能遇到问题
1.找不到libbeecrypt.la
下载beecrypt-4.1.2.tar.gz
http://sourceforge.net/projects/beecrypt
./configure -prefix=/usr
默认是安装在/usr/local的偶们要装在/usr下
$make
$make install
2./usr/bin/ld: cannot find -lelf
$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

配置文件创建
$snmpconf -g basic_setup

Installing the Perl/SNMP Module
$cd perl
$perl Makefile.PL
$make
$make test
$make install (as root)
$添加/var/agentx目录
启动SNMPD
$snmpd -f -Le -d
$ps -ef
root     30993     1  0 Mar01 ?        00:00:14 snmpd -f -Le -d
//得到物理地址
$snmpget -v2c -c public localhost ifPhysAddress.2
安装成功

SUB AGENT 安装
编写MIB模块定义文件 XXX-MIB.txt
复制文件到/usr/local/share/snmp/mibs
$echo "mibs + XXX-MIB" >> /usr/local/share/snmp/snmp.conf
激活MIB文件
利用mib2c转化MIB文件为C文件
在Net-Snmp帮助文件中mib2c有以下几种配置文件:
mib2c.scalar.conf              标量适用,常用的配置
mib2c.int_watch.conf           标量适用,绑定整数变量到整数
mib2c.mfd.conf                 表适用,常用的配置
mib2c.iterate.conf              表适用,表数据在Agent外部
mib2c.create-dataset.conf      表适用,表数据在Agent里,set操作时不需额外工作
mib2c.array-user.conf          表适用  表数据在Agent里,set操作需额外工作
mib2c.column_defines.conf        表适用,只有表头定义
mib2c.column_enums.conf          表适用,只有表头定义

mib2c –c mib2c.iterate.conf XXXMIB
在当前路径下会生成 XXXMIB.c 和 XXXMIB.h

复制XXXMIB.c 和 XXXMIB.h 到 net-snmp 源码目录 agent/mibgroup下
net-snmp-config --compile-subagent XXXMIB XXXMIB.c -I./
生成XXXMIB可执行文件
重新启动SNMPD
snmpd -f -Le –d &
启动代理
./XXXMIB -f -Le –d &
用SNMPGET命令可以得到接点
游客

返回顶部