首先搭建一个拓扑,该拓扑的配置,路由器的SNMP配置,Cloud的设置在之前的文章中有写过。
此时AR1与Zabbix Server能够互相Ping通,且Zabbix Server上能通过snmpwalk命令获取路由器相参数。
VMWare环境(CentOS7.6)下Zabbix5.0 基于SNMP监控eNSP数通设备_筐瓢大师小吕的博客-CSDN博客
初试Zabbix5.0下使用官方OID监控eNSP数通设备接口状态_筐瓢大师小吕的博客-CSDN博客_zabbix 监控oid
将路由器添加至主机以及主机群组中(笔者尝试过使用自动发现及相关动作/操作,有发现到该台设备但未被添加至主机群组中,故放弃)。
如图,添加成功。
华为路由器dic cu信息如下:
dis cu [V200R003C00] # sysname AR1220 # snmp-agent local-engineid 800007DB03000000000000 snmp-agent community read %$%$>--pG@yC>E[Z}S!J/xqB,*k;%$%$ snmp-agent sys-info version v2c snmp-agent target-host trap-hostname zabbix-server address 192.168.200.129 udp- port 161 trap-paramsname zabbix snmp-agent trap enable snmp-agent # clock timezone China-Standard-Time minus 08:00:00 # portal local-server load portalpage.zip # drop illegal-mac alarm # set cpu-usage threshold 80 restore 75 # aaa authentication-scheme default authorization-scheme default accounting-scheme default domain default domain default_admin local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$ local-user admin service-type http # firewall zone Local priority 15 # interface Ethernet0/0/0 # interface Ethernet0/0/1 # interface Ethernet0/0/2 # interface Ethernet0/0/3 # interface Ethernet0/0/4 # interface Ethernet0/0/5 # interface Ethernet0/0/6 # interface Ethernet0/0/7 # interface GigabitEthernet0/0/0 description To-Zabbix Server ip address 192.168.200.10 255.255.255.0 # interface GigabitEthernet0/0/1 # interface NULL0 # user-interface con 0 authentication-mode password user-interface vty 0 4 user-interface vty 16 20 # wlan ac # return
我们可以在“最新数据”中看到键值对应的信息:
可以在右侧的“历史记录”中查看完整的信息, 如“System description”对应的数据为“Huawei AR1220 Huawei Versatile Routing Platform Software VRP (R) software,Version 5.130 (AR1220 V200R003C00) Copyright (C) 2011-2012 Huawei Technologies Co., Ltd“。
也可以查看自动发现规则下Gigabitethernet 0/0/0的接口相关信息:
笔者在时间差值为一分钟左右时通过命令行查看该接口的信息:
dis int gi0/0/0
GigabitEthernet0/0/0 current state : UP
Line protocol current state : UP
Last line protocol up time : 2022-04-24 13:13:02 UTC-08:00
Description:To-Zabbix Server
Route Port,The Maximum Transmit Unit is 1500
Internet Address is 192.168.200.10/24
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 00e0-fcaf-2c57
Last physical up time : 2022-04-24 13:12:05 UTC-08:00
Last physical down time : 2022-04-24 13:11:41 UTC-08:00
Current system time: 2022-04-24 14:52:46-08:00
Port Mode: COMMON COPPER
Speed : 1000, Loopback: NONE
Duplex: FULL, Negotiation: ENABLE
Mdi : AUTO
Last 300 seconds input rate 24200 bits/sec, 6 packets/sec
Last 300 seconds output rate 360 bits/sec, 0 packets/sec
Input peak rate 403296 bits/sec,Record time: 2022-04-24 13:13:44
Output peak rate 9680 bits/sec,Record time: 2022-04-24 14:00:04
Input: 37709 packets, 13173305 bytes
Unicast: 28283, Multicast: 3414
Broadcast: 6012, Jumbo: 0
Discard: 0, Total Error: 0
CRC: 0, Giants: 0
Jabbers: 0, Throttles: 0
Runts: 0, Symbols: 0
Ignoreds: 0, Frames: 0
Output: 2535 packets, 257755 bytes
Unicast: 2530, Multicast: 0
Broadcast: 5, Jumbo: 0
Discard: 0, Total Error: 0
Collisions: 0, ExcessiveCollisions: 0
Late Collisions: 0, Deferreds: 0
Input bandwidth utilization threshold : 100.00%
Output bandwidth utilization threshold: 100.00%
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
可以看到,Zabbix Web上的端口接收数据为20.49kbps,AR1220上近五分钟的平均input rate为24200kbps。(差不多)
Zabbix Web上端口发送数据为352bps,AR1220上为360bps。
端口错误信息一般来自于物理原因(设备之间的协商、双工模式、光功率异常、线缆问题等),故在仿真平台下,Inbound packets discarded、Inbound packets with errors、Outbound packets discarded、Outbound packets with errors都为0。相应的,在dis interface gi0/0/0信息中,CRC、Giants、Jabbers、Throttles、Runts、Symbols、Ignoreds、Frames也为0。在display interface brief中Gigabitethernet 0/0/0的InUti、OutUti为0%,inErros、outErrors为0。
interface type为ethernetCSmacd,描述为
-- for all ethernet-like interfaces,
-- regardless of speed, as per RFC3635。
Speed为千兆,没问题。
可以发现,官方的模板给的检测值都较为普通,在设备正常时通过Display命令便可以大致清楚设备的状态,而Zabbix作为一个开源的监控方案,能够更好地监控实时变化的数据,而作为数通产品,流量的出入及是否正常是最为重要的,这些在Zabbix上已经实现(且Zabbix自然也存在监控设备硬件情况的模板,如监控CPU、内存、风扇或电源运行状态等),作为数通工程师,在对设备运作方式了熟于心以外,还应对整个网络架构的运维相当熟悉。在某个项目被交付后,如何进行运维且通过各种工具减少运维工作量,提升运维效率是运维工程师的一大课题。我们可以通过Python实现对设备的自动化部署(添加/修改配置)并获取我们想要的结果(所以在网络自动化方向,许多工具都可以被用来做相同的事情)。
试想,一个标准的二层+三层园区网络,工程师在接入层交换机使能STP edge-port技术与DHCP snooping技术,接入的新交换机以及非法DHCP服务器(如无线路由器)可能导致端口关闭,如果运维工程师能通过OID(或者自定义监控项)使Zabbix能够主动向工程师告警,那么工程师能够对相应的情况有一定了解。
我们也可以通过OID或自定义的监控项来监控LLDP状态是否变更、光功率是否高于或低于阈值,DHCP地址池的剩余情况、ACL的匹配情况、disabled/*down/#down端口的检测等来确保网络的安全或稳定性。虽然Zabbix无法及时或高效地处理这些问题,但如果工程师能稍早通过监控项或触发器发现倪端,对于潜在的问题能够及时发现,也能够更早地做出应对。
下以篇笔者将尝试通过OID或自定义的监控项对VRRP+MSTP的园区网络进行监控与分析。



