CentOS5 安装配置 SNMP 服务
1.通过 yum 安装
yum install net-snmp net-snmp-utils
2.创建配置文件,并且添加用户
snmpconf
输出:
The following installed configuration files were found: 1: /etc/snmp/snmpd.conf 2: /usr/share/snmp/snmpd.confWould you like me to read them in? Their content will be merged with theoutput files created by this session.Valid answer examples: "all", "none","3","1,2,5"Read in which (default = all): noneI can create the following types of configuration files for you.Select the file type you wish to create:(you can create more than one as you run this program) 1: snmpd.conf 2: snmp.conf 3: snmptrapd.confOther options: quitSelect File: 1The configuration information which can be put into snmpd.conf is dividedinto sections. Select a configuration section for snmpd.confthat you wish to create: 1: Access Control Setup 2: Extending the Agent 3: Agent Operating Mode 4: System Information Setup 5: Trap Destinations 6: Monitor Various Aspects of the Running HostOther options: finishedSelect section: 1Section: Access Control SetupDescription: This section defines who is allowed to talk to your running snmp agent.Select from: 1: a SNMPv3 read-write user 2: a SNMPv3 read-only user 3: a SNMPv1/SNMPv2c read-only access community name 4: a SNMPv1/SNMPv2c read-write access community nameOther options: finished, listSelect section:
最后一项根据你自己的需要选择
3.创建用户(SNMPv3)
在 /var/net-snmp/snmpd.conf(如果没有,先启动snmp服务
/etc/init.d/snmpd start)
中添加如下行,用户名密码根据你自己情况修改
createUser user1 MD5 user1password
4.重启动服务
/etc/init.d/snmpd stop
/etc/init.d/snmpd start
5.打开防火墙端口
iptables -A INPUT -i eth0 -p udp -s [允许访问的ip地址] --dport 161 -j ACCEPT
5.监控
http://blog.jiankongbao.com/?p=160