服务器端SNMP设置:
安装:rpm -q net-snmp net-snmp-libs
net-snmp-utils
配置snmpd.conf:修改里面snmp信息允许被侦测的范围。被监控的服务器需要全部安装snmp服务,需要启用snmpd服务,同时更改配置文件,使服务器可以侦测到监控的snmp信息。
在/etc/snmp/snmpd.conf中修改:
view
systemview included .1.3.6.1.2.1.1
为:
view
systemview included .1.3.6.1.2.1
# service snmpd start //启动并测试
# snmpwalk -v 1 -c public
localhost .1.3.6.1.2.1.1.1.0
或者如下配置:
# vim /etc/snmp/snmpd.conf
com2sec notConfigUser 192.168.112.243
public
access notConfigGroup "" any
noauth exact all none none
view all included .1 80
//[root@nagios-server snmp]# /usr/bin/snmpconf
-g basic_setup
Ubuntu安装与配置snmp
(参考:)
1.安装
#sudo apt-get install snmpd snmp
snmp-mibs-downloader
2.配置
#vi /etc/snmp/snmpd.conf
#agentAddress udp:127.0.0.1:161 //注释掉,允许远程访问
agentAddress udp:161,udp6:[::1]:161 //取消注释
#view
systemonly included .1.3.6.1.2.1.1 // 45行左右,两行注释掉
#view
systemonly included .1.3.6.1.2.1.25.1
view
systemonly included .1
//增加此行,可以获取更多的节点信息
客户端SNMP设置(被监控端):
1. ubuntu :
vim /etc/default/snmpd //将此配置文件中127.0.0.1删掉。
/etc/init.d/snmpd restart
2. redhat/centos
vi /etc/snmp/snmpd.conf
com2sec notConfigUser default public
改为com2sec notConfigUser监控端IP public
access notConfigGroup "" any
noauth exact systemview none none
改为access notConfigGroup "" any noauth exact all none none
将#view all included .1 80前面的#注释去掉
service snmpd restart