- 修改snmpd的配置文件,文件路径 /etc/snmp/snmpd.conf
在配置文件中找到下面两行配置:
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.25.2.2.0
view systemview included .1.3.6.1.2.1.25.2.3.1
view systemview included .1.3.6.1.4.1.2021
view systemview included .1.3.6.1.2.1.2.1.0
view systemview included .1.3.6.1.2.1.2.2.1
2. 防火墙上打开snmpd udp监听端口
安全管理中心需要能够访问到子设备的snmpd服务,那么需要在防火墙上开启161端口:
iptables -A INPUT -p udp –dport 161 -j ACCEPT
service iptables save
3. 开启snmpd服务,并设置开机自启
使用下方命令:
service snmpd start
chkconfig snmpd on
4. 检查服务是否开启
检查端口161是否有监听:
netstat -nlup | grep “:161”
看到类似下方的返回信息,说明服务已经开启:
udp 0 0 0.0.0.0:161 0.0.0.0:* 29411/snmpd
检查snmpd服务是否工作:
snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.2.1.25.2.2.0
看到类似下方的信息,说明snmpd配置的监控指标已经生效:
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 8009808 KBytes