SNMP(简单网络管理协议),由一组网络管理的标准组成,包含一个应用层协议(application layer protocol)、数据库模型(database schema)和一组资源对象. 在开源监控系统中主要针对硬件的监控,比如:交换机,路由器,打印机以及网络流量.


1.安装SNMP协议(zabbix已安装好)

[root@db02 ~]# yum install net-snmp -y
[root@db02 ~]# vim /etc/snmp/snmpd.conf
view    systemview    included   .              #添加这行

proc mountd                      #去掉前面注释
proc ntalkd 4                      #去掉前面注释

proc sendmail 10 1             #去掉前面注释

disk / 10000                        #去掉前面注释

load 12 14 14                      #去掉前面注释

[root@db02 ~]# /etc/init.d/snmpd restart
Stopping snmpd:                         [  OK  ]

Starting snmpd:                           [  OK  ]

[root@db02 ~]# netstat -antulp | grep 161            
udp        0      0 0.0.0.0:161                 0.0.0.0:*                               26382/snmpd        
[root@db02 ~]# snmpwalk -v 2c -c public localhost .           #查看所有的对像
SNMPv2-MIB::sysDescr.0 = STRING: Linux db02 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2587) 0:00:25.87
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING: db02
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (0) 0:00:00.00
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (888406334) 102 days, 19:47:43.34
HOST-RESOURCES-MIB::hrSystemUptime.0 = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@db02 ~]# snmpwalk -v 2c -c public localhost -On .    #以OID形势显示


2.在zabbix添加snmp监控

(1).添加snmp协议

wKioL1ce3WujIjWrAABsMsuSxY4248.png

(2)观察snmp协议图标是否变亮

wKioL1ce3aDwywO8AAAS8siT82g292.png

(3).添加项目和触发器

wKioL1ce3oiAgRQZAABBIUsGidI868.png

wKiom1ce3cCxByBIAAB4IiOgL-Y483.png

wKioL1ce3omB7cNPAABDF7Vu7h0855.png


(4)绘图

wKiom1ce3kDzeBsSAAA9I6G5i7o494.png

wKioL1ce3wqz0El4AAA5RziYDz0165.png


3.查看监控状态

wKiom1ce3tvgxKcjAAB6YAkv5rw710.png