Linux系统的SNMP服务设置
1) 安装SNMP
一般情况下Linux中的均已经自动安装了SNMP服务。以下命令可以检测SNMP服务是否安装以及安装的文件包。
[root@idc ~]# rpm -qa |grep snmp net-snmp-libs-5.1.2-11.EL4.7 net-snmp-5.1.2-11.EL4.7
2) 配置SNMP
按照如下方式修改/etc/snmp/snmpd.conf文件
A、修改默认的community string(SUM中SNMP读值密码) com2sec notConfigUser default public 将public修改为你才知道的字符串
将“default”改为你想哪台机器可以看到你的snmp信息,比如SUM所在IP为:10.10.10.10,就改成这个IP。不改表示所有机器充许。
B、把下面的#号去掉 #view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
启用全部功能可以使用如下一行(如果没有可以加入一行):
view all included .1 80
C、把下面的语句 access notConfigGroup "" any noauth exact systemview none none 改成: access notConfigGroup "" any noauth exact mib2 none none
或是:
access notConfigGroup "" any noauth exact all none none
3) 启动与停止SNMP
一般使用:service snmpd start|stop|restart命令。或是:
#/etc/rc.d/init.d/snmpd restart
4) 防火墙
如果Linux启动了防火墙,请开放UDP的161端口。确保Linux的iptables防火墙对SUM监控服务器开放了udp 161端口的访问权限 可使用iptables ?L ?n 查看当前iptables规则 可编辑/etc/sysconfig/iptables文件来修改iptables规则。