1、确保本机已经安装了snmp 服务

[root@idc ~]# rpm -qa |grep snmp

net-snmp -libs-5.1.2-11.EL4.7

net-snmp -5.1.2-11.EL4.7

如果没有,那么放入安装盘找到snmp 的rpm包进行安装,或者到网上搜索适合自己发行版本的rpm包进行安装

如果提示有依赖关系,那么通过yum install net-snmp -5.3.1…….rpm来安装。

2、snmpd.conf文件配置

按照如下方式修改snmpd.conf文件

A、修改默认的community string

com2sec notConfigUser default public

将public修改为你才知道的字符串

B、把下面的#号去掉(是干什么用的还没找到答案)

#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

C、下面列出的是可以访问的oid,比如.1.3.6.1.2.1.1表示可以访问sys组的信息

# Make at least  snmpwalk -v 1 localhost -c public system fast again.

#       name           incl/excl     subtree         mask(optional)

view    systemview    included   .1.3.6.1.2.1.1

view    systemview    included   .1.3.6.1.2.1.25.1.1

view    systemview    included   .1.3.6.1.2.1.2

view    systemview    included   .1.3.6.1.2.1.4

D、把下面的语句

access notConfigGroup "" any noauth exact systemview none none

改成:

access notConfigGroup "" any noauth exact mib2 none none

是为了禁止对mib2的访问

3、重启snmpd服务

#/etc/rc.d/init.d/snmpd restart

或#service snmpd restart

完成snmpd的配置

4、确保linux 的iptables防火墙 对我们的流量监控 开放了udp 161端口的访问权限

可使用iptables –L –n 查看当前iptables规则

可编辑/etc/sysconfig/iptables文件来修改iptables规则。

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