一、需求

之前机房用的都是级联,集群节点一多,这级联间传输数据就呈现瓶颈了,丢包,延迟,各种问题。经过一个月准备,于上周上架一套华三数据交换机,目前接入64个节点,根据要求,需要把交换端口纳入zabbix来监控。根据前辈博客指点,

http://dl528888.blog.51cto.com/2382721/1340983 现在完成部署了,非常感谢吟技术一流博客的技术指导

h3c的S7006交换机端口在zabbix监控步聚_第1张图片

二、交换机设置public

1、设置设置交换机snmp Community

[S7006-A]snmp-agent community read hdcx

2、设置交换机支持的华三交换机snmp协议,有v1,v2c,v3这3个版本,在这里设成all

[S7006-A]snmp-agent sys-info version all


三、在zabbix服务器测试

 IP地址为交换机管理地址,安全因素,在这里,我就以x.x.x.x为代替了

1、先安装net-snmp,net-snmp-utils

[root@web4 ~]# yum list net-snmp.x86_64 net-snmp-utils.x86_64


2、测试在线天数snmpwalk ip -c public -v 1 uptime

[root@web4 ~]#snmpwalk X.X.X.X -c hdcx -v 1 uptime
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (43907456) 5 days, 1:57:54.56
You have new mail in /var/spool/mail/root


3、取得系统信息

[root@web4 ~]#snmpwalk X.X.X.X -c hdcx -v 1 system
SNMPv2-MIB::sysDescr.0 = STRING: H3C Comware Platform Software, Software Version 5.20, Release 7708P09
H3C S7006
Copyright (c) 2004-2014 Hangzhou H3C Tech. Co., Ltd. All rights reserved.
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.25506.1.1001
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (43936197) 5 days, 2:02:41.97
SNMPv2-MIB::sysContact.0 = STRING: Hangzhou H3C Technologies Co., Ltd.
SNMPv2-MIB::sysName.0 = STRING: S7006-A
SNMPv2-MIB::sysLocation.0 = STRING: Hangzhou, China
SNMPv2-MIB::sysServices.0 = INTEGER: 78


4、查看端口信息

[root@web4 ~]#snmpwalk X.X.X.X -c hdcx -v 1 IF-MIB::ifDescr
IF-MIB::ifDescr.1 = STRING: M-Ethernet0/0/0
IF-MIB::ifDescr.2 = STRING: NULL0
IF-MIB::ifDescr.3 = STRING: Vlan-interface1
IF-MIB::ifDescr.4 = STRING: GigabitEthernet3/0/1
IF-MIB::ifDescr.5 = STRING: GigabitEthernet3/0/2
IF-MIB::ifDescr.6 = STRING: GigabitEthernet3/0/3
IF-MIB::ifDescr.7 = STRING: GigabitEthernet3/0/4

5、查看交换机端口流量

5.1获取端口所有流量

