net-snmp(5.7.2) install and test in linux

来源:互联网 发布:什么是三维编程 编辑:程序博客网 时间:2024/06/05 23:10
1. download net-snmp-5.7.2 source from http://www.net-snmp.org/download.html

2. cd net-snmp-5.7.2

3. ./configure

增加配置项目:

./configure --prefix=/usr/local/net-snmp --enable-mfd-rewrites --with-default-snmp-version="2" --with-sys-contact="Aaron_E_mail:lvsong@yaolan.com" --with-sys-location="China" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"

note:

refix:net-snmp将要安装的路径

enable-mfd-rewrites:允许用新的MFD重写可用的mid模块

with-default-snmp-version:默认的SNMP版本

with-sys-contact:可以配置该设备的联系人

with-sys-location:该设备的位置

with-logfile:日志文件路径

with-persistent-directory:不变数据存储目录如果不添加那么多的参数,就一个prefix的话,后面的参数,在安装过程中都会有提示,所以说那些参数不是现在就必须要写得,ok配置完成后输出如下信息

4. make

error1: /bin/ld: cannot find -lperl

fix:

apt-get install libperl-dev

/usr/local/bin# ln -s libperl.so.5.10 libperl.so

5. make install

6. snmptrap fail
snmptrap: error while loading shared libraries: libnetsnmp.so.30: cannot open shared object file: No such file or directory

fix:

/usr/local/lib下所有的包都copy到/usr/lib

7. 拷贝配置文件模板,修改后重启snmpd(可kill后重新打开)

将EXAMPLE.conf文件复制到/usr/local/net-snmp/share/snmp/,并重命名为snmpd.conf

[root@localhost net-snmp-5.3.2]# cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf

修改配置文件将配置文件修改成下面的参数Sec.name是定义的别名,在后面的组中使用,组要用来赋予权限,是只读还是读写,source是允许那个地址来连接你的snmp,我现在写的这个是允许172.21.0.88这个地址来连接,如果你需要使用一个网段的话,那么就可以这么写了172.21.0.0/24,这个看的明白吧,community是共同体的名称,你用client连接snmp使用的,相当于密码

com2sec local     localhost       COMMUNITY
com2sec mynetwork 172.21.0.88     public

#                context sec.model sec.level match  read   write  notif
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    none   none

8.启动snmp并后台运行

[root@localhost net-snmp-5.3.2]# /usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf &

9.设置环境变量为了下一步的测试

[root@localhost net-snmp-5.3.2]# PATH=/usr/local/net-snmp/bin:/usr/local/net-snmp/sbin:$PATH

10.测试使用到snmpwalk这个命令

[root@localhost net-snmp-5.3.2]# snmpwalk -v 2c -c public localhost if
如果能看到下面的信息恭喜能,net-snmp安装配置完成,你可以去client使用监控软件开始工作了这里记住了,每次对snmpd.conf文件修改后,如果要生效,必须要杀掉snmp的老进程,在启用新的,要开机自动启动进程,我们可以使用这个在/etc/rc.d/rc.local文件中添加

/usr/local/net-snmp/sbin/snmpd –d 就ok了.


原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 玩刺客信条3卡死怎么办 mac玩刺客信条卡怎么办 阴部长了个疙瘩怎么办 两个人觉得累了怎么办 朋友把我拉黑了怎么办 下雨了怎么办我好想你 雨停怎么办我好想你 下雨天怎么办我好想你 天谕账号忘记了怎么办 天谕账号被冻结怎么办 促黄体生成素低怎么办 地暖家里太干燥怎么办 剑灵摧毁了东西怎么办 想打嗝打不出来怎么办 孩子满100天要怎么办 宝宝吃奶粉过敏了怎么办 1岁宝宝不喝奶粉怎么办 母乳不够宝宝不喝奶粉怎么办 宝宝吃奶粉上火了怎么办 我小孩不喝奶粉怎么办 2岁宝宝不喝奶粉怎么办 婴儿吃奶粉上火了怎么办 100天的宝宝咳嗽怎么办 40天的小孩咳嗽怎么办 40天的婴儿咳嗽怎么办 50天的婴儿咳嗽怎么办 宝宝20天感冒了怎么办 1个月宝宝咳嗽怎么办 40天的宝宝干咳怎么办 百天的宝宝咳嗽怎么办 50天的孩子咳嗽怎么办 百天宝宝咳嗽有痰怎么办 1岁半宝宝拉肚子怎么办 百天的宝宝拉肚子怎么办 激战2帧数三十多怎么办 太受欢迎了怎么办txt微 太受欢迎了怎么办网盘 太受欢迎了怎么办微盘 我太受欢迎了该怎么办h 我太受欢迎了该怎么办1 卡培他滨副作用怎么办