1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
status_rrd_graph_img.php
|
5
|
Part of pfSense
|
6
|
Copyright (C) 2009 Seth Mos <seth.mos@dds.nl>
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
/*
|
31
|
pfSense_BUILDER_BINARIES: /bin/rm /usr/local/bin/rrdtool
|
32
|
pfSense_MODULE: system
|
33
|
*/
|
34
|
|
35
|
require_once("globals.inc");
|
36
|
require_once("guiconfig.inc");
|
37
|
require_once("filter.inc");
|
38
|
require_once("shaper.inc");
|
39
|
require_once("rrd.inc");
|
40
|
|
41
|
global $g;
|
42
|
|
43
|
$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
|
44
|
|
45
|
if ($_GET['database']) {
|
46
|
$curdatabase = basename($_GET['database']);
|
47
|
$curdatabase = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($curdatabase, ENT_QUOTES | ENT_HTML401));
|
48
|
} else {
|
49
|
$curdatabase = "wan-traffic.rrd";
|
50
|
}
|
51
|
|
52
|
if ($_GET['style']) {
|
53
|
$curstyle = $_GET['style'];
|
54
|
} else {
|
55
|
$curstyle = "inverse";
|
56
|
}
|
57
|
|
58
|
/* this is used for temp name */
|
59
|
if ($_GET['graph']) {
|
60
|
$curgraph = str_replace(array("<", ">", ";", "&", "'", '"', '.', '/'), "", htmlspecialchars_decode($_GET['graph'], ENT_QUOTES | ENT_HTML401));
|
61
|
} else {
|
62
|
$curgraph = "custom";
|
63
|
}
|
64
|
|
65
|
$now = time();
|
66
|
|
67
|
if (is_numeric($_GET['start'])) {
|
68
|
$start = $_GET['start'];
|
69
|
} else {
|
70
|
$start = $now - (8 * 3600);
|
71
|
}
|
72
|
|
73
|
if (is_numeric($_GET['end'])) {
|
74
|
$end = $_GET['end'];
|
75
|
} else {
|
76
|
$end = $now;
|
77
|
}
|
78
|
|
79
|
/* this should never happen */
|
80
|
if($end < $start) {
|
81
|
log_error("start $start is smaller than end $end");
|
82
|
$end = $now;
|
83
|
}
|
84
|
|
85
|
$seconds = $end - $start;
|
86
|
|
87
|
$scales = array();
|
88
|
$scales[14400] = "MINUTE:5:MINUTE:10:MINUTE:30:0:%H%:%M";
|
89
|
$scales[57600] = "MINUTE:30:HOUR:1:HOUR:1:0:%H";
|
90
|
$scales[172800] = "HOUR:1:HOUR:6:HOUR:2:0:%H";
|
91
|
$scales[691200] = "HOUR:2:HOUR:12:DAY:1:0:%D %d";
|
92
|
$scales[2764800] = "DAY:1:WEEK:1:WEEK:1:0:Week %W";
|
93
|
$scales[16070400] = "WEEK:1:MONTH:1:MONTH:1:0:%b";
|
94
|
$scales[42854400] = "MONTH:1:MONTH:1:MONTH:1:0:%b";
|
95
|
|
96
|
$archives = array();
|
97
|
$archives[1] = 1200;
|
98
|
$archives[5] = 720;
|
99
|
$archives[60] = 1860;
|
100
|
$archives[1440] = 2284;
|
101
|
|
102
|
$defOptions = array(
|
103
|
'to' => 1,
|
104
|
'parts' => 1,
|
105
|
'precision' => 'minute',
|
106
|
'distance' => FALSE,
|
107
|
'separator' => ', '
|
108
|
);
|
109
|
|
110
|
/* always set the average to the highest value as a fallback */
|
111
|
$average = 1440 * 60;
|
112
|
foreach($archives as $rra => $value) {
|
113
|
$archivestart = $now - ($rra * 60 * $value);
|
114
|
if($archivestart <= $start) {
|
115
|
$average = $rra * 60;
|
116
|
break;
|
117
|
}
|
118
|
}
|
119
|
|
120
|
foreach($scales as $scalelength => $value) {
|
121
|
if($scalelength >= $seconds) {
|
122
|
$scale = $value;
|
123
|
break;
|
124
|
}
|
125
|
}
|
126
|
|
127
|
// log_error("start $start, end $end, archivestart $archivestart, average $average, scale $scale, seconds $seconds");
|
128
|
|
129
|
/* Deduce a interface if possible and use the description */
|
130
|
$curif = explode("-", $curdatabase);
|
131
|
$curif = "$curif[0]";
|
132
|
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($curif));
|
133
|
if($friendly == "") {
|
134
|
$friendly = $curif;
|
135
|
}
|
136
|
$search = array("-", ".rrd", $curif);
|
137
|
$replace = array(" :: ", "", $friendly);
|
138
|
$prettydb = ucwords(str_replace($search, $replace, $curdatabase));
|
139
|
|
140
|
|
141
|
$rrddbpath = "/var/db/rrd/";
|
142
|
$rrdtmppath = "/tmp/";
|
143
|
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
144
|
$uptime = "/usr/bin/uptime";
|
145
|
$sed = "/usr/bin/sed";
|
146
|
|
147
|
$havg = timeDiff($average, $defOptions);
|
148
|
$hperiod = timeDiff($seconds, $defOptions);
|
149
|
$data = true;
|
150
|
|
151
|
/* Don't leave it up to RRD Tool to select the RRA and resolution to use. */
|
152
|
/* Specify the RRA and resolution to use per the graph havg value. */
|
153
|
switch ($havg) {
|
154
|
case "1 minute": $step = 60; break;
|
155
|
case "5 minutes": $step = 300; break;
|
156
|
case "1 hour": $step = 3600; break;
|
157
|
case "1 day": $step = 86400; break;
|
158
|
default: $step = 0; break;
|
159
|
}
|
160
|
|
161
|
$rrddbpath = "/var/db/rrd/";
|
162
|
chdir($rrddbpath);
|
163
|
$databases = glob("*.rrd");
|
164
|
rsort($databases);
|
165
|
|
166
|
/* compare bytes/sec counters, divide bps by 8 */
|
167
|
read_altq_config();
|
168
|
if ($altq_list_queues[$curif]) {
|
169
|
$altq =& $altq_list_queues[$curif];
|
170
|
switch ($altq->GetBwscale()) {
|
171
|
case "Gb":
|
172
|
$factor = 1024 * 1024 * 1024;
|
173
|
break;
|
174
|
case "Mb":
|
175
|
$factor = 1024 * 1024;
|
176
|
break;
|
177
|
case "Kb":
|
178
|
$factor = 1024;
|
179
|
break;
|
180
|
case "b":
|
181
|
default:
|
182
|
$factor = 1;
|
183
|
break;
|
184
|
}
|
185
|
$upstream = (($altq->GetBandwidth()*$factor)/8);
|
186
|
if ($upstream != 0)
|
187
|
$downstream = $upstream; /* XXX: Ugly hack */
|
188
|
else
|
189
|
$downstream = $upstream = 12500000;
|
190
|
$upif = $curif;
|
191
|
$downif = "lan"; /* XXX should this be set to something else?! */
|
192
|
} else {
|
193
|
$altq = null;
|
194
|
$downstream = 12500000;
|
195
|
$upstream = 12500000;
|
196
|
$upif = "wan";
|
197
|
$downif = "lan";
|
198
|
}
|
199
|
|
200
|
$speedlimit = ($upstream + $downstream);
|
201
|
|
202
|
/* Set default colors explicitly, the theme can then override them below.
|
203
|
This prevents missing colors in themes from crashing the graphs. */
|
204
|
/* Traffic Outbound Out-P-4, Out-B-4, Out-P-6, Out-B-6 */
|
205
|
$colortrafficup = array('666666', 'CCCCCC', '2217AA', '625AE7');
|
206
|
|
207
|
/* Traffic Inbound In-P-4, In-B-4, In-P-6, In-B-6 */
|
208
|
$colortrafficdown = array('990000', 'CC0000', 'FFC875', 'FF9900');
|
209
|
|
210
|
/* Packets Outbound Out-P-4, Out-B-4, Out-P-6, Out-B-6 */
|
211
|
$colorpacketsup = array('666666', 'CCCCCC', '2217AA', '625AE7');
|
212
|
|
213
|
/* Packets Inbound In-P-4, In-B-4, In-P-6, In-B-6 */
|
214
|
$colorpacketsdown = array('990000', 'CC0000', 'FFC875', 'FF9900');
|
215
|
|
216
|
/* 95th Percentile Lines Out, In */
|
217
|
$colortraffic95 = array('660000', 'FF0000');
|
218
|
|
219
|
/* State Table pfrate, pfstates, pfnat, srcip, dstip */
|
220
|
$colorstates = array('00AA00','990000','0000FF','000000','DD9B00');
|
221
|
|
222
|
/* Processor Usage user, nice, system, int, processes */
|
223
|
$colorprocessor = array('00AA00','990000','0000FF','DD9B00','000000');
|
224
|
|
225
|
/* Memory Usage active, inact, free, cache, wire */
|
226
|
$colormemory = array('00AA00','990000','0000FF','666666','DD9B00');
|
227
|
|
228
|
/* MBUF Usage current, cache, total, max */
|
229
|
$colormbuf = array('0080FF','00E344','FF0000','000000');
|
230
|
|
231
|
/* Traffic Shaper Queues q1, q2, q3, q4, q5, q6, q7, q8, q9 */
|
232
|
$colorqueuesup = array('000000','7B0000','0080FF','00E344','FF0000','2217AA','FFC875','FF9900','CC0000');
|
233
|
$colorqueuesdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC');
|
234
|
|
235
|
$colorqueuesdropup = array('000000','7B0000','0080FF','00E344','FF0000','2217AA','FFC875','FF9900','CC0000');
|
236
|
$colorqueuesdropdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC');
|
237
|
|
238
|
/* Quality Graph Delay >420, 180-420, 60-180, 20-60, <20, Delay Avg */
|
239
|
$colorqualityrtt = array('990000','a83c3c','b36666','bd9090','cccccc','000000');
|
240
|
/* Quality Graph Loss */
|
241
|
$colorqualityloss = 'ee0000';
|
242
|
|
243
|
/* Wireless Graph SNR, Rate, Channel*/
|
244
|
/* Cellular Graph RSSI, */
|
245
|
$colorwireless = array('333333','a83c3c','999999');
|
246
|
|
247
|
/* SPAMD Times min area, avg area, max area, Time line */
|
248
|
$colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066');
|
249
|
/* SPAMD Connections max area, min area, min line, max line, avg line */
|
250
|
$colorspamdconn = array('AA00BB', 'FFFFFF', '660088', 'FFFF88', '006600');
|
251
|
|
252
|
/* OpenVPN Users Online Users */
|
253
|
$colorvpnusers = array('990000');
|
254
|
|
255
|
/* NTPD stats offset, clk jit, sys jit, wander */
|
256
|
$colorntpd = array('0080FF','00E344','FF0000','000000');
|
257
|
|
258
|
/* Captive Portal Total Users Total Users */
|
259
|
/* Captive Portal Concurrent Concurrent Users */
|
260
|
$colorcaptiveportalusers = array('990000');
|
261
|
|
262
|
/* select theme colors if the inclusion file exists */
|
263
|
$rrdcolors = "{$g['www_path']}/themes/{$g['theme']}/rrdcolors.inc.php";
|
264
|
if(file_exists($rrdcolors)) {
|
265
|
include($rrdcolors);
|
266
|
} else {
|
267
|
log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme']));
|
268
|
}
|
269
|
|
270
|
switch ($curstyle) {
|
271
|
case "absolute":
|
272
|
$multiplier = 1;
|
273
|
$AREA = "LINE1";
|
274
|
break;
|
275
|
default:
|
276
|
$multiplier = -1;
|
277
|
$AREA = "AREA";
|
278
|
break;
|
279
|
}
|
280
|
|
281
|
function timeDiff($time, $opt = array()) {
|
282
|
// The default values
|
283
|
$defOptions = array(
|
284
|
'to' => 0,
|
285
|
'parts' => 1,
|
286
|
'precision' => 'second',
|
287
|
'distance' => TRUE,
|
288
|
'separator' => ', '
|
289
|
);
|
290
|
$opt = array_merge($defOptions, $opt);
|
291
|
// Default to current time if no to point is given
|
292
|
(!$opt['to']) && ($opt['to'] = time());
|
293
|
// Init an empty string
|
294
|
$str = '';
|
295
|
// To or From computation
|
296
|
$diff = ($opt['to'] > $time) ? $opt['to'] - $time : $time - $opt['to'];
|
297
|
// An array of label => periods of seconds;
|
298
|
$periods = array(
|
299
|
'decade' => 315569260,
|
300
|
'year' => 31539600,
|
301
|
'month' => 2629744,
|
302
|
'week' => 604800,
|
303
|
'day' => 86400,
|
304
|
'hour' => 3600,
|
305
|
'minute' => 60,
|
306
|
'second' => 1
|
307
|
);
|
308
|
// 31539600, 31556926, 31622400
|
309
|
// Round to precision
|
310
|
if ($opt['precision'] != 'second')
|
311
|
$diff = round(($diff / $periods[$opt['precision']])) * $periods[$opt['precision']];
|
312
|
// Report the value is 'less than 1 ' precision period away
|
313
|
(0 == $diff) && ($str = 'less than 1 ' . $opt['precision']);
|
314
|
// Loop over each period
|
315
|
foreach ($periods as $label => $value) {
|
316
|
// Stitch together the time difference string
|
317
|
(($x = round($diff / $value)) && $opt['parts']--) && $str .= ($str ? $opt['separator'] : '') . ($x .' '. $label. ($x > 1 ? 's' : ''));
|
318
|
// Stop processing if no more parts are going to be reported.
|
319
|
if ($opt['parts'] == 0 || $label == $opt['precision']) break;
|
320
|
// Get ready for the next pass
|
321
|
$diff -= $x * $value;
|
322
|
}
|
323
|
$opt['distance'] && $str .= ($str && $opt['to'] >= $time) ? ' ago' : ' away';
|
324
|
return $str;
|
325
|
}
|
326
|
|
327
|
|
328
|
if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
329
|
/* define graphcmd for traffic stats */
|
330
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
331
|
$graphcmd .= "--start $start --end $end --step $step --vertical-label \"bits/sec\" ";
|
332
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
333
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
334
|
$graphcmd .= "--height 200 --width 620 ";
|
335
|
$graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step ";
|
336
|
$graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step ";
|
337
|
$graphcmd .= "DEF:$curif-in_bytes_block=$rrddbpath$curdatabase:inblock:AVERAGE:step=$step ";
|
338
|
$graphcmd .= "DEF:$curif-out_bytes_block=$rrddbpath$curdatabase:outblock:AVERAGE:step=$step ";
|
339
|
|
340
|
$graphcmd .= "DEF:$curif-in6_bytes_pass=$rrddbpath$curdatabase:inpass6:AVERAGE:step=$step ";
|
341
|
$graphcmd .= "DEF:$curif-out6_bytes_pass=$rrddbpath$curdatabase:outpass6:AVERAGE:step=$step ";
|
342
|
$graphcmd .= "DEF:$curif-in6_bytes_block=$rrddbpath$curdatabase:inblock6:AVERAGE:step=$step ";
|
343
|
$graphcmd .= "DEF:$curif-out6_bytes_block=$rrddbpath$curdatabase:outblock6:AVERAGE:step=$step ";
|
344
|
|
345
|
$graphcmd .= "CDEF:\"$curif-in_bits_pass=$curif-in_bytes_pass,8,*\" ";
|
346
|
$graphcmd .= "CDEF:\"$curif-out_bits_pass=$curif-out_bytes_pass,8,*\" ";
|
347
|
$graphcmd .= "CDEF:\"$curif-in_bits_block=$curif-in_bytes_block,8,*\" ";
|
348
|
$graphcmd .= "CDEF:\"$curif-out_bits_block=$curif-out_bytes_block,8,*\" ";
|
349
|
|
350
|
$graphcmd .= "CDEF:\"$curif-in6_bits_pass=$curif-in6_bytes_pass,8,*\" ";
|
351
|
$graphcmd .= "CDEF:\"$curif-out6_bits_pass=$curif-out6_bytes_pass,8,*\" ";
|
352
|
$graphcmd .= "CDEF:\"$curif-in6_bits_block=$curif-in6_bytes_block,8,*\" ";
|
353
|
$graphcmd .= "CDEF:\"$curif-out6_bits_block=$curif-out6_bytes_block,8,*\" ";
|
354
|
|
355
|
$graphcmd .= "CDEF:\"$curif-in_bytes=$curif-in_bytes_pass,$curif-in_bytes_block,+\" ";
|
356
|
$graphcmd .= "CDEF:\"$curif-out_bytes=$curif-out_bytes_pass,$curif-out_bytes_block,+\" ";
|
357
|
$graphcmd .= "CDEF:\"$curif-in_bits=$curif-in_bits_pass,$curif-in_bits_block,+\" ";
|
358
|
$graphcmd .= "CDEF:\"$curif-out_bits=$curif-out_bits_pass,$curif-out_bits_block,+\" ";
|
359
|
|
360
|
$graphcmd .= "CDEF:\"$curif-in6_bytes=$curif-in6_bytes_pass,$curif-in6_bytes_block,+\" ";
|
361
|
$graphcmd .= "CDEF:\"$curif-out6_bytes=$curif-out6_bytes_pass,$curif-out6_bytes_block,+\" ";
|
362
|
$graphcmd .= "CDEF:\"$curif-in6_bits=$curif-in6_bits_pass,$curif-in6_bits_block,+\" ";
|
363
|
$graphcmd .= "CDEF:\"$curif-out6_bits=$curif-out6_bits_pass,$curif-out6_bits_block,+\" ";
|
364
|
|
365
|
$graphcmd .= "CDEF:\"$curif-bits_io=$curif-in_bits,$curif-out_bits,+\" ";
|
366
|
$graphcmd .= "CDEF:\"$curif-out_bits_block_neg=$curif-out_bits_block,$multiplier,*\" ";
|
367
|
$graphcmd .= "CDEF:\"$curif-out_bits_pass_neg=$curif-out_bits_pass,$multiplier,*\" ";
|
368
|
|
369
|
$graphcmd .= "CDEF:\"$curif-bits6_io=$curif-in6_bits,$curif-out6_bits,+\" ";
|
370
|
$graphcmd .= "CDEF:\"$curif-out6_bits_block_neg=$curif-out6_bits_block,$multiplier,*\" ";
|
371
|
$graphcmd .= "CDEF:\"$curif-out6_bits_pass_neg=$curif-out6_bits_pass,$multiplier,*\" ";
|
372
|
|
373
|
$graphcmd .= "CDEF:\"$curif-bytes_in_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$average,*\" ";
|
374
|
$graphcmd .= "CDEF:\"$curif-bytes_out_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$average,*\" ";
|
375
|
$graphcmd .= "CDEF:\"$curif-bytes_in_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$average,*\" ";
|
376
|
$graphcmd .= "CDEF:\"$curif-bytes_out_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$average,*\" ";
|
377
|
|
378
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$average,*\" ";
|
379
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$average,*\" ";
|
380
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$average,*\" ";
|
381
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$average,*\" ";
|
382
|
|
383
|
$graphcmd .= "CDEF:\"$curif-bytes_pass=$curif-bytes_in_pass,$curif-bytes_out_pass,+\" ";
|
384
|
$graphcmd .= "CDEF:\"$curif-bytes_block=$curif-bytes_in_block,$curif-bytes_out_block,+\" ";
|
385
|
|
386
|
$graphcmd .= "CDEF:\"$curif-bytes_pass6=$curif-bytes_in6_pass,$curif-bytes_out6_pass,+\" ";
|
387
|
$graphcmd .= "CDEF:\"$curif-bytes_block6=$curif-bytes_in6_block,$curif-bytes_out6_block,+\" ";
|
388
|
|
389
|
$graphcmd .= "CDEF:\"$curif-bytes_in_t_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$seconds,*\" ";
|
390
|
$graphcmd .= "CDEF:\"$curif-bytes_out_t_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$seconds,*\" ";
|
391
|
$graphcmd .= "CDEF:\"$curif-bytes_in_t_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$seconds,*\" ";
|
392
|
$graphcmd .= "CDEF:\"$curif-bytes_out_t_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$seconds,*\" ";
|
393
|
|
394
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_t_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$seconds,*\" ";
|
395
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_t_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$seconds,*\" ";
|
396
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_t_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$seconds,*\" ";
|
397
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_t_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$seconds,*\" ";
|
398
|
|
399
|
$graphcmd .= "CDEF:\"$curif-bytes_t_pass=$curif-bytes_in_t_pass,$curif-bytes_out_t_pass,+\" ";
|
400
|
$graphcmd .= "CDEF:\"$curif-bytes_t_block=$curif-bytes_in_t_block,$curif-bytes_out_t_block,+\" ";
|
401
|
$graphcmd .= "CDEF:\"$curif-bytes_t=$curif-bytes_t_pass,$curif-bytes_t_block,+\" ";
|
402
|
|
403
|
$graphcmd .= "CDEF:\"$curif-bytes_t_pass6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_pass,+\" ";
|
404
|
$graphcmd .= "CDEF:\"$curif-bytes_t_block6=$curif-bytes_in6_t_block,$curif-bytes_out6_t_block,+\" ";
|
405
|
$graphcmd .= "CDEF:\"$curif-bytes_t6=$curif-bytes_t_pass6,$curif-bytes_t_block6,+\" ";
|
406
|
$graphcmd .= "VDEF:\"$curif-in_bits_95=$curif-in_bits,95,PERCENT\" ";
|
407
|
$graphcmd .= "CDEF:\"$curif-out_bits_mul=$curif-out_bits,$multiplier,*\" ";
|
408
|
$perc = $multiplier > 0 ? "95" : "5";
|
409
|
$graphcmd .= "VDEF:\"$curif-out_bits_95=$curif-out_bits_mul,{$perc},PERCENT\" ";
|
410
|
|
411
|
$graphcmd .= "AREA:\"$curif-in_bits_block#{$colortrafficdown[1]}:$curif-in-block\" ";
|
412
|
$graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" ";
|
413
|
$graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block:STACK\" ";
|
414
|
$graphcmd .= "AREA:\"$curif-in6_bits_pass#{$colortrafficdown[2]}:$curif-in6-pass:STACK\" ";
|
415
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
416
|
|
417
|
$graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" ";
|
418
|
$graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" ";
|
419
|
$graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block:STACK\" ";
|
420
|
$graphcmd .= "{$AREA}:\"$curif-out6_bits_pass_neg#{$colortrafficup[2]}:$curif-out6-pass:STACK\" ";
|
421
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
422
|
$graphcmd .= "HRULE:\"$curif-in_bits_95#{$colortraffic95[1]}:$curif-in (95%)\" ";
|
423
|
$graphcmd .= "HRULE:\"$curif-out_bits_95#{$colortraffic95[0]}:$curif-out (95%)\" ";
|
424
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
425
|
$graphcmd .= "COMMENT:\"\t\t\t\t maximum\t average\t\t current\t period\t 95th percentile\\n\" ";
|
426
|
$graphcmd .= "COMMENT:\"IPv4 in-pass\t\" ";
|
427
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:MAX:%7.2lf %sb/s\" ";
|
428
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
429
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
430
|
$graphcmd .= "GPRINT:\"$curif-bytes_in_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
431
|
$graphcmd .= "GPRINT:\"$curif-in_bits_95:%7.2lf %sb/s\" ";
|
432
|
|
433
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
434
|
$graphcmd .= "COMMENT:\"IPv4 out-pass\t\" ";
|
435
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:MAX:%7.2lf %sb/s\" ";
|
436
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
437
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
438
|
$graphcmd .= "GPRINT:\"$curif-bytes_out_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
439
|
$graphcmd .= "GPRINT:\"$curif-out_bits_95:%7.2lf %sb/s\" ";
|
440
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
441
|
$graphcmd .= "COMMENT:\"IPv4 in-block\t\" ";
|
442
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:MAX:%7.2lf %sb/s\" ";
|
443
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
444
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:LAST:%7.2lf %Sb/s\" ";
|
445
|
$graphcmd .= "GPRINT:\"$curif-bytes_in_t_block:AVERAGE:%7.2lf %sB i\" ";
|
446
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
447
|
$graphcmd .= "COMMENT:\"IPv4 out-block\t\" ";
|
448
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:MAX:%7.2lf %sb/s\" ";
|
449
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
450
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:LAST:%7.2lf %Sb/s\" ";
|
451
|
$graphcmd .= "GPRINT:\"$curif-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
|
452
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
453
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
454
|
$graphcmd .= "COMMENT:\"IPv6 in-pass\t\" ";
|
455
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:MAX:%7.2lf %sb/s\" ";
|
456
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
457
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
458
|
$graphcmd .= "GPRINT:\"$curif-bytes_in6_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
459
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
460
|
$graphcmd .= "COMMENT:\"IPv6 out-pass\t\" ";
|
461
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:MAX:%7.2lf %sb/s\" ";
|
462
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
463
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
464
|
$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
465
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
466
|
$graphcmd .= "COMMENT:\"IPv6 in-block\t\" ";
|
467
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:MAX:%7.2lf %sb/s\" ";
|
468
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
469
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:LAST:%7.2lf %Sb/s\" ";
|
470
|
$graphcmd .= "GPRINT:\"$curif-bytes_in6_t_block:AVERAGE:%7.2lf %sB i\" ";
|
471
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
472
|
$graphcmd .= "COMMENT:\"IPv6 out-block\t\" ";
|
473
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:MAX:%7.2lf %sb/s\" ";
|
474
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
475
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" ";
|
476
|
$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" ";
|
477
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
478
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
479
|
}
|
480
|
elseif(strstr($curdatabase, "-throughput.rrd")) {
|
481
|
/* define graphcmd for throughput stats */
|
482
|
/* this gathers all interface statistics, the database does not actually exist */
|
483
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
484
|
$graphcmd .= "--start $start --end $end --step $step ";
|
485
|
$graphcmd .= "--vertical-label \"bits/sec\" ";
|
486
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
487
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
488
|
$graphcmd .= "--height 200 --width 620 ";
|
489
|
|
490
|
$iflist = get_configured_interface_list();
|
491
|
$g = 0;
|
492
|
$operand = "";
|
493
|
$comma = "";
|
494
|
$graphtputbip = "";
|
495
|
$graphtputbop = "";
|
496
|
$graphtputbtp = "";
|
497
|
$graphtputbib = "";
|
498
|
$graphtputbob = "";
|
499
|
$graphtputbtb = "";
|
500
|
$graphtputbyip = "";
|
501
|
$graphtputbyop = "";
|
502
|
$graphtputbytp = "";
|
503
|
$graphtputbyib = "";
|
504
|
$graphtputbyob = "";
|
505
|
$graphtputbytb = "";
|
506
|
foreach($iflist as $ifname) {
|
507
|
/* collect all interface stats */
|
508
|
$graphcmd .= "DEF:\"{$ifname}-in_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:inpass:AVERAGE:step=$step\" ";
|
509
|
$graphcmd .= "DEF:\"{$ifname}-out_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:outpass:AVERAGE:step=$step\" ";
|
510
|
$graphcmd .= "DEF:\"{$ifname}-in_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:inblock:AVERAGE:step=$step\" ";
|
511
|
$graphcmd .= "DEF:\"{$ifname}-out_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:outblock:AVERAGE:step=$step\" ";
|
512
|
|
513
|
$graphcmd .= "CDEF:\"{$ifname}-in_bytes={$ifname}-in_bytes_pass,{$ifname}-in_bytes_block,+\" ";
|
514
|
$graphcmd .= "CDEF:\"{$ifname}-out_bytes={$ifname}-out_bytes_pass,{$ifname}-out_bytes_block,+\" ";
|
515
|
|
516
|
$graphcmd .= "CDEF:\"{$ifname}-in_bits_pass={$ifname}-in_bytes_pass,8,*\" ";
|
517
|
$graphcmd .= "CDEF:\"{$ifname}-out_bits_pass={$ifname}-out_bytes_pass,8,*\" ";
|
518
|
$graphcmd .= "CDEF:\"{$ifname}-bits_io_pass={$ifname}-in_bits_pass,{$ifname}-out_bits_pass,+\" ";
|
519
|
|
520
|
$graphcmd .= "CDEF:\"{$ifname}-in_bits_block={$ifname}-in_bytes_block,8,*\" ";
|
521
|
$graphcmd .= "CDEF:\"{$ifname}-out_bits_block={$ifname}-out_bytes_block,8,*\" ";
|
522
|
$graphcmd .= "CDEF:\"{$ifname}-bits_io_block={$ifname}-in_bits_block,{$ifname}-out_bits_block,+\" ";
|
523
|
|
524
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_pass={$ifname}-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_pass,IF,$average,*\" ";
|
525
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_pass={$ifname}-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_pass,IF,$average,*\" ";
|
526
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_block={$ifname}-in_bytes_block,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_block,IF,$average,*\" ";
|
527
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_block={$ifname}-out_bytes_block,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_block,IF,$average,*\" ";
|
528
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_pass={$ifname}-bytes_in_pass,{$ifname}-bytes_out_pass,+\" ";
|
529
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_block={$ifname}-bytes_in_pass,{$ifname}-bytes_out_block,+\" ";
|
530
|
|
531
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_t_pass={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_pass,IF,$seconds,*\" ";
|
532
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_t_block={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_block,IF,$seconds,*\" ";
|
533
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_t_pass={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_pass,IF,$seconds,*\" ";
|
534
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_t_block={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_block,IF,$seconds,*\" ";
|
535
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_t_pass={$ifname}-bytes_in_t_pass,{$ifname}-bytes_out_t_pass,+\" ";
|
536
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_t_block={$ifname}-bytes_in_t_block,{$ifname}-bytes_out_t_block,+\" ";
|
537
|
if ($g > 0) {
|
538
|
$operand .= ",+";
|
539
|
$comma = ",";
|
540
|
}
|
541
|
$graphtputbip .= "{$comma}{$ifname}-in_bits_pass";
|
542
|
$graphtputbop .= "{$comma}{$ifname}-out_bits_pass";
|
543
|
$graphtputbtp .= "{$comma}{$ifname}-bits_io_pass";
|
544
|
$graphtputbib .= "{$comma}{$ifname}-in_bits_block";
|
545
|
$graphtputbob .= "{$comma}{$ifname}-out_bits_block";
|
546
|
$graphtputbtb .= "{$comma}{$ifname}-bits_io_block";
|
547
|
$graphtputbyip .= "{$comma}{$ifname}-bytes_in_t_pass";
|
548
|
$graphtputbyop .= "{$comma}{$ifname}-bytes_out_t_pass";
|
549
|
$graphtputbyib .= "{$comma}{$ifname}-bytes_in_t_block";
|
550
|
$graphtputbyob .= "{$comma}{$ifname}-bytes_out_t_block";
|
551
|
$graphtputbytp .= "{$comma}{$ifname}-bytes_t_pass";
|
552
|
$graphtputbytb .= "{$comma}{$ifname}-bytes_t_block";
|
553
|
$g++;
|
554
|
}
|
555
|
$graphcmd .= "CDEF:\"tput-in_bits_pass={$graphtputbip}{$operand}\" ";
|
556
|
$graphcmd .= "CDEF:\"tput-out_bits_pass={$graphtputbop}{$operand}\" ";
|
557
|
$graphcmd .= "CDEF:\"tput-bits_io_pass={$graphtputbtp}{$operand}\" ";
|
558
|
|
559
|
$graphcmd .= "CDEF:\"tput-in_bits_block={$graphtputbib}{$operand}\" ";
|
560
|
$graphcmd .= "CDEF:\"tput-out_bits_block={$graphtputbob}{$operand}\" ";
|
561
|
$graphcmd .= "CDEF:\"tput-bits_io_block={$graphtputbtb}{$operand}\" ";
|
562
|
|
563
|
$graphcmd .= "CDEF:\"tput-out_bits_pass_neg=tput-out_bits_pass,$multiplier,*\" ";
|
564
|
$graphcmd .= "CDEF:\"tput-out_bits_block_neg=tput-out_bits_block,$multiplier,*\" ";
|
565
|
|
566
|
$graphcmd .= "CDEF:\"tput-bytes_in_t_pass={$graphtputbyip}{$operand}\" ";
|
567
|
$graphcmd .= "CDEF:\"tput-bytes_out_t_pass={$graphtputbyop}{$operand}\" ";
|
568
|
$graphcmd .= "CDEF:\"tput-bytes_t_pass={$graphtputbytp}{$operand}\" ";
|
569
|
|
570
|
$graphcmd .= "CDEF:\"tput-bytes_in_t_block={$graphtputbyib}{$operand}\" ";
|
571
|
$graphcmd .= "CDEF:\"tput-bytes_out_t_block={$graphtputbyob}{$operand}\" ";
|
572
|
$graphcmd .= "CDEF:\"tput-bytes_t_block={$graphtputbytb}{$operand}\" ";
|
573
|
|
574
|
$graphcmd .= "AREA:\"tput-in_bits_block#{$colortrafficdown[0]}:in-block \" ";
|
575
|
$graphcmd .= "AREA:\"tput-in_bits_pass#{$colortrafficdown[1]}:in-pass \" ";
|
576
|
|
577
|
$graphcmd .= "{$AREA}:\"tput-out_bits_block_neg#{$colortrafficup[1]}:out-block \" ";
|
578
|
$graphcmd .= "{$AREA}:\"tput-out_bits_pass_neg#{$colortrafficup[0]}:out-pass \" ";
|
579
|
|
580
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
581
|
$graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
|
582
|
$graphcmd .= "COMMENT:\"in-pass\t\" ";
|
583
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:MAX:%7.2lf %sb/s\" ";
|
584
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
585
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
586
|
$graphcmd .= "GPRINT:\"tput-bytes_in_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
587
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
588
|
$graphcmd .= "COMMENT:\"out-pass\t\" ";
|
589
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:MAX:%7.2lf %sb/s\" ";
|
590
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
591
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
592
|
$graphcmd .= "GPRINT:\"tput-bytes_out_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
593
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
594
|
$graphcmd .= "COMMENT:\"in-block\t\" ";
|
595
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:MAX:%7.2lf %sb/s\" ";
|
596
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
597
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:LAST:%7.2lf %Sb/s\" ";
|
598
|
$graphcmd .= "GPRINT:\"tput-bytes_in_t_block:AVERAGE:%7.2lf %sB i\" ";
|
599
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
600
|
$graphcmd .= "COMMENT:\"out-block\t\" ";
|
601
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:MAX:%7.2lf %sb/s\" ";
|
602
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
603
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:LAST:%7.2lf %Sb/s\" ";
|
604
|
$graphcmd .= "GPRINT:\"tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
|
605
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
606
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
607
|
}
|
608
|
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
609
|
/* define graphcmd for packets stats */
|
610
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
611
|
$graphcmd .= "--start $start --end $end --step $step ";
|
612
|
$graphcmd .= "--vertical-label \"packets/sec\" ";
|
613
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
614
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
615
|
$graphcmd .= "--height 200 --width 620 ";
|
616
|
$graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step\" ";
|
617
|
$graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step\" ";
|
618
|
$graphcmd .= "DEF:\"$curif-in_pps_block=$rrddbpath$curdatabase:inblock:AVERAGE:step=$step\" ";
|
619
|
$graphcmd .= "DEF:\"$curif-out_pps_block=$rrddbpath$curdatabase:outblock:AVERAGE:step=$step\" ";
|
620
|
|
621
|
$graphcmd .= "DEF:\"$curif-in6_pps_pass=$rrddbpath$curdatabase:inpass6:AVERAGE:step=$step\" ";
|
622
|
$graphcmd .= "DEF:\"$curif-out6_pps_pass=$rrddbpath$curdatabase:outpass6:AVERAGE:step=$step\" ";
|
623
|
$graphcmd .= "DEF:\"$curif-in6_pps_block=$rrddbpath$curdatabase:inblock6:AVERAGE:step=$step\" ";
|
624
|
$graphcmd .= "DEF:\"$curif-out6_pps_block=$rrddbpath$curdatabase:outblock6:AVERAGE:step=$step\" ";
|
625
|
|
626
|
$graphcmd .= "CDEF:\"$curif-in_pps=$curif-in_pps_pass,$curif-in_pps_block,+\" ";
|
627
|
$graphcmd .= "CDEF:\"$curif-out_pps=$curif-out_pps_pass,$curif-out_pps_block,+\" ";
|
628
|
$graphcmd .= "CDEF:\"$curif-out_pps_pass_neg=$curif-out_pps_pass,$multiplier,*\" ";
|
629
|
$graphcmd .= "CDEF:\"$curif-out_pps_block_neg=$curif-out_pps_block,$multiplier,*\" ";
|
630
|
|
631
|
$graphcmd .= "CDEF:\"$curif-in6_pps=$curif-in6_pps_pass,$curif-in6_pps_block,+\" ";
|
632
|
$graphcmd .= "CDEF:\"$curif-out6_pps=$curif-out6_pps_pass,$curif-out6_pps_block,+\" ";
|
633
|
$graphcmd .= "CDEF:\"$curif-out6_pps_pass_neg=$curif-out6_pps_pass,$multiplier,*\" ";
|
634
|
$graphcmd .= "CDEF:\"$curif-out6_pps_block_neg=$curif-out6_pps_block,$multiplier,*\" ";
|
635
|
|
636
|
$graphcmd .= "CDEF:\"$curif-pps_in_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$average,*\" ";
|
637
|
$graphcmd .= "CDEF:\"$curif-pps_out_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$average,*\" ";
|
638
|
$graphcmd .= "CDEF:\"$curif-pps_in_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$average,*\" ";
|
639
|
$graphcmd .= "CDEF:\"$curif-pps_out_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$average,*\" ";
|
640
|
|
641
|
$graphcmd .= "CDEF:\"$curif-pps_in6_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$average,*\" ";
|
642
|
$graphcmd .= "CDEF:\"$curif-pps_out6_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$average,*\" ";
|
643
|
$graphcmd .= "CDEF:\"$curif-pps_in6_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$average,*\" ";
|
644
|
$graphcmd .= "CDEF:\"$curif-pps_out6_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$average,*\" ";
|
645
|
|
646
|
$graphcmd .= "CDEF:\"$curif-pps_io=$curif-in_pps,$curif-out_pps,+\" ";
|
647
|
$graphcmd .= "CDEF:\"$curif-pps_pass=$curif-pps_in_pass,$curif-pps_out_pass,+\" ";
|
648
|
$graphcmd .= "CDEF:\"$curif-pps_block=$curif-pps_in_block,$curif-pps_out_block,+\" ";
|
649
|
|
650
|
$graphcmd .= "CDEF:\"$curif-pps_io6=$curif-in6_pps,$curif-out6_pps,+\" ";
|
651
|
$graphcmd .= "CDEF:\"$curif-pps_pass6=$curif-pps_in6_pass,$curif-pps_out6_pass,+\" ";
|
652
|
$graphcmd .= "CDEF:\"$curif-pps_block6=$curif-pps_in6_block,$curif-pps_out6_block,+\" ";
|
653
|
|
654
|
$graphcmd .= "CDEF:\"$curif-pps_in_t_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$seconds,*\" ";
|
655
|
$graphcmd .= "CDEF:\"$curif-pps_out_t_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$seconds,*\" ";
|
656
|
$graphcmd .= "CDEF:\"$curif-pps_in_t_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$seconds,*\" ";
|
657
|
$graphcmd .= "CDEF:\"$curif-pps_out_t_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$seconds,*\" ";
|
658
|
|
659
|
$graphcmd .= "CDEF:\"$curif-pps_in6_t_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$seconds,*\" ";
|
660
|
$graphcmd .= "CDEF:\"$curif-pps_out6_t_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$seconds,*\" ";
|
661
|
$graphcmd .= "CDEF:\"$curif-pps_in6_t_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$seconds,*\" ";
|
662
|
$graphcmd .= "CDEF:\"$curif-pps_out6_t_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$seconds,*\" ";
|
663
|
|
664
|
$graphcmd .= "CDEF:\"$curif-pps_t_pass=$curif-pps_in_t_pass,$curif-pps_out_t_pass,+\" ";
|
665
|
$graphcmd .= "CDEF:\"$curif-pps_t_block=$curif-pps_in_t_block,$curif-pps_out_t_block,+\" ";
|
666
|
|
667
|
$graphcmd .= "CDEF:\"$curif-pps_t_pass6=$curif-pps_in6_t_pass,$curif-pps_out6_t_pass,+\" ";
|
668
|
$graphcmd .= "CDEF:\"$curif-pps_t_block6=$curif-pps_in6_t_block,$curif-pps_out6_t_block,+\" ";
|
669
|
|
670
|
$graphcmd .= "AREA:\"$curif-in_pps_block#{$colorpacketsdown[1]}:$curif-in-block\" ";
|
671
|
$graphcmd .= "AREA:\"$curif-in_pps_pass#{$colorpacketsdown[0]}:$curif-in-pass:STACK\" ";
|
672
|
$graphcmd .= "AREA:\"$curif-in6_pps_block#{$colorpacketsdown[3]}:$curif-in6-block:STACK\" ";
|
673
|
$graphcmd .= "AREA:\"$curif-in6_pps_pass#{$colorpacketsdown[2]}:$curif-in6-pass:STACK\" ";
|
674
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
675
|
$graphcmd .= "$AREA:\"$curif-out_pps_block_neg#{$colorpacketsup[1]}:$curif-out-block\" ";
|
676
|
$graphcmd .= "$AREA:\"$curif-out_pps_pass_neg#{$colorpacketsup[0]}:$curif-out-pass:STACK\" ";
|
677
|
$graphcmd .= "$AREA:\"$curif-out6_pps_block_neg#{$colorpacketsup[3]}:$curif-out6-block:STACK\" ";
|
678
|
$graphcmd .= "$AREA:\"$curif-out6_pps_pass_neg#{$colorpacketsup[2]}:$curif-out6-pass:STACK\" ";
|
679
|
|
680
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
681
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\t period\\n\" ";
|
682
|
$graphcmd .= "COMMENT:\"in-pass\t\" ";
|
683
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:MAX:%7.2lf %s pps\" ";
|
684
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
685
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:LAST:%7.2lf %S pps\" ";
|
686
|
$graphcmd .= "GPRINT:\"$curif-pps_in_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
687
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
688
|
$graphcmd .= "COMMENT:\"out-pass\t\" ";
|
689
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:MAX:%7.2lf %s pps\" ";
|
690
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
691
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:LAST:%7.2lf %S pps\" ";
|
692
|
$graphcmd .= "GPRINT:\"$curif-pps_out_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
693
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
694
|
$graphcmd .= "COMMENT:\"in-block\t\" ";
|
695
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:MAX:%7.2lf %s pps\" ";
|
696
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
697
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:LAST:%7.2lf %S pps\" ";
|
698
|
$graphcmd .= "GPRINT:\"$curif-pps_in_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
699
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
700
|
$graphcmd .= "COMMENT:\"out-block\t\" ";
|
701
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:MAX:%7.2lf %s pps\" ";
|
702
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
703
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" ";
|
704
|
$graphcmd .= "GPRINT:\"$curif-pps_out_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
705
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
706
|
|
707
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
708
|
$graphcmd .= "COMMENT:\"in-pass6\t\" ";
|
709
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:MAX:%7.2lf %s pps\" ";
|
710
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
711
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:LAST:%7.2lf %S pps\" ";
|
712
|
$graphcmd .= "GPRINT:\"$curif-pps_in6_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
713
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
714
|
$graphcmd .= "COMMENT:\"out-pass6\t\" ";
|
715
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:MAX:%7.2lf %s pps\" ";
|
716
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
717
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:LAST:%7.2lf %S pps\" ";
|
718
|
$graphcmd .= "GPRINT:\"$curif-pps_out6_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
719
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
720
|
$graphcmd .= "COMMENT:\"in-block6\t\" ";
|
721
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:MAX:%7.2lf %s pps\" ";
|
722
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
723
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:LAST:%7.2lf %S pps\" ";
|
724
|
$graphcmd .= "GPRINT:\"$curif-pps_in6_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
725
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
726
|
$graphcmd .= "COMMENT:\"out-pass6\t\" ";
|
727
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:MAX:%7.2lf %s pps\" ";
|
728
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
729
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" ";
|
730
|
$graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
731
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
732
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
733
|
}
|
734
|
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
735
|
/* define graphcmd for packets stats */
|
736
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
737
|
$graphcmd .= "--start $start --end $end --step $step ";
|
738
|
$graphcmd .= "--vertical-label \"snr/channel/rate\" ";
|
739
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
740
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
741
|
$graphcmd .= "--height 200 --width 620 ";
|
742
|
$graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE:step=$step\" ";
|
743
|
$graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE:step=$step\" ";
|
744
|
$graphcmd .= "DEF:\"$curif-channel=$rrddbpath$curdatabase:channel:AVERAGE:step=$step\" ";
|
745
|
$graphcmd .= "LINE2:\"$curif-snr#{$colorwireless[0]}:$curif-snr\" ";
|
746
|
$graphcmd .= "LINE2:\"$curif-rate#{$colorwireless[1]}:$curif-rate\" ";
|
747
|
$graphcmd .= "LINE2:\"$curif-channel#{$colorwireless[2]}:$curif-channel\" ";
|
748
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
749
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\\n\" ";
|
750
|
$graphcmd .= "COMMENT:\"SNR\t\t\" ";
|
751
|
$graphcmd .= "GPRINT:\"$curif-snr:MAX:%7.2lf dBi \" ";
|
752
|
$graphcmd .= "GPRINT:\"$curif-snr:AVERAGE:%7.2lf dBi \" ";
|
753
|
$graphcmd .= "GPRINT:\"$curif-snr:LAST:%7.2lf dBi\" ";
|
754
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
755
|
$graphcmd .= "COMMENT:\"RATE\t\t\" ";
|
756
|
$graphcmd .= "GPRINT:\"$curif-rate:MAX:%7.2lf Mb \" ";
|
757
|
$graphcmd .= "GPRINT:\"$curif-rate:AVERAGE:%7.2lf Mb \" ";
|
758
|
$graphcmd .= "GPRINT:\"$curif-rate:LAST:%7.2lf Mb\" ";
|
759
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
760
|
$graphcmd .= "COMMENT:\"Channel\t\" ";
|
761
|
$graphcmd .= "GPRINT:\"$curif-channel:MAX:%7.2lf \" ";
|
762
|
$graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf \" ";
|
763
|
$graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf\" ";
|
764
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
765
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
766
|
}
|
767
|
elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
768
|
/* define graphcmd for vpn users stats */
|
769
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
770
|
$graphcmd .= "--start $start --end $end --step $step ";
|
771
|
$graphcmd .= "--vertical-label \"users\" ";
|
772
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
773
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
774
|
$graphcmd .= "--height 200 --width 620 ";
|
775
|
$graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE:step=$step\" ";
|
776
|
$graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" ";
|
777
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
778
|
$graphcmd .= "COMMENT:\"\t\t\t maximum\t\t average\t current\\n\" ";
|
779
|
$graphcmd .= "COMMENT:\"Users Online\t\" ";
|
780
|
$graphcmd .= "GPRINT:\"$curif-users:MAX:%7.2lf \" ";
|
781
|
$graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf \" ";
|
782
|
$graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" ";
|
783
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
784
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
785
|
}
|
786
|
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
787
|
/* define graphcmd for states stats */
|
788
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
789
|
$graphcmd .= "--start -$seconds -e -$average --step $step ";
|
790
|
$graphcmd .= "--vertical-label \"states, ip\" ";
|
791
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
792
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
793
|
$graphcmd .= "--height 200 --width 620 ";
|
794
|
$graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE:step=$step\" ";
|
795
|
$graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE:step=$step\" ";
|
796
|
$graphcmd .= "DEF:\"$curif-pfnat=$rrddbpath$curdatabase:pfnat:AVERAGE:step=$step\" ";
|
797
|
$graphcmd .= "DEF:\"$curif-srcip=$rrddbpath$curdatabase:srcip:AVERAGE:step=$step\" ";
|
798
|
$graphcmd .= "DEF:\"$curif-dstip=$rrddbpath$curdatabase:dstip:AVERAGE:step=$step\" ";
|
799
|
$graphcmd .= "CDEF:\"$curif-pfrate_t=$curif-pfrate,0,1000000,LIMIT,UN,0,$curif-pfrate,IF,$seconds,*\" ";
|
800
|
$graphcmd .= "LINE1:\"$curif-pfrate#{$colorstates[0]}:$curif-pfrate\" ";
|
801
|
$graphcmd .= "LINE1:\"$curif-pfstates#{$colorstates[1]}:$curif-pfstates\" ";
|
802
|
$graphcmd .= "LINE1:\"$curif-pfnat#{$colorstates[2]}:$curif-pfnat\" ";
|
803
|
$graphcmd .= "LINE1:\"$curif-srcip#{$colorstates[3]}:$curif-srcip\" ";
|
804
|
$graphcmd .= "LINE1:\"$curif-dstip#{$colorstates[4]}:$curif-dstip\" ";
|
805
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
806
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current period\\n\" ";
|
807
|
$graphcmd .= "COMMENT:\"state changes\" ";
|
808
|
$graphcmd .= "GPRINT:\"$curif-pfrate:MIN:%7.2lf %s cps\" ";
|
809
|
$graphcmd .= "GPRINT:\"$curif-pfrate:AVERAGE:%7.2lf %s cps\" ";
|
810
|
$graphcmd .= "GPRINT:\"$curif-pfrate:MAX:%7.2lf %s cps\" ";
|
811
|
$graphcmd .= "GPRINT:\"$curif-pfrate:LAST:%7.2lf %S cps\" ";
|
812
|
$graphcmd .= "GPRINT:\"$curif-pfrate_t:AVERAGE:%7.2lf %s chg\" ";
|
813
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
814
|
$graphcmd .= "COMMENT:\"filter states\" ";
|
815
|
$graphcmd .= "GPRINT:\"$curif-pfstates:MIN:%7.2lf %s \" ";
|
816
|
$graphcmd .= "GPRINT:\"$curif-pfstates:AVERAGE:%7.2lf %s \" ";
|
817
|
$graphcmd .= "GPRINT:\"$curif-pfstates:MAX:%7.2lf %s \" ";
|
818
|
$graphcmd .= "GPRINT:\"$curif-pfstates:LAST:%7.2lf %s \" ";
|
819
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
820
|
$graphcmd .= "COMMENT:\"nat states \" ";
|
821
|
$graphcmd .= "GPRINT:\"$curif-pfnat:MIN:%7.2lf %s \" ";
|
822
|
$graphcmd .= "GPRINT:\"$curif-pfnat:AVERAGE:%7.2lf %s \" ";
|
823
|
$graphcmd .= "GPRINT:\"$curif-pfnat:MAX:%7.2lf %s \" ";
|
824
|
$graphcmd .= "GPRINT:\"$curif-pfnat:LAST:%7.2lf %s \" ";
|
825
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
826
|
$graphcmd .= "COMMENT:\"Source addr. \" ";
|
827
|
$graphcmd .= "GPRINT:\"$curif-srcip:MIN:%7.2lf %s \" ";
|
828
|
$graphcmd .= "GPRINT:\"$curif-srcip:AVERAGE:%7.2lf %s \" ";
|
829
|
$graphcmd .= "GPRINT:\"$curif-srcip:MAX:%7.2lf %s \" ";
|
830
|
$graphcmd .= "GPRINT:\"$curif-srcip:LAST:%7.2lf %s \" ";
|
831
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
832
|
$graphcmd .= "COMMENT:\"Dest. addr. \" ";
|
833
|
$graphcmd .= "GPRINT:\"$curif-dstip:MIN:%7.2lf %s \" ";
|
834
|
$graphcmd .= "GPRINT:\"$curif-dstip:AVERAGE:%7.2lf %s \" ";
|
835
|
$graphcmd .= "GPRINT:\"$curif-dstip:MAX:%7.2lf %s \" ";
|
836
|
$graphcmd .= "GPRINT:\"$curif-dstip:LAST:%7.2lf %s \" ";
|
837
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
838
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
839
|
}
|
840
|
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
841
|
/* define graphcmd for processor stats */
|
842
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
843
|
$graphcmd .= "--start $start --end $end --step $step ";
|
844
|
$graphcmd .= "--vertical-label \"utilization, number\" ";
|
845
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
846
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
847
|
$graphcmd .= "--height 200 --width 620 ";
|
848
|
$graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE:step=$step\" ";
|
849
|
$graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE:step=$step\" ";
|
850
|
$graphcmd .= "DEF:\"system=$rrddbpath$curdatabase:system:AVERAGE:step=$step\" ";
|
851
|
$graphcmd .= "DEF:\"interrupt=$rrddbpath$curdatabase:interrupt:AVERAGE:step=$step\" ";
|
852
|
$graphcmd .= "DEF:\"processes=$rrddbpath$curdatabase:processes:AVERAGE:step=$step\" ";
|
853
|
$graphcmd .= "AREA:\"user#{$colorprocessor[0]}:user\" ";
|
854
|
$graphcmd .= "AREA:\"nice#{$colorprocessor[1]}:nice:STACK\" ";
|
855
|
$graphcmd .= "AREA:\"system#{$colorprocessor[2]}:system:STACK\" ";
|
856
|
$graphcmd .= "AREA:\"interrupt#{$colorprocessor[3]}:interrupt:STACK\" ";
|
857
|
$graphcmd .= "LINE2:\"processes#{$colorprocessor[4]}:processes\" ";
|
858
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
859
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
860
|
$graphcmd .= "COMMENT:\"User util. \" ";
|
861
|
$graphcmd .= "GPRINT:\"user:MIN:%7.2lf %s \" ";
|
862
|
$graphcmd .= "GPRINT:\"user:AVERAGE:%7.2lf %s \" ";
|
863
|
$graphcmd .= "GPRINT:\"user:MAX:%7.2lf %s \" ";
|
864
|
$graphcmd .= "GPRINT:\"user:LAST:%7.2lf %S \" ";
|
865
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
866
|
$graphcmd .= "COMMENT:\"Nice util. \" ";
|
867
|
$graphcmd .= "GPRINT:\"nice:MIN:%7.2lf %s \" ";
|
868
|
$graphcmd .= "GPRINT:\"nice:AVERAGE:%7.2lf %s \" ";
|
869
|
$graphcmd .= "GPRINT:\"nice:MAX:%7.2lf %s \" ";
|
870
|
$graphcmd .= "GPRINT:\"nice:LAST:%7.2lf %s \" ";
|
871
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
872
|
$graphcmd .= "COMMENT:\"System util. \" ";
|
873
|
$graphcmd .= "GPRINT:\"system:MIN:%7.2lf %s \" ";
|
874
|
$graphcmd .= "GPRINT:\"system:AVERAGE:%7.2lf %s \" ";
|
875
|
$graphcmd .= "GPRINT:\"system:MAX:%7.2lf %s \" ";
|
876
|
$graphcmd .= "GPRINT:\"system:LAST:%7.2lf %s \" ";
|
877
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
878
|
$graphcmd .= "COMMENT:\"Interrupt \" ";
|
879
|
$graphcmd .= "GPRINT:\"interrupt:MIN:%7.2lf %s \" ";
|
880
|
$graphcmd .= "GPRINT:\"interrupt:AVERAGE:%7.2lf %s \" ";
|
881
|
$graphcmd .= "GPRINT:\"interrupt:MAX:%7.2lf %s \" ";
|
882
|
$graphcmd .= "GPRINT:\"interrupt:LAST:%7.2lf %s \" ";
|
883
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
884
|
$graphcmd .= "COMMENT:\"Processes \" ";
|
885
|
$graphcmd .= "GPRINT:\"processes:MIN:%7.2lf %s \" ";
|
886
|
$graphcmd .= "GPRINT:\"processes:AVERAGE:%7.2lf %s \" ";
|
887
|
$graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s \" ";
|
888
|
$graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s \" ";
|
889
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
890
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
891
|
}
|
892
|
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
893
|
/* define graphcmd for memory usage stats */
|
894
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
895
|
$graphcmd .= "--start $start --end $end --step $step ";
|
896
|
$graphcmd .= "--vertical-label \"utilization, percent\" ";
|
897
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
898
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
899
|
$graphcmd .= "--height 200 --width 620 ";
|
900
|
$graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE:step=$step\" ";
|
901
|
$graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE:step=$step\" ";
|
902
|
$graphcmd .= "DEF:\"free=$rrddbpath$curdatabase:free:AVERAGE:step=$step\" ";
|
903
|
$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
|
904
|
$graphcmd .= "DEF:\"wire=$rrddbpath$curdatabase:wire:AVERAGE:step=$step\" ";
|
905
|
$graphcmd .= "LINE2:\"active#{$colormemory[0]}:active\" ";
|
906
|
$graphcmd .= "LINE2:\"inactive#{$colormemory[1]}:inactive\" ";
|
907
|
$graphcmd .= "LINE2:\"free#{$colormemory[2]}:free\" ";
|
908
|
$graphcmd .= "LINE2:\"cache#{$colormemory[3]}:cache\" ";
|
909
|
$graphcmd .= "LINE2:\"wire#{$colormemory[4]}:wire\" ";
|
910
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
911
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
912
|
$graphcmd .= "COMMENT:\"Active. \" ";
|
913
|
$graphcmd .= "GPRINT:\"active:MIN:%7.2lf %s \" ";
|
914
|
$graphcmd .= "GPRINT:\"active:AVERAGE:%7.2lf %s \" ";
|
915
|
$graphcmd .= "GPRINT:\"active:MAX:%7.2lf %s \" ";
|
916
|
$graphcmd .= "GPRINT:\"active:LAST:%7.2lf %S \" ";
|
917
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
918
|
$graphcmd .= "COMMENT:\"Inactive. \" ";
|
919
|
$graphcmd .= "GPRINT:\"inactive:MIN:%7.2lf %s \" ";
|
920
|
$graphcmd .= "GPRINT:\"inactive:AVERAGE:%7.2lf %s \" ";
|
921
|
$graphcmd .= "GPRINT:\"inactive:MAX:%7.2lf %s \" ";
|
922
|
$graphcmd .= "GPRINT:\"inactive:LAST:%7.2lf %S \" ";
|
923
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
924
|
$graphcmd .= "COMMENT:\"Free. \" ";
|
925
|
$graphcmd .= "GPRINT:\"free:MIN:%7.2lf %s \" ";
|
926
|
$graphcmd .= "GPRINT:\"free:AVERAGE:%7.2lf %s \" ";
|
927
|
$graphcmd .= "GPRINT:\"free:MAX:%7.2lf %s \" ";
|
928
|
$graphcmd .= "GPRINT:\"free:LAST:%7.2lf %S \" ";
|
929
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
930
|
$graphcmd .= "COMMENT:\"Cached. \" ";
|
931
|
$graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" ";
|
932
|
$graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" ";
|
933
|
$graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" ";
|
934
|
$graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" ";
|
935
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
936
|
$graphcmd .= "COMMENT:\"Wired. \" ";
|
937
|
$graphcmd .= "GPRINT:\"wire:MIN:%7.2lf %s \" ";
|
938
|
$graphcmd .= "GPRINT:\"wire:AVERAGE:%7.2lf %s \" ";
|
939
|
$graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s \" ";
|
940
|
$graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S \" ";
|
941
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
942
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
943
|
}
|
944
|
elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
945
|
/* define graphcmd for mbuf usage stats */
|
946
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
947
|
$graphcmd .= "--start $start --end $end --step $step ";
|
948
|
$graphcmd .= "--vertical-label \"utilization, percent\" ";
|
949
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
950
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
|
951
|
$graphcmd .= "--height 200 --width 620 ";
|
952
|
$graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE:step=$step\" ";
|
953
|
$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
|
954
|
$graphcmd .= "DEF:\"total=$rrddbpath$curdatabase:total:AVERAGE:step=$step\" ";
|
955
|
$graphcmd .= "DEF:\"max=$rrddbpath$curdatabase:max:AVERAGE:step=$step\" ";
|
956
|
$graphcmd .= "LINE2:\"current#{$colormbuf[0]}:current\" ";
|
957
|
$graphcmd .= "LINE2:\"cache#{$colormbuf[1]}:cache\" ";
|
958
|
$graphcmd .= "LINE2:\"total#{$colormbuf[2]}:total\" ";
|
959
|
$graphcmd .= "LINE2:\"max#{$colormbuf[3]}:max\" ";
|
960
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
961
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
962
|
$graphcmd .= "COMMENT:\"Current. \" ";
|
963
|
$graphcmd .= "GPRINT:\"current:MIN:%7.2lf %s \" ";
|
964
|
$graphcmd .= "GPRINT:\"current:AVERAGE:%7.2lf %s \" ";
|
965
|
$graphcmd .= "GPRINT:\"current:MAX:%7.2lf %s \" ";
|
966
|
$graphcmd .= "GPRINT:\"current:LAST:%7.2lf %S \" ";
|
967
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
968
|
$graphcmd .= "COMMENT:\"Cache. \" ";
|
969
|
$graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" ";
|
970
|
$graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" ";
|
971
|
$graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" ";
|
972
|
$graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" ";
|
973
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
974
|
$graphcmd .= "COMMENT:\"Total. \" ";
|
975
|
$graphcmd .= "GPRINT:\"total:MIN:%7.2lf %s \" ";
|
976
|
$graphcmd .= "GPRINT:\"total:AVERAGE:%7.2lf %s \" ";
|
977
|
$graphcmd .= "GPRINT:\"total:MAX:%7.2lf %s \" ";
|
978
|
$graphcmd .= "GPRINT:\"total:LAST:%7.2lf %S \" ";
|
979
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
980
|
$graphcmd .= "COMMENT:\"Max. \" ";
|
981
|
$graphcmd .= "GPRINT:\"max:MIN:%7.2lf %s \" ";
|
982
|
$graphcmd .= "GPRINT:\"max:AVERAGE:%7.2lf %s \" ";
|
983
|
$graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s \" ";
|
984
|
$graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S \" ";
|
985
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
986
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
987
|
}
|
988
|
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
989
|
/* define graphcmd for queue stats */
|
990
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
991
|
$graphcmd .= "--start $start --end $end --step $step ";
|
992
|
$graphcmd .= "--vertical-label \"bits/sec\" ";
|
993
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
994
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
995
|
$graphcmd .= "--height 200 --width 620 ";
|
996
|
if ($altq) {
|
997
|
$a_queues =& $altq->get_queue_list();
|
998
|
$t = 0;
|
999
|
} else {
|
1000
|
$a_queues = array();
|
1001
|
$i = 0;
|
1002
|
$t = 0;
|
1003
|
}
|
1004
|
foreach ($a_queues as $name => $q) {
|
1005
|
$color = "$colorqueuesup[$t]";
|
1006
|
if($t > 0) { $stack = ":STACK"; }
|
1007
|
$graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE:step=$step\" ";
|
1008
|
$graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
|
1009
|
$graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
|
1010
|
$graphcmd .= "$AREA:\"$name-bits_out#${color}:$name$stack\" ";
|
1011
|
$t++;
|
1012
|
if($t > 7) { $t = 0; }
|
1013
|
}
|
1014
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1015
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1016
|
}
|
1017
|
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1018
|
/* define graphcmd for queuedrop stats */
|
1019
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1020
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1021
|
$graphcmd .= "--vertical-label \"drops / sec\" ";
|
1022
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1023
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1024
|
$graphcmd .= "--height 200 --width 620 ";
|
1025
|
if ($altq) {
|
1026
|
$a_queues =& $altq->get_queue_list();
|
1027
|
$t = 0;
|
1028
|
} else {
|
1029
|
$a_queues = array();
|
1030
|
$i = 0;
|
1031
|
$t = 0;
|
1032
|
}
|
1033
|
foreach ($a_queues as $name => $q) {
|
1034
|
$color = "$colorqueuesdropup[$t]";
|
1035
|
if($t > 0) { $stack = ":STACK"; }
|
1036
|
$graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE:step=$step\" ";
|
1037
|
$graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
|
1038
|
$graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
|
1039
|
$graphcmd .= "CDEF:\"$name-bits_out_neg=$name-bits_out,$multiplier,*\" ";
|
1040
|
$graphcmd .= "$AREA:\"$name-bits_out_neg#${color}:$name$stack\" ";
|
1041
|
$t++;
|
1042
|
if($t > 7) { $t = 0; }
|
1043
|
}
|
1044
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1045
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1046
|
}
|
1047
|
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1048
|
/* make a link quality graphcmd, we only have WAN for now, others too follow */
|
1049
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
|
1050
|
--start $start --end $end --step $step \\
|
1051
|
--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
|
1052
|
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
|
1053
|
--vertical-label \"ms / %\" \\
|
1054
|
--height 200 --width 620 \\
|
1055
|
--lower-limit 0 \\
|
1056
|
DEF:delayraw=$rrddbpath$curdatabase:delay:AVERAGE:step=$step \\
|
1057
|
DEF:loss=$rrddbpath$curdatabase:loss:AVERAGE:step=$step \\
|
1058
|
\"CDEF:delay=delayraw,1000,*\" \\
|
1059
|
\"CDEF:roundavg=delay,PREV(delay),+,2,/\" \\
|
1060
|
\"CDEF:loss10=loss,$multiplier,*\" \\
|
1061
|
\"CDEF:r0=delay,20,MIN\" \\
|
1062
|
\"CDEF:r1=delay,60,MIN\" \\
|
1063
|
\"CDEF:r2=delay,180,MIN\" \\
|
1064
|
\"CDEF:r3=delay,420,MIN\" \\
|
1065
|
COMMENT:\"\t\t\t\t\tDelay\t\t\tPacket loss\\n\" \\
|
1066
|
AREA:delay#$colorqualityrtt[0]:\"> 420 ms\" \\
|
1067
|
GPRINT:delay:MIN:\"\t\tMin\\: %7.2lf ms\" \\
|
1068
|
GPRINT:loss:MIN:\"\tMin\\: %3.1lf %%\\n\" \\
|
1069
|
AREA:r3#$colorqualityrtt[1]:\"180-420 ms\" \\
|
1070
|
GPRINT:delay:AVERAGE:\"\t\tAvg\\: %7.2lf ms\" \\
|
1071
|
GPRINT:loss:AVERAGE:\"\tAvg\\: %3.1lf %%\\n\" \\
|
1072
|
AREA:r2#$colorqualityrtt[2]:\"60-180 ms\" \\
|
1073
|
GPRINT:delay:MAX:\"\t\tMax\\: %7.2lf ms\" \\
|
1074
|
GPRINT:loss:MAX:\"\tMax\\: %3.1lf %%\\n\" \\
|
1075
|
AREA:r1#$colorqualityrtt[3]:\"20-60 ms\\n\" \\
|
1076
|
AREA:r0#$colorqualityrtt[4]:\"< 20 ms\" \\
|
1077
|
GPRINT:delay:LAST:\"\t\tLast\\: %7.2lf ms\" \\
|
1078
|
GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
|
1079
|
AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
|
1080
|
LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
|
1081
|
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
|
1082
|
}
|
1083
|
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1084
|
/* graph a spamd statistics graph */
|
1085
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
|
1086
|
--start $start --end $end --step $step \\
|
1087
|
--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
|
1088
|
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
|
1089
|
--vertical-label=\"Conn / Time, sec.\" \\
|
1090
|
--height 200 --width 620 --no-gridfit \\
|
1091
|
--lower-limit 0 \\
|
1092
|
DEF:consmin=$rrddbpath$curdatabase:conn:MIN:step=$step \\
|
1093
|
DEF:consavg=$rrddbpath$curdatabase:conn:AVERAGE:step=$step \\
|
1094
|
DEF:consmax=$rrddbpath$curdatabase:conn:MAX:step=$step \\
|
1095
|
DEF:timemin=$rrddbpath$curdatabase:time:MIN:step=$step \\
|
1096
|
DEF:timeavg=$rrddbpath$curdatabase:time:AVERAGE:step=$step \\
|
1097
|
DEF:timemax=$rrddbpath$curdatabase:time:MAX:step=$step \\
|
1098
|
\"CDEF:timeminadj=timemin,0,86400,LIMIT,UN,0,timemin,IF\" \\
|
1099
|
\"CDEF:timeavgadj=timeavg,0,86400,LIMIT,UN,0,timeavg,IF\" \\
|
1100
|
\"CDEF:timemaxadj=timemax,0,86400,LIMIT,UN,0,timemax,IF\" \\
|
1101
|
\"CDEF:t1=timeminadj,timeavgadj,+,2,/,timeminadj,-\" \\
|
1102
|
\"CDEF:t2=timeavgadj,timemaxadj,+,2,/,timeminadj,-,t1,-\" \\
|
1103
|
\"CDEF:t3=timemaxadj,timeminadj,-,t1,-,t2,-\" \\
|
1104
|
AREA:timeminadj \\
|
1105
|
AREA:t1#$colorspamdtime[0]::STACK \\
|
1106
|
AREA:t2#$colorspamdtime[1]::STACK \\
|
1107
|
AREA:t3#$colorspamdtime[2]::STACK \\
|
1108
|
LINE2:timeavgadj#$colorspamdtime[3]:\"Time \" \\
|
1109
|
GPRINT:timeminadj:MIN:\"Min\\:%6.2lf\\t\" \\
|
1110
|
GPRINT:timeavgadj:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
|
1111
|
GPRINT:timemaxadj:MAX:\"Max\\:%6.2lf\\n\" \\
|
1112
|
AREA:consmax#$colorspamdconn[0] \\
|
1113
|
AREA:consmin#$colorspamdconn[1] \\
|
1114
|
LINE1:consmin#$colorspamdconn[2] \\
|
1115
|
LINE1:consmax#$colorspamdconn[3] \\
|
1116
|
LINE1:consavg#$colorspamdconn[4]:\"Cons \" \\
|
1117
|
GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
|
1118
|
GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
|
1119
|
GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
|
1120
|
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1121
|
}
|
1122
|
elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1123
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1124
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1125
|
$graphcmd .= "--vertical-label \"signal\" ";
|
1126
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1127
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1128
|
$graphcmd .= "--height 200 --width 620 ";
|
1129
|
$graphcmd .= "DEF:\"$curif-rssi=$rrddbpath$curdatabase:rssi:AVERAGE:step=$step\" ";
|
1130
|
$graphcmd .= "LINE2:\"$curif-rssi#{$colorwireless[0]}:$curif-rssi\" ";
|
1131
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1132
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\\n\" ";
|
1133
|
$graphcmd .= "COMMENT:\"RSSI\t\t\" ";
|
1134
|
$graphcmd .= "GPRINT:\"$curif-rssi:MAX:%7.2lf \" ";
|
1135
|
$graphcmd .= "GPRINT:\"$curif-rssi:AVERAGE:%7.2lf \" ";
|
1136
|
$graphcmd .= "GPRINT:\"$curif-rssi:LAST:%7.2lf \" ";
|
1137
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1138
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1139
|
}
|
1140
|
elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1141
|
/* define graphcmd for online Captive Portal users stats */
|
1142
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1143
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1144
|
$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
|
1145
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1146
|
$graphcmd .= "--base=1000 ";
|
1147
|
$graphcmd .= "--lower-limit=0 ";
|
1148
|
$graphcmd .= "--slope-mode ";
|
1149
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1150
|
$graphcmd .= "--height 200 --width 620 ";
|
1151
|
$graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE:step=$step\" ";
|
1152
|
$graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" ";
|
1153
|
$graphcmd .= "CDEF:\"$curif-totalusers_d=$curif-totalusers_t,FLOOR\" ";
|
1154
|
$graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" ";
|
1155
|
$graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" ";
|
1156
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1157
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1158
|
}
|
1159
|
elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1160
|
/* define graphcmd for online Captive Portal users stats */
|
1161
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1162
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1163
|
$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
|
1164
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1165
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1166
|
$graphcmd .= "--base=1000 ";
|
1167
|
$graphcmd .= "--lower-limit=0 ";
|
1168
|
$graphcmd .= "--slope-mode ";
|
1169
|
$graphcmd .= "--height 200 --width 620 ";
|
1170
|
$graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE:step=$step\" ";
|
1171
|
$graphcmd .= "AREA:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:Concurrent Users\" ";
|
1172
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1173
|
$graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" ";
|
1174
|
$graphcmd .= "COMMENT:\"Users Online\t\" ";
|
1175
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%8.0lf \" ";
|
1176
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf \" ";
|
1177
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" ";
|
1178
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1179
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1180
|
}
|
1181
|
elseif((strstr($curdatabase, "ntpd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1182
|
/* define graphcmd for ntpd (was: mbuf) usage stats */
|
1183
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1184
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1185
|
$graphcmd .= "--vertical-label \"time\" ";
|
1186
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1187
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1188
|
$graphcmd .= "--height 200 --width 620 ";
|
1189
|
$graphcmd .= "DEF:\"offset=$rrddbpath$curdatabase:offset:AVERAGE:step=$step\" ";
|
1190
|
$graphcmd .= "DEF:\"sjit=$rrddbpath$curdatabase:sjit:AVERAGE:step=$step\" ";
|
1191
|
$graphcmd .= "DEF:\"cjit=$rrddbpath$curdatabase:cjit:AVERAGE:step=$step\" ";
|
1192
|
$graphcmd .= "DEF:\"wander=$rrddbpath$curdatabase:wander:AVERAGE:step=$step\" ";
|
1193
|
$graphcmd .= "LINE2:\"offset#{$colorntpd[0]}:offset\" ";
|
1194
|
$graphcmd .= "LINE2:\"sjit#{$colorntpd[1]}:sjit\" ";
|
1195
|
$graphcmd .= "LINE2:\"cjit#{$colorntpd[2]}:cjit\" ";
|
1196
|
$graphcmd .= "LINE2:\"wander#{$colorntpd[3]}:wander\" ";
|
1197
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1198
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
1199
|
$graphcmd .= "COMMENT:\"Offset \" ";
|
1200
|
$graphcmd .= "GPRINT:\"offset:MIN:%7.2lf %s \" ";
|
1201
|
$graphcmd .= "GPRINT:\"offset:AVERAGE:%7.2lf %s \" ";
|
1202
|
$graphcmd .= "GPRINT:\"offset:MAX:%7.2lf %s \" ";
|
1203
|
$graphcmd .= "GPRINT:\"offset:LAST:%7.2lf %S \" ";
|
1204
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1205
|
$graphcmd .= "COMMENT:\"System jitter \" ";
|
1206
|
$graphcmd .= "GPRINT:\"sjit:MIN:%7.2lf %s \" ";
|
1207
|
$graphcmd .= "GPRINT:\"sjit:AVERAGE:%7.2lf %s \" ";
|
1208
|
$graphcmd .= "GPRINT:\"sjit:MAX:%7.2lf %s \" ";
|
1209
|
$graphcmd .= "GPRINT:\"sjit:LAST:%7.2lf %S \" ";
|
1210
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1211
|
$graphcmd .= "COMMENT:\"Clock jitter \" ";
|
1212
|
$graphcmd .= "GPRINT:\"cjit:MIN:%7.2lf %s \" ";
|
1213
|
$graphcmd .= "GPRINT:\"cjit:AVERAGE:%7.2lf %s \" ";
|
1214
|
$graphcmd .= "GPRINT:\"cjit:MAX:%7.2lf %s \" ";
|
1215
|
$graphcmd .= "GPRINT:\"cjit:LAST:%7.2lf %S \" ";
|
1216
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1217
|
$graphcmd .= "COMMENT:\"Clk freq wander\" ";
|
1218
|
$graphcmd .= "GPRINT:\"wander:MIN:%7.2lf %s \" ";
|
1219
|
$graphcmd .= "GPRINT:\"wander:AVERAGE:%7.2lf %s \" ";
|
1220
|
$graphcmd .= "GPRINT:\"wander:MAX:%7.2lf %s \" ";
|
1221
|
$graphcmd .= "GPRINT:\"wander:LAST:%7.2lf %S \" ";
|
1222
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1223
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1224
|
}
|
1225
|
else {
|
1226
|
$data = false;
|
1227
|
log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase));
|
1228
|
}
|
1229
|
|
1230
|
/* check modification time to see if we need to generate image */
|
1231
|
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
|
1232
|
if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 15 ) {
|
1233
|
if($data)
|
1234
|
$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
|
1235
|
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
|
1236
|
flush();
|
1237
|
usleep(500);
|
1238
|
}
|
1239
|
} else {
|
1240
|
if($data)
|
1241
|
$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
|
1242
|
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
|
1243
|
flush();
|
1244
|
usleep(500);
|
1245
|
}
|
1246
|
if(($graphcmdreturn <> 0) || (! $data)) {
|
1247
|
log_error(sprintf(gettext('Failed to create graph with error code %1$s, the error is: %2$s'),$graphcmdreturn,$graphcmdoutput));
|
1248
|
if(strstr($curdatabase, "queues")) {
|
1249
|
log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
|
1250
|
unlink_if_exists($rrddbpath . $curif . $queues);
|
1251
|
flush();
|
1252
|
usleep(500);
|
1253
|
enable_rrd_graphing();
|
1254
|
}
|
1255
|
if(strstr($curdatabase, "queuesdrop")) {
|
1256
|
log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
|
1257
|
unlink_if_exists($rrddbpath . $curdatabase);
|
1258
|
flush();
|
1259
|
usleep(500);
|
1260
|
enable_rrd_graphing();
|
1261
|
}
|
1262
|
header("Content-type: image/png");
|
1263
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
1264
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
1265
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
1266
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
1267
|
header("Pragma: no-cache");
|
1268
|
$file= "/usr/local/www/themes/{$g['theme']}/images/misc/rrd_error.png";
|
1269
|
readfile($file);
|
1270
|
} else {
|
1271
|
$file = "$rrdtmppath$curdatabase-$curgraph.png";
|
1272
|
if(file_exists("$file")) {
|
1273
|
header("Content-type: image/png");
|
1274
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
1275
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
1276
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
1277
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
1278
|
header("Pragma: no-cache");
|
1279
|
readfile($file);
|
1280
|
}
|
1281
|
}
|
1282
|
|
1283
|
?>
|