[root@web4 /usr/local/zabbix/bin]#snmpwalk x.x.x.x -v 2c -c hdcx  ifInOctets 
IF-MIB::ifInOctets.1 = Counter32: 0
IF-MIB::ifInOctets.2 = Counter32: 0
IF-MIB::ifInOctets.3 = Counter32: 0
IF-MIB::ifInOctets.4 = Counter32: 1440425743
IF-MIB::ifInOctets.5 = Counter32: 26904
IF-MIB::ifInOctets.6 = Counter32: 559400265
IF-MIB::ifInOctets.7 = Counter32: 0
IF-MIB::ifInOctets.8 = Counter32: 0
IF-MIB::ifInOctets.9 = Counter32: 880819184
IF-MIB::ifInOctets.10 = Counter32: 0
IF-MIB::ifInOctets.11 = Counter32: 0
IF-MIB::ifInOctets.12 = Counter32: 0
IF-MIB::ifInOctets.13 = Counter32: 3966135849
IF-MIB::ifInOctets.14 = Counter32: 1621604950
IF-MIB::ifInOctets.15 = Counter32: 2870897320
IF-MIB::ifInOctets.16 = Counter32: 0
IF-MIB::ifInOctets.17 = Counter32: 1552883189
IF-MIB::ifInOctets.18 = Counter32: 208802631
IF-MIB::ifInOctets.19 = Counter32: 2748626060
IF-MIB::ifInOctets.20 = Counter32: 311201766
IF-MIB::ifInOctets.21 = Counter32: 2819880861
IF-MIB::ifInOctets.22 = Counter32: 4031054518
IF-MIB::ifInOctets.23 = Counter32: 706742001
IF-MIB::ifInOctets.24 = Counter32: 141560828
IF-MIB::ifInOctets.25 = Counter32: 2973162866
IF-MIB::ifInOctets.26 = Counter32: 524924522
IF-MIB::ifInOctets.27 = Counter32: 3414979372
IF-MIB::ifInOctets.28 = Counter32: 2987116558
IF-MIB::ifInOctets.29 = Counter32: 1514916258
IF-MIB::ifInOctets.30 = Counter32: 112219586
IF-MIB::ifInOctets.31 = Counter32: 1493889982
IF-MIB::ifInOctets.32 = Counter32: 3165610008
IF-MIB::ifInOctets.33 = Counter32: 3991328204
IF-MIB::ifInOctets.34 = Counter32: 3955131027
IF-MIB::ifInOctets.35 = Counter32: 1656043633
IF-MIB::ifInOctets.36 = Counter32: 0
IF-MIB::ifInOctets.37 = Counter32: 3147055246
IF-MIB::ifInOctets.38 = Counter32: 3027604182
IF-MIB::ifInOctets.39 = Counter32: 2200164597
IF-MIB::ifInOctets.40 = Counter32: 2254224949
IF-MIB::ifInOctets.41 = Counter32: 4159332872
IF-MIB::ifInOctets.42 = Counter32: 2388809070
IF-MIB::ifInOctets.43 = Counter32: 4220151624
IF-MIB::ifInOctets.44 = Counter32: 3783866266
IF-MIB::ifInOctets.45 = Counter32: 2918239884
IF-MIB::ifInOctets.46 = Counter32: 2768371975
IF-MIB::ifInOctets.47 = Counter32: 1974354383
IF-MIB::ifInOctets.48 = Counter32: 2393263318
IF-MIB::ifInOctets.49 = Counter32: 1676086255
IF-MIB::ifInOctets.50 = Counter32: 2341689127
IF-MIB::ifInOctets.51 = Counter32: 1189533799
IF-MIB::ifInOctets.52 = Counter32: 413730869
IF-MIB::ifInOctets.53 = Counter32: 3146011652
IF-MIB::ifInOctets.54 = Counter32: 3138082596
IF-MIB::ifInOctets.55 = Counter32: 737523520
IF-MIB::ifInOctets.56 = Counter32: 1993122369
IF-MIB::ifInOctets.57 = Counter32: 3350844490
IF-MIB::ifInOctets.58 = Counter32: 2154964365
IF-MIB::ifInOctets.59 = Counter32: 0
IF-MIB::ifInOctets.60 = Counter32: 1340385958
IF-MIB::ifInOctets.61 = Counter32: 2776030010
IF-MIB::ifInOctets.62 = Counter32: 1674919943
IF-MIB::ifInOctets.63 = Counter32: 979457915
IF-MIB::ifInOctets.64 = Counter32: 679093166
IF-MIB::ifInOctets.65 = Counter32: 1254592808
IF-MIB::ifInOctets.66 = Counter32: 0
IF-MIB::ifInOctets.67 = Counter32: 891042969
IF-MIB::ifInOctets.68 = Counter32: 0
IF-MIB::ifInOctets.69 = Counter32: 1832960686
IF-MIB::ifInOctets.70 = Counter32: 2056731818
IF-MIB::ifInOctets.71 = Counter32: 1170294375
IF-MIB::ifInOctets.72 = Counter32: 3469636141
IF-MIB::ifInOctets.73 = Counter32: 440849432
IF-MIB::ifInOctets.74 = Counter32: 0
IF-MIB::ifInOctets.75 = Counter32: 1376368677
IF-MIB::ifInOctets.76 = Counter32: 2440560960
IF-MIB::ifInOctets.77 = Counter32: 2859969445
IF-MIB::ifInOctets.78 = Counter32: 448825627
IF-MIB::ifInOctets.79 = Counter32: 0
IF-MIB::ifInOctets.80 = Counter32: 1240923549
IF-MIB::ifInOctets.81 = Counter32: 704139512
IF-MIB::ifInOctets.82 = Counter32: 2016754879
IF-MIB::ifInOctets.83 = Counter32: 416102157
IF-MIB::ifInOctets.84 = Counter32: 1064973317
IF-MIB::ifInOctets.85 = Counter32: 317778723
IF-MIB::ifInOctets.86 = Counter32: 3079017265
IF-MIB::ifInOctets.87 = Counter32: 3689089240
IF-MIB::ifInOctets.88 = Counter32: 2280092719
IF-MIB::ifInOctets.89 = Counter32: 2421216012
IF-MIB::ifInOctets.90 = Counter32: 0
IF-MIB::ifInOctets.91 = Counter32: 1907809083
IF-MIB::ifInOctets.92 = Counter32: 2310214211
IF-MIB::ifInOctets.93 = Counter32: 3892177803
IF-MIB::ifInOctets.94 = Counter32: 2781044716
IF-MIB::ifInOctets.95 = Counter32: 0
IF-MIB::ifInOctets.96 = Counter32: 0
IF-MIB::ifInOctets.97 = Counter32: 0
IF-MIB::ifInOctets.98 = Counter32: 0
IF-MIB::ifInOctets.99 = Counter32: 0
IF-MIB::ifInOctets.100 = Counter32: 3674722097
IF-MIB::ifInOctets.101 = Counter32: 3728524781
IF-MIB::ifInOctets.102 = Counter32: 0
IF-MIB::ifInOctets.103 = Counter32: 0
IF-MIB::ifInOctets.104 = Counter32: 0
IF-MIB::ifInOctets.105 = Counter32: 0
IF-MIB::ifInOctets.106 = Counter32: 0
IF-MIB::ifInOctets.107 = Counter32: 0
IF-MIB::ifInOctets.108 = Counter32: 0
IF-MIB::ifInOctets.109 = Counter32: 0
IF-MIB::ifInOctets.110 = Counter32: 0
IF-MIB::ifInOctets.111 = Counter32: 0
IF-MIB::ifInOctets.112 = Counter32: 0
IF-MIB::ifInOctets.113 = Counter32: 0
IF-MIB::ifInOctets.114 = Counter32: 0
IF-MIB::ifInOctets.115 = Counter32: 0
IF-MIB::ifInOctets.116 = Counter32: 0
IF-MIB::ifInOctets.117 = Counter32: 0
IF-MIB::ifInOctets.118 = Counter32: 0
IF-MIB::ifInOctets.119 = Counter32: 0
IF-MIB::ifInOctets.120 = Counter32: 0
IF-MIB::ifInOctets.121 = Counter32: 0
IF-MIB::ifInOctets.122 = Counter32: 0
IF-MIB::ifInOctets.123 = Counter32: 0
IF-MIB::ifInOctets.124 = Counter32: 0
IF-MIB::ifInOctets.125 = Counter32: 0
IF-MIB::ifInOctets.126 = Counter32: 0
IF-MIB::ifInOctets.127 = Counter32: 0
IF-MIB::ifInOctets.128 = Counter32: 0
IF-MIB::ifInOctets.129 = Counter32: 0
IF-MIB::ifInOctets.130 = Counter32: 1651777366
IF-MIB::ifInOctets.131 = Counter32: 0
IF-MIB::ifInOctets.132 = Counter32: 3108279582

5.2查看某个端口的上行流量

[root@web4 /usr/local/zabbix/bin]#snmpwalk X.X.X.X -v 2c -c hdcx  ifOutOctets.130 
IF-MIB::ifOutOctets.130 = Counter32: 733101453

5.3查看某个端口的下行流量

[root@web4 /usr/local/zabbix/bin]#snmpwalk X.X.X.X -v 2c -c hdcx  ifInOctets.130 
IF-MIB::ifInOctets.130 = Counter32: 2631273837

5.4 注意了

交换机只提供了两个MIB值 (ifInOctets,ifOutOctets )表示交换机的上行和下行流量,并且这个流量是该端口累加的流量(顺便说一下count32到最大值的时候自动规零)。面对这种情况,只有用(前值-后 值)/间隔,才能得到该端口的真时流量,所以在模板上的项目原型上,存储值是“差量(每秒速率)”


四、zabbix界面设置

1、按着链接博客导入

wKioL1ZdYpHj6EJyAAFdYVmemS8387.jpg


2、模板v1

h3c的S7006交换机端口在zabbix监控步聚_第2张图片

h3c的S7006交换机端口在zabbix监控步聚_第3张图片

h3c的S7006交换机端口在zabbix监控步聚_第4张图片

h3c的S7006交换机端口在zabbix监控步聚_第5张图片

3、由于交换体团体名设为hdcx,不是默认的public

h3c的S7006交换机端口在zabbix监控步聚_第6张图片


4、创建主机

h3c的S7006交换机端口在zabbix监控步聚_第7张图片

h3c的S7006交换机端口在zabbix监控步聚_第8张图片


5、查看数据

h3c的S7006交换机端口在zabbix监控步聚_第9张图片

h3c的S7006交换机端口在zabbix监控步聚_第10张图片