SNMP简单介绍
Simple Network Management Protocol。简单网络管理协议。
使用snmp协议可以方便我们监控服务器、交换机、路由器等。
SNMP监控实战说明
监控Linux、Windows服务器建议使用Agent。
网络设备一般使用SNMP,监控网络接口存活和网络接口流量。
使用SNMP监控说明
被监控服务器需要安装snmp服务。
路由器、交换机可以开启SNMP服务器,需要自己设置SNMP的密码。
Zabbix服务器通过snmp协议去监控。
Snmp的版本
v1基于community进行控制访问。
v2c也是基于community进行控制访问,但比v1增强了部分功能。实战中使用v2c。
v3加强了认证。
实战
Zabbix服务器:192.168.0.35
被监控的服务器:192.168.0.36
Centos Snmp服务器安装
yum install -y net-snmp net-snmp-utils
Snmp的配置/etc/snmp/snmpd.conf
com2sec notConfigUser default liwen #此处根据要求填写适合自己的
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1
access notConfigGroup “” any noauth exact systemview none none
syslocation hangzhou
syscontact module@hangzhou.com
dontLogTCPWrappersConnects yes
Snmp配置详解
com2sec notConfigUser default shijiangepwd #用户名、访问IP白名单(default代表所有ip访问)、密码。
group notConfigGroup v2c notConfigUser #组名、SNMP版本、用户名。
view systemview included .1.3.6.1 #视图名称、包含(incl/excl)、subtree。
access notConfigGroup “” any noauth exact systemview none none #组名、内容、SNMP版本any所有、认证等级、systemview读权限、无写权限、无trapper权限。
Snmp开启
systemctl start snmpd
systemctl enable snmpd
验证Snmp服务
进程:ps aux|grep snmpd
端口:netstat -nlp|grep 161
日志:cat /var/log/messages