-
Notifications
You must be signed in to change notification settings - Fork 0
/
extreme_wlc_graphite.php
261 lines (222 loc) · 8.25 KB
/
extreme_wlc_graphite.php
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?php
/**
* Get SNMP stats from Extreme WLC and insert into Graphite/Carbon.
*
* @author: Will Jones <[email protected]>
*/
include("config.php");
include("common.php");
if ($graphite_send) $fsock = fsockopen($graphite_ip, $graphite_port);
foreach ($controllers as $c_name => $ip) {
/**
* Total APs
*/
$wlc_total_ap = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.5.1.1.0", "INTEGER"));
sendGraphite("wlc_total_ap", $wlc_total_ap[0]);
/**
* Total Active APs
*/
$wlc_total_ap_act = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.5.2.1.0", "INTEGER"));
sendGraphite("wlc_total_ap_act", $wlc_total_ap_act[0]);
/**
* WLC Licence Capacity
*/
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.4.0", "Gauge32"));
sendGraphite("wlc_lic_available_ap", $temp[0]);
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.7.0", "Gauge32"));
sendGraphite("wlc_lic_ap_local", $temp[0]);
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.8.0", "Gauge32"));
sendGraphite("wlc_lic_ap_foreign", $temp[0]);
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.5.0", "Gauge32"));
sendGraphite("wlc_lic_available_radar", $temp[0]);
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.9.0", "Gauge32"));
sendGraphite("wlc_lic_ap_radar_local", $temp[0]);
$temp = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.1.10.0", "Gauge32"));
sendGraphite("wlc_lic_ap_radar_foreign", $temp[0]);
/**
* Total Associated Stations
*/
$wlc_total_sta = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.7.1.0", "INTEGER"));
sendGraphite("wlc_total_sta", $wlc_total_sta[0]);
/**
* Total Associated Stations by Protocol
*/
$wlc_total_sta_11a = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.1.0", "Gauge32"));
sendGraphite("wlc_total_sta_11a", $wlc_total_sta_11a[0]);
$wlc_total_sta_11b = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.2.0", "Gauge32"));
sendGraphite("wlc_total_sta_11b", $wlc_total_sta_11b[0]);
$wlc_total_sta_11g = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.3.0", "Gauge32"));
sendGraphite("wlc_total_sta_11g", $wlc_total_sta_11g[0]);
$wlc_total_sta_11n2 = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.4.0", "Gauge32"));
sendGraphite("wlc_total_sta_11n2", $wlc_total_sta_11n2[0]);
$wlc_total_sta_11n5 = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.5.0", "Gauge32"));
sendGraphite("wlc_total_sta_11n5", $wlc_total_sta_11n5[0]);
$wlc_total_sta_11ac = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.2.10.2.8.0", "Gauge32"));
sendGraphite("wlc_total_sta_11ac", $wlc_total_sta_11ac[0]);
/**
* RADAR Counters
*/
$active_threats = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.11.4.0", "Gauge32"));
sendGraphite("radar.active_threats", $active_threats[0]);
$friendly_aps = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.11.5.0", "Gauge32"));
sendGraphite("radar.friendly_ap_count", $friendly_aps[0]);
$uncat_aps = explode(" ", get_snmp("1.3.6.1.4.1.4329.15.3.11.6.0", "Gauge32"));
sendGraphite("radar.uncategorised_ap_count", $uncat_aps[0]);
}
/**
* 5 Sec Average CPU Utilsation
*/
$out = snmp2_real_walk($ip, $community, "1.3.6.1.4.1.5624.1.2.49.1.1.1.1.2");
foreach ($out as $key => $value) {
$tmp = explode(".",$key);
$cpu_id = $tmp[count($tmp)-1];
sendGraphite("cpu_util.5sec.cpu_{$cpu_id}", sanatize_snmp("INTEGER", $value));
}
/**
* 1 Min Average CPU Utilsation
*/
$out = snmp2_real_walk($ip, $community, "1.3.6.1.4.1.5624.1.2.49.1.1.1.1.3");
foreach ($out as $key => $value) {
$tmp = explode(".",$key);
$cpu_id = $tmp[count($tmp)-1];
sendGraphite("cpu_util.1min.cpu_{$cpu_id}", sanatize_snmp("INTEGER", $value));
}
/**
* 5 Min Average CPU Utilsation
*/
$out = snmp2_real_walk($ip, $community, "1.3.6.1.4.1.5624.1.2.49.1.1.1.1.4");
foreach ($out as $key => $value) {
$tmp = explode(".",$key);
$cpu_id = $tmp[count($tmp)-1];
sendGraphite("cpu_util.5min.cpu_{$cpu_id}", sanatize_snmp("INTEGER", $value));
}
/**
* WLC Memory
*/
$total_memory = explode(" ", get_snmp("1.3.6.1.4.1.5624.1.2.49.1.3.1.1.4.1.2.0", "Gauge32"));
sendGraphite("wlc_total_memory", $total_memory[0]);
$free_memory = explode(" ", get_snmp("1.3.6.1.4.1.5624.1.2.49.1.3.1.1.5.1.2.0", "Gauge32"));
sendGraphite("wlc_free_memory", $free_memory[0]);
/**
* Number of Radios per Channel
*/
$out = snmp2_real_walk($ip, $community, "1.3.6.1.4.1.4329.15.3.2.10.3.1.2");
foreach ($out as $key => $value) {
$tmp = explode(".",$key);
$channel = $tmp[count($tmp)-1];
sendGraphite("rf.{$channel}", sanatize_snmp("Gauge32", $value));
}
/**
* Clients per ESS
*/
$ess = getEssTable();
$clientsPerEss = getClientsPerEss($ess);
foreach ($clientsPerEss as $ess => $no) {
sendGraphite("assoc.ess." . $ess, $no);
}
/**
* Clients per AP per Protocol
*/
$ap = getApTable();
$ClientsPerAp = getClientsPerAp($ap);
$Clients11aPerAp = get11aClientsPerAp($ap);
$Clients11bPerAp = get11bClientsPerAp($ap);
$Clients11gPerAp = get11gClientsPerAp($ap);
$Clients11n5PerAp = get11n5ClientsPerAp($ap);
$Clients11n2PerAp = get11n2ClientsPerAp($ap);
$Clients11acPerAp = get11acClientsPerAp($ap);
foreach ($ClientsPerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".total", $no);
}
foreach ($Clients11aPerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11a", $no);
}
foreach ($Clients11bPerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11b", $no);
}
foreach ($Clients11gPerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11g", $no);
}
foreach ($Clients11n5PerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11n5", $no);
}
foreach ($Clients11n2PerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11n2", $no);
}
foreach ($Clients11acPerAp as $ap => $no) {
sendGraphite("assoc.ap." . $ap . ".11ac", $no);
}
/**
* Tx+Rx Octets per AP per Protocol
*/
$ap = getApTable();
$TxOctPerAp = getTxOctPerAp($ap);
$RxOctPerAp = getRxOctPerAp($ap);
$TxOct11aPerAp = getTxOct11aPerAp($ap);
$RxOct11aPerAp = getRxOct11aPerAp($ap);
$TxOct11bPerAp = getTxOct11bPerAp($ap);
$RxOct11bPerAp = getRxOct11bPerAp($ap);
$TxOct11gPerAp = getTxOct11gPerAp($ap);
$RxOct11gPerAp = getRxOct11gPerAp($ap);
$TxOct11n2PerAp = getTxOct11n2PerAp($ap);
$RxOct11n2PerAp = getRxOct11n2PerAp($ap);
$TxOct11n5PerAp = getTxOct11n5PerAp($ap);
$RxOct11n5PerAp = getRxOct11n5PerAp($ap);
$TxOct11acPerAp = getTxOct11acPerAp($ap);
$RxOct11acPerAp = getRxOct11acPerAp($ap);
foreach ($TxOctPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".total-tx", $no);
}
foreach ($RxOctPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".total-rx", $no);
}
foreach ($TxOct11aPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11a-tx", $no);
}
foreach ($RxOct11aPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11a-rx", $no);
}
foreach ($TxOct11bPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11b-tx", $no);
}
foreach ($RxOct11bPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11b-rx", $no);
}
foreach ($TxOct11gPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11g-tx", $no);
}
foreach ($RxOct11gPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11g-rx", $no);
}
foreach ($TxOct11n2PerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11n2-tx", $no);
}
foreach ($RxOct11n2PerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11n2-rx", $no);
}
foreach ($TxOct11n5PerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11n5-tx", $no);
}
foreach ($RxOct11n5PerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11n5-rx", $no);
}
foreach ($TxOct11acPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11ac-tx", $no);
}
foreach ($RxOct11acPerAp as $ap => $no) {
sendGraphite("bytes.ap." . $ap . ".11ac-rx", $no);
}
/**
* Tx+Rx Octets per Toplogy
*/
$topology = getTopologyTable();
$TxOctPerToplogy = getTxOctPerTopology($topology);
$RxOctPerToplogy = getRxOctPerTopology($toploogy);
foreach ($TxOctPerToplogy as $topology => $no) {
sendGraphite("bytes.topology." . $topology . ".tx", $no);
}
foreach ($RxOctPerToplogy as $topology => $no) {
sendGraphite("bytes.topology." . $topology . ".rx", $no);
}
if ($graphite_send) fclose($fsock);
?>