一、需求

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

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

wKiom1Zei2XhZVFjAAScx04moQA962.jpg

二、交换机设置public

1、设置设置交换机snmp Community

1
[S7006-A]snmp-agent community read hdcx

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

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


三、在zabbix服务器测试

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

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

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


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

1
2
3
[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、取得系统信息

1
2
3
4
5
6
7
8
9
10
[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、查看端口信息

1
2
3
4
5
6
7
8
[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获取端口所有流量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
[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查看某个端口的上行流量

1
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查看某个端口的下行流量

1
2
[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

wKioL1ZdZP2gpsbwAANQy8IacdM665.jpg

wKiom1ZdZP_hFpbeAAKppmCSC4M955.jpg

wKioL1ZdZQbQRzggAALP4RhsCx8831.jpg

wKiom1ZdZS-AMAvAAAO9HzfOTqk918.jpg

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

wKiom1ZdZcuiNsu3AAOd6DfuUfA847.jpg


4、创建主机

wKioL1ZdZCyjhhu3AAPoIftedHM070.jpg

wKiom1ZdY_XB_NDjAANDdwl0XaI591.jpg


5、查看数据

wKiom1ZdZi3gWRlTAAd0Re7ZUpE848.jpg

wKioL1ZdZsKwfIwJAAhfJ3R_syg816.jpg