先在服务器上配置snmp服务:
1、安装snmp软件
yum install net-snmp net-snmp-devel net-snmp-utils ************************************************************************************** ************************************************************************************** nstalled: net-snmp.x86_64 1:5.5-54.el6_7.1 net-snmp-devel.x86_64 1:5.5-54.el6_7.1 net-snmp-utils.x86_64 1:5.5-54.el6_7.1 Dependency Installed: elfutils-devel.x86_64 0:0.161-3.el6 elfutils-libelf-devel.x86_64 0:0.161-3.el6 file-devel.x86_64 0:5.04-21.el6 lm_sensors-devel.x86_64 0:3.1.1-17.el6 lm_sensors-libs.x86_64 0:3.1.1-17.el6 net-snmp-libs.x86_64 1:5.5-54.el6_7.1 popt-devel.x86_64 0:1.13-7.el6 rpm-devel.x86_64 0:4.8.0-47.el6 tcp_wrappers-devel.x86_64 0:7.6-57.el6 Dependency Updated: elfutils.x86_64 0:0.161-3.el6 elfutils-libelf.x86_64 0:0.161-3.el6 elfutils-libs.x86_64 0:0.161-3.el6 file.x86_64 0:5.04-21.el6 file-libs.x86_64 0:5.04-21.el6 redhat-rpm-config.noarch 0:9.0.3-44.el6.centos rpm.x86_64 0:4.8.0-47.el6 rpm-build.x86_64 0:4.8.0-47.el6 rpm-libs.x86_64 0:4.8.0-47.el6 rpm-python.x86_64 0:4.8.0-47.el6 Complete!
2、要确保snmp服务是关闭状态
[[email protected] /]# service snmpd status snmpd is stopped
3、创建snmp用户和密码
[[email protected] /]# net-snmp-config --create-snmpv3-user -ro -A passwordtest -a MD5 usertest adding the following line to /var/lib/net-snmp/snmpd.conf: createUser test MD5 "passwordtest" DES adding the following line to /etc/snmp/snmpd.conf: rouser test
4、启动snmp服务并使其开机运行
[[email protected] /]# service snmpd start Starting snmpd: [ OK ] [[email protected] /]# chkconfig snmpd on
5、测试snmp的可用性
[[email protected] /]# snmpwalk -v 3 -u usertest -a MD5 -A "passwordtest" -l authNoPriv 127.0.0.1 sysDescr SNMPv2-MIB::sysDescr.0 = STRING: Linux qiudays-ECS 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64
配置监控宝:
1、2、创建监控
3、如果服务器开启了iptables的话,需要放行流量
[[email protected] /]# iptables -A INPUT -i eth1 -p udp -s 60.195.252.107 --dport 161 -j ACCEPT [[email protected] /]# iptables -A INPUT -i eth1 -p udp -s 60.195.252.110 --dport 161 -j ACCEPT
4、还可以使用监控宝的snmp远程测试来测试你的snmp服务是否可用
访问http://www.jiankongbao.com/labs/snmp
5、完成了就可以看创建好的监控了
时间: 2024-11-03 21:06:03