1 |
cbe30115
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
status_rrd_graph_img.php
|
5 |
|
|
Part of pfSense
|
6 |
6216690b
|
smos
|
Copyright (C) 2009 Seth Mos <seth.mos@dds.nl>
|
7 |
cbe30115
|
Scott Ullrich
|
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 |
1d333258
|
Scott Ullrich
|
/*
|
31 |
002bc4ab
|
smos
|
pfSense_BUILDER_BINARIES: /bin/rm /usr/local/bin/rrdtool
|
32 |
1d333258
|
Scott Ullrich
|
pfSense_MODULE: system
|
33 |
|
|
*/
|
34 |
cbe30115
|
Scott Ullrich
|
|
35 |
5b9ba75a
|
smos
|
require_once("globals.inc");
|
36 |
|
|
require_once("guiconfig.inc");
|
37 |
5208e648
|
Ermal Lu?i
|
require_once("filter.inc");
|
38 |
127b93cf
|
Ermal Lu?i
|
require_once("shaper.inc");
|
39 |
483e6de8
|
Scott Ullrich
|
require_once("rrd.inc");
|
40 |
cbe30115
|
Scott Ullrich
|
|
41 |
80feb8e5
|
Renato Botelho
|
global $g;
|
42 |
|
|
|
43 |
51d4cad7
|
Rafael Lucas
|
$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
|
44 |
d293a500
|
Scott Ullrich
|
|
45 |
6ab7ae50
|
Seth Mos
|
if ($_GET['database']) {
|
46 |
2d1e985d
|
Renato Botelho
|
$curdatabase = basename($_GET['database']);
|
47 |
|
|
$curdatabase = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($curdatabase, ENT_QUOTES | ENT_HTML401));
|
48 |
cbe30115
|
Scott Ullrich
|
} else {
|
49 |
6ab7ae50
|
Seth Mos
|
$curdatabase = "wan-traffic.rrd";
|
50 |
cbe30115
|
Scott Ullrich
|
}
|
51 |
|
|
|
52 |
6ab7ae50
|
Seth Mos
|
if ($_GET['style']) {
|
53 |
|
|
$curstyle = $_GET['style'];
|
54 |
cbe30115
|
Scott Ullrich
|
} else {
|
55 |
6ab7ae50
|
Seth Mos
|
$curstyle = "inverse";
|
56 |
cbe30115
|
Scott Ullrich
|
}
|
57 |
|
|
|
58 |
7d906758
|
smos
|
/* this is used for temp name */
|
59 |
|
|
if ($_GET['graph']) {
|
60 |
2d1e985d
|
Renato Botelho
|
$curgraph = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($_GET['graph'], ENT_QUOTES | ENT_HTML401));
|
61 |
cbe30115
|
Scott Ullrich
|
} else {
|
62 |
7d906758
|
smos
|
$curgraph = "custom";
|
63 |
cbe30115
|
Scott Ullrich
|
}
|
64 |
|
|
|
65 |
7d906758
|
smos
|
$now = time();
|
66 |
|
|
|
67 |
|
|
if (is_numeric($_GET['start'])) {
|
68 |
|
|
$start = $_GET['start'];
|
69 |
|
|
} else {
|
70 |
c7cfbbd8
|
smos
|
$start = $now - (8 * 3600);
|
71 |
7d906758
|
smos
|
}
|
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 |
1e312328
|
Erik Fonnesbeck
|
log_error("start $start is smaller than end $end");
|
82 |
7d906758
|
smos
|
$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 |
24646d57
|
N0YB
|
$archives[1] = 1200;
|
98 |
|
|
$archives[5] = 720;
|
99 |
|
|
$archives[60] = 1860;
|
100 |
f1c252cf
|
N0YB
|
$archives[1440] = 2284;
|
101 |
7d906758
|
smos
|
|
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 |
24646d57
|
N0YB
|
$average = 1440 * 60;
|
112 |
7d906758
|
smos
|
foreach($archives as $rra => $value) {
|
113 |
641f2f3c
|
N0YB
|
$archivestart = $now - ($rra * 60 * $value);
|
114 |
7d906758
|
smos
|
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 |
161cd05c
|
smos
|
// log_error("start $start, end $end, archivestart $archivestart, average $average, scale $scale, seconds $seconds");
|
128 |
7d906758
|
smos
|
|
129 |
6ab7ae50
|
Seth Mos
|
/* Deduce a interface if possible and use the description */
|
130 |
cfbfd941
|
smos
|
$curif = explode("-", $curdatabase);
|
131 |
6ab7ae50
|
Seth Mos
|
$curif = "$curif[0]";
|
132 |
|
|
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($curif));
|
133 |
a927edff
|
Seth Mos
|
if($friendly == "") {
|
134 |
|
|
$friendly = $curif;
|
135 |
|
|
}
|
136 |
6ab7ae50
|
Seth Mos
|
$search = array("-", ".rrd", $curif);
|
137 |
|
|
$replace = array(" :: ", "", $friendly);
|
138 |
|
|
$prettydb = ucwords(str_replace($search, $replace, $curdatabase));
|
139 |
cbe30115
|
Scott Ullrich
|
|
140 |
e3d7c123
|
Seth Mos
|
|
141 |
cbe30115
|
Scott Ullrich
|
$rrddbpath = "/var/db/rrd/";
|
142 |
2b5376cd
|
Scott Ullrich
|
$rrdtmppath = "/tmp/";
|
143 |
d9acea75
|
Scott Ullrich
|
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
144 |
cbe30115
|
Scott Ullrich
|
$uptime = "/usr/bin/uptime";
|
145 |
|
|
$sed = "/usr/bin/sed";
|
146 |
|
|
|
147 |
7d906758
|
smos
|
$havg = timeDiff($average, $defOptions);
|
148 |
|
|
$hperiod = timeDiff($seconds, $defOptions);
|
149 |
c444db24
|
Seth Mos
|
$data = true;
|
150 |
|
|
|
151 |
1e86f510
|
N0YB
|
/* 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 |
002bc4ab
|
smos
|
$rrddbpath = "/var/db/rrd/";
|
162 |
|
|
chdir($rrddbpath);
|
163 |
|
|
$databases = glob("*.rrd");
|
164 |
e3d7c123
|
Seth Mos
|
rsort($databases);
|
165 |
|
|
|
166 |
cbe30115
|
Scott Ullrich
|
/* compare bytes/sec counters, divide bps by 8 */
|
167 |
fe93b17b
|
Ermal Luçi
|
read_altq_config();
|
168 |
21a0464c
|
Ermal Luçi
|
if ($altq_list_queues[$curif]) {
|
169 |
fe93b17b
|
Ermal Luçi
|
$altq =& $altq_list_queues[$curif];
|
170 |
|
|
switch ($altq->GetBwscale()) {
|
171 |
|
|
case "Gb":
|
172 |
95919c39
|
Seth Mos
|
$factor = 1024 * 1024 * 1024;
|
173 |
fe93b17b
|
Ermal Luçi
|
break;
|
174 |
|
|
case "Mb":
|
175 |
95919c39
|
Seth Mos
|
$factor = 1024 * 1024;
|
176 |
fe93b17b
|
Ermal Luçi
|
break;
|
177 |
|
|
case "Kb":
|
178 |
95919c39
|
Seth Mos
|
$factor = 1024;
|
179 |
fe93b17b
|
Ermal Luçi
|
break;
|
180 |
|
|
case "b":
|
181 |
|
|
default:
|
182 |
|
|
$factor = 1;
|
183 |
|
|
break;
|
184 |
|
|
}
|
185 |
|
|
$upstream = (($altq->GetBandwidth()*$factor)/8);
|
186 |
b13a841b
|
Warren Baker
|
if ($upstream != 0)
|
187 |
|
|
$downstream = $upstream; /* XXX: Ugly hack */
|
188 |
|
|
else
|
189 |
|
|
$downstream = $upstream = 12500000;
|
190 |
fe93b17b
|
Ermal Luçi
|
$upif = $curif;
|
191 |
|
|
$downif = "lan"; /* XXX should this be set to something else?! */
|
192 |
6ab7ae50
|
Seth Mos
|
} else {
|
193 |
21a0464c
|
Ermal Luçi
|
$altq = null;
|
194 |
6ab7ae50
|
Seth Mos
|
$downstream = 12500000;
|
195 |
|
|
$upstream = 12500000;
|
196 |
|
|
$upif = "wan";
|
197 |
|
|
$downif = "lan";
|
198 |
|
|
}
|
199 |
cbe30115
|
Scott Ullrich
|
|
200 |
9835307e
|
Seth Mos
|
$speedlimit = ($upstream + $downstream);
|
201 |
|
|
|
202 |
edaa41be
|
Phil Davis
|
/* Set default colors explicitly, the theme can then override them below.
|
203 |
b01adece
|
jim-p
|
This prevents missing colors in themes from crashing the graphs. */
|
204 |
c2a58cd1
|
jim-p
|
/* 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 |
|
|
/* Captive Portal Total Users Total Users */
|
256 |
|
|
/* Captive Portal Concurrent Concurrent Users */
|
257 |
b01adece
|
jim-p
|
$colorcaptiveportalusers = array('990000');
|
258 |
|
|
|
259 |
6ab7ae50
|
Seth Mos
|
/* select theme colors if the inclusion file exists */
|
260 |
556687cf
|
jim-p
|
$rrdcolors = "{$g['www_path']}/themes/{$g['theme']}/rrdcolors.inc.php";
|
261 |
6ab7ae50
|
Seth Mos
|
if(file_exists($rrdcolors)) {
|
262 |
|
|
include($rrdcolors);
|
263 |
|
|
} else {
|
264 |
3a3fb8ea
|
Erik Fonnesbeck
|
log_error(sprintf(gettext("rrdcolors.inc.php for theme %s does not exist, using defaults!"),$g['theme']));
|
265 |
6ab7ae50
|
Seth Mos
|
}
|
266 |
|
|
|
267 |
|
|
switch ($curstyle) {
|
268 |
|
|
case "absolute":
|
269 |
|
|
$multiplier = 1;
|
270 |
|
|
$AREA = "LINE1";
|
271 |
|
|
break;
|
272 |
|
|
default:
|
273 |
|
|
$multiplier = -1;
|
274 |
|
|
$AREA = "AREA";
|
275 |
|
|
break;
|
276 |
|
|
}
|
277 |
|
|
|
278 |
7d906758
|
smos
|
function timeDiff($time, $opt = array()) {
|
279 |
|
|
// The default values
|
280 |
|
|
$defOptions = array(
|
281 |
|
|
'to' => 0,
|
282 |
|
|
'parts' => 1,
|
283 |
|
|
'precision' => 'second',
|
284 |
|
|
'distance' => TRUE,
|
285 |
|
|
'separator' => ', '
|
286 |
|
|
);
|
287 |
|
|
$opt = array_merge($defOptions, $opt);
|
288 |
|
|
// Default to current time if no to point is given
|
289 |
|
|
(!$opt['to']) && ($opt['to'] = time());
|
290 |
|
|
// Init an empty string
|
291 |
|
|
$str = '';
|
292 |
|
|
// To or From computation
|
293 |
0423bf2c
|
smos
|
$diff = ($opt['to'] > $time) ? $opt['to'] - $time : $time - $opt['to'];
|
294 |
7d906758
|
smos
|
// An array of label => periods of seconds;
|
295 |
|
|
$periods = array(
|
296 |
|
|
'decade' => 315569260,
|
297 |
161cd05c
|
smos
|
'year' => 31539600,
|
298 |
7d906758
|
smos
|
'month' => 2629744,
|
299 |
|
|
'week' => 604800,
|
300 |
|
|
'day' => 86400,
|
301 |
|
|
'hour' => 3600,
|
302 |
|
|
'minute' => 60,
|
303 |
|
|
'second' => 1
|
304 |
|
|
);
|
305 |
161cd05c
|
smos
|
// 31539600, 31556926, 31622400
|
306 |
7d906758
|
smos
|
// Round to precision
|
307 |
|
|
if ($opt['precision'] != 'second')
|
308 |
161cd05c
|
smos
|
$diff = round(($diff / $periods[$opt['precision']])) * $periods[$opt['precision']];
|
309 |
7d906758
|
smos
|
// Report the value is 'less than 1 ' precision period away
|
310 |
0423bf2c
|
smos
|
(0 == $diff) && ($str = 'less than 1 ' . $opt['precision']);
|
311 |
7d906758
|
smos
|
// Loop over each period
|
312 |
|
|
foreach ($periods as $label => $value) {
|
313 |
|
|
// Stitch together the time difference string
|
314 |
0423bf2c
|
smos
|
(($x = round($diff / $value)) && $opt['parts']--) && $str .= ($str ? $opt['separator'] : '') . ($x .' '. $label. ($x > 1 ? 's' : ''));
|
315 |
7d906758
|
smos
|
// Stop processing if no more parts are going to be reported.
|
316 |
|
|
if ($opt['parts'] == 0 || $label == $opt['precision']) break;
|
317 |
|
|
// Get ready for the next pass
|
318 |
161cd05c
|
smos
|
$diff -= $x * $value;
|
319 |
7d906758
|
smos
|
}
|
320 |
161cd05c
|
smos
|
$opt['distance'] && $str .= ($str && $opt['to'] >= $time) ? ' ago' : ' away';
|
321 |
7d906758
|
smos
|
return $str;
|
322 |
9370b5b4
|
Seth Mos
|
}
|
323 |
|
|
|
324 |
7d906758
|
smos
|
|
325 |
6ab7ae50
|
Seth Mos
|
if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
326 |
cbe30115
|
Scott Ullrich
|
/* define graphcmd for traffic stats */
|
327 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
328 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step --vertical-label \"bits/sec\" ";
|
329 |
95919c39
|
Seth Mos
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
330 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
331 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
332 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step ";
|
333 |
|
|
$graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step ";
|
334 |
|
|
$graphcmd .= "DEF:$curif-in_bytes_block=$rrddbpath$curdatabase:inblock:AVERAGE:step=$step ";
|
335 |
|
|
$graphcmd .= "DEF:$curif-out_bytes_block=$rrddbpath$curdatabase:outblock:AVERAGE:step=$step ";
|
336 |
7c6fe5c5
|
seth
|
|
337 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:$curif-in6_bytes_pass=$rrddbpath$curdatabase:inpass6:AVERAGE:step=$step ";
|
338 |
|
|
$graphcmd .= "DEF:$curif-out6_bytes_pass=$rrddbpath$curdatabase:outpass6:AVERAGE:step=$step ";
|
339 |
|
|
$graphcmd .= "DEF:$curif-in6_bytes_block=$rrddbpath$curdatabase:inblock6:AVERAGE:step=$step ";
|
340 |
|
|
$graphcmd .= "DEF:$curif-out6_bytes_block=$rrddbpath$curdatabase:outblock6:AVERAGE:step=$step ";
|
341 |
9bc8b6b6
|
Seth Mos
|
|
342 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in_bits_pass=$curif-in_bytes_pass,8,*\" ";
|
343 |
|
|
$graphcmd .= "CDEF:\"$curif-out_bits_pass=$curif-out_bytes_pass,8,*\" ";
|
344 |
|
|
$graphcmd .= "CDEF:\"$curif-in_bits_block=$curif-in_bytes_block,8,*\" ";
|
345 |
|
|
$graphcmd .= "CDEF:\"$curif-out_bits_block=$curif-out_bytes_block,8,*\" ";
|
346 |
7c6fe5c5
|
seth
|
|
347 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in6_bits_pass=$curif-in6_bytes_pass,8,*\" ";
|
348 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bits_pass=$curif-out6_bytes_pass,8,*\" ";
|
349 |
|
|
$graphcmd .= "CDEF:\"$curif-in6_bits_block=$curif-in6_bytes_block,8,*\" ";
|
350 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bits_block=$curif-out6_bytes_block,8,*\" ";
|
351 |
|
|
|
352 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in_bytes=$curif-in_bytes_pass,$curif-in_bytes_block,+\" ";
|
353 |
|
|
$graphcmd .= "CDEF:\"$curif-out_bytes=$curif-out_bytes_pass,$curif-out_bytes_block,+\" ";
|
354 |
|
|
$graphcmd .= "CDEF:\"$curif-in_bits=$curif-in_bits_pass,$curif-in_bits_block,+\" ";
|
355 |
|
|
$graphcmd .= "CDEF:\"$curif-out_bits=$curif-out_bits_pass,$curif-out_bits_block,+\" ";
|
356 |
7c6fe5c5
|
seth
|
|
357 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in6_bytes=$curif-in6_bytes_pass,$curif-in6_bytes_block,+\" ";
|
358 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bytes=$curif-out6_bytes_pass,$curif-out6_bytes_block,+\" ";
|
359 |
|
|
$graphcmd .= "CDEF:\"$curif-in6_bits=$curif-in6_bits_pass,$curif-in6_bits_block,+\" ";
|
360 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bits=$curif-out6_bits_pass,$curif-out6_bits_block,+\" ";
|
361 |
|
|
|
362 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bits_io=$curif-in_bits,$curif-out_bits,+\" ";
|
363 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-out_bits_block_neg=$curif-out_bits_block,$multiplier,*\" ";
|
364 |
|
|
$graphcmd .= "CDEF:\"$curif-out_bits_pass_neg=$curif-out_bits_pass,$multiplier,*\" ";
|
365 |
|
|
|
366 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bits6_io=$curif-in6_bits,$curif-out6_bits,+\" ";
|
367 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bits_block_neg=$curif-out6_bits_block,$multiplier,*\" ";
|
368 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_bits_pass_neg=$curif-out6_bits_pass,$multiplier,*\" ";
|
369 |
|
|
|
370 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-bytes_in_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$average,*\" ";
|
371 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$average,*\" ";
|
372 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_in_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$average,*\" ";
|
373 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$average,*\" ";
|
374 |
|
|
|
375 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$average,*\" ";
|
376 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$average,*\" ";
|
377 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$average,*\" ";
|
378 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$average,*\" ";
|
379 |
|
|
|
380 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-bytes_pass=$curif-bytes_in_pass,$curif-bytes_out_pass,+\" ";
|
381 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_block=$curif-bytes_in_block,$curif-bytes_out_block,+\" ";
|
382 |
|
|
|
383 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bytes_pass6=$curif-bytes_in6_pass,$curif-bytes_out6_pass,+\" ";
|
384 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_block6=$curif-bytes_in6_block,$curif-bytes_out6_block,+\" ";
|
385 |
|
|
|
386 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-bytes_in_t_pass=$curif-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_pass,IF,$seconds,*\" ";
|
387 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out_t_pass=$curif-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_pass,IF,$seconds,*\" ";
|
388 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_in_t_block=$curif-in_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes_block,IF,$seconds,*\" ";
|
389 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out_t_block=$curif-out_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes_block,IF,$seconds,*\" ";
|
390 |
|
|
|
391 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_t_pass=$curif-in6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_pass,IF,$seconds,*\" ";
|
392 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_t_pass=$curif-out6_bytes_pass,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_pass,IF,$seconds,*\" ";
|
393 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_in6_t_block=$curif-in6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-in6_bytes_block,IF,$seconds,*\" ";
|
394 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_out6_t_block=$curif-out6_bytes_block,0,$speedlimit,LIMIT,UN,0,$curif-out6_bytes_block,IF,$seconds,*\" ";
|
395 |
|
|
|
396 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-bytes_t_pass=$curif-bytes_in_t_pass,$curif-bytes_out_t_pass,+\" ";
|
397 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_t_block=$curif-bytes_in_t_block,$curif-bytes_out_t_block,+\" ";
|
398 |
edaa41be
|
Phil Davis
|
$graphcmd .= "CDEF:\"$curif-bytes_t=$curif-bytes_t_pass,$curif-bytes_t_block,+\" ";
|
399 |
7c6fe5c5
|
seth
|
|
400 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-bytes_t_pass6=$curif-bytes_in6_t_pass,$curif-bytes_out6_t_pass,+\" ";
|
401 |
|
|
$graphcmd .= "CDEF:\"$curif-bytes_t_block6=$curif-bytes_in6_t_block,$curif-bytes_out6_t_block,+\" ";
|
402 |
edaa41be
|
Phil Davis
|
$graphcmd .= "CDEF:\"$curif-bytes_t6=$curif-bytes_t_pass6,$curif-bytes_t_block6,+\" ";
|
403 |
a6917c65
|
smos
|
$graphcmd .= "VDEF:\"$curif-in_bits_95=$curif-in_bits,95,PERCENT\" ";
|
404 |
b4822548
|
jim-p
|
$graphcmd .= "CDEF:\"$curif-out_bits_mul=$curif-out_bits,$multiplier,*\" ";
|
405 |
49825b17
|
jim-p
|
$perc = $multiplier > 0 ? "95" : "5";
|
406 |
|
|
$graphcmd .= "VDEF:\"$curif-out_bits_95=$curif-out_bits_mul,{$perc},PERCENT\" ";
|
407 |
9bc8b6b6
|
Seth Mos
|
|
408 |
7c6fe5c5
|
seth
|
$graphcmd .= "AREA:\"$curif-in_bits_block#{$colortrafficdown[1]}:$curif-in-block\" ";
|
409 |
|
|
$graphcmd .= "AREA:\"$curif-in_bits_pass#{$colortrafficdown[0]}:$curif-in-pass:STACK\" ";
|
410 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "AREA:\"$curif-in6_bits_block#{$colortrafficdown[3]}:$curif-in6-block:STACK\" ";
|
411 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "AREA:\"$curif-in6_bits_pass#{$colortrafficdown[2]}:$curif-in6-pass:STACK\" ";
|
412 |
cebd086a
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
413 |
|
|
|
414 |
7c6fe5c5
|
seth
|
$graphcmd .= "{$AREA}:\"$curif-out_bits_block_neg#{$colortrafficup[1]}:$curif-out-block\" ";
|
415 |
07e8a013
|
Seth Mos
|
$graphcmd .= "{$AREA}:\"$curif-out_bits_pass_neg#{$colortrafficup[0]}:$curif-out-pass:STACK\" ";
|
416 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "{$AREA}:\"$curif-out6_bits_block_neg#{$colortrafficup[3]}:$curif-out6-block:STACK\" ";
|
417 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "{$AREA}:\"$curif-out6_bits_pass_neg#{$colortrafficup[2]}:$curif-out6-pass:STACK\" ";
|
418 |
a63f2b7d
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
419 |
a6917c65
|
smos
|
$graphcmd .= "HRULE:\"$curif-in_bits_95#{$colortraffic95[1]}:$curif-in (95%)\" ";
|
420 |
|
|
$graphcmd .= "HRULE:\"$curif-out_bits_95#{$colortraffic95[0]}:$curif-out (95%)\" ";
|
421 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
422 |
a63f2b7d
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\t\t\t\t maximum\t average\t\t current\t period\t 95th percentile\\n\" ";
|
423 |
354796f0
|
Seth Mos
|
$graphcmd .= "COMMENT:\"IPv4 in-pass\t\" ";
|
424 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:MAX:%7.2lf %sb/s\" ";
|
425 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
426 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
427 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_in_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
428 |
a6917c65
|
smos
|
$graphcmd .= "GPRINT:\"$curif-in_bits_95:%7.2lf %sb/s\" ";
|
429 |
|
|
|
430 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
431 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "COMMENT:\"IPv4 out-pass\t\" ";
|
432 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:MAX:%7.2lf %sb/s\" ";
|
433 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
434 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
435 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_out_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
436 |
a6917c65
|
smos
|
$graphcmd .= "GPRINT:\"$curif-out_bits_95:%7.2lf %sb/s\" ";
|
437 |
7c6fe5c5
|
seth
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
438 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "COMMENT:\"IPv4 in-block\t\" ";
|
439 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:MAX:%7.2lf %sb/s\" ";
|
440 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
441 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_bits_block:LAST:%7.2lf %Sb/s\" ";
|
442 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_in_t_block:AVERAGE:%7.2lf %sB i\" ";
|
443 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
444 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "COMMENT:\"IPv4 out-block\t\" ";
|
445 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:MAX:%7.2lf %sb/s\" ";
|
446 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
447 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_bits_block:LAST:%7.2lf %Sb/s\" ";
|
448 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
|
449 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
450 |
cebd086a
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
451 |
9bc8b6b6
|
Seth Mos
|
$graphcmd .= "COMMENT:\"IPv6 in-pass\t\" ";
|
452 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:MAX:%7.2lf %sb/s\" ";
|
453 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
454 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
455 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_in6_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
456 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
457 |
|
|
$graphcmd .= "COMMENT:\"IPv6 out-pass\t\" ";
|
458 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:MAX:%7.2lf %sb/s\" ";
|
459 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
460 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
461 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
462 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
463 |
|
|
$graphcmd .= "COMMENT:\"IPv6 in-block\t\" ";
|
464 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:MAX:%7.2lf %sb/s\" ";
|
465 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
466 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_bits_block:LAST:%7.2lf %Sb/s\" ";
|
467 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_in6_t_block:AVERAGE:%7.2lf %sB i\" ";
|
468 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
469 |
|
|
$graphcmd .= "COMMENT:\"IPv6 out-block\t\" ";
|
470 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:MAX:%7.2lf %sb/s\" ";
|
471 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
472 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" ";
|
473 |
|
|
$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" ";
|
474 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
475 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
476 |
95919c39
|
Seth Mos
|
}
|
477 |
e3d7c123
|
Seth Mos
|
elseif(strstr($curdatabase, "-throughput.rrd")) {
|
478 |
|
|
/* define graphcmd for throughput stats */
|
479 |
|
|
/* this gathers all interface statistics, the database does not actually exist */
|
480 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
481 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
482 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"bits/sec\" ";
|
483 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
484 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
485 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
486 |
95919c39
|
Seth Mos
|
|
487 |
|
|
$iflist = get_configured_interface_list();
|
488 |
e3d7c123
|
Seth Mos
|
$g = 0;
|
489 |
|
|
$operand = "";
|
490 |
|
|
$comma = "";
|
491 |
7c6fe5c5
|
seth
|
$graphtputbip = "";
|
492 |
|
|
$graphtputbop = "";
|
493 |
|
|
$graphtputbtp = "";
|
494 |
|
|
$graphtputbib = "";
|
495 |
|
|
$graphtputbob = "";
|
496 |
|
|
$graphtputbtb = "";
|
497 |
|
|
$graphtputbyip = "";
|
498 |
|
|
$graphtputbyop = "";
|
499 |
|
|
$graphtputbytp = "";
|
500 |
|
|
$graphtputbyib = "";
|
501 |
|
|
$graphtputbyob = "";
|
502 |
|
|
$graphtputbytb = "";
|
503 |
95919c39
|
Seth Mos
|
foreach($iflist as $ifname) {
|
504 |
e3d7c123
|
Seth Mos
|
/* collect all interface stats */
|
505 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"{$ifname}-in_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:inpass:AVERAGE:step=$step\" ";
|
506 |
|
|
$graphcmd .= "DEF:\"{$ifname}-out_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:outpass:AVERAGE:step=$step\" ";
|
507 |
|
|
$graphcmd .= "DEF:\"{$ifname}-in_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:inblock:AVERAGE:step=$step\" ";
|
508 |
|
|
$graphcmd .= "DEF:\"{$ifname}-out_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:outblock:AVERAGE:step=$step\" ";
|
509 |
95919c39
|
Seth Mos
|
|
510 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-in_bytes={$ifname}-in_bytes_pass,{$ifname}-in_bytes_block,+\" ";
|
511 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-out_bytes={$ifname}-out_bytes_pass,{$ifname}-out_bytes_block,+\" ";
|
512 |
|
|
|
513 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"{$ifname}-in_bits_pass={$ifname}-in_bytes_pass,8,*\" ";
|
514 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-out_bits_pass={$ifname}-out_bytes_pass,8,*\" ";
|
515 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bits_io_pass={$ifname}-in_bits_pass,{$ifname}-out_bits_pass,+\" ";
|
516 |
95919c39
|
Seth Mos
|
|
517 |
edaa41be
|
Phil Davis
|
$graphcmd .= "CDEF:\"{$ifname}-in_bits_block={$ifname}-in_bytes_block,8,*\" ";
|
518 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-out_bits_block={$ifname}-out_bytes_block,8,*\" ";
|
519 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"{$ifname}-bits_io_block={$ifname}-in_bits_block,{$ifname}-out_bits_block,+\" ";
|
520 |
95919c39
|
Seth Mos
|
|
521 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_pass={$ifname}-in_bytes_pass,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_pass,IF,$average,*\" ";
|
522 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_pass={$ifname}-out_bytes_pass,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_pass,IF,$average,*\" ";
|
523 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_block={$ifname}-in_bytes_block,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_block,IF,$average,*\" ";
|
524 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_block={$ifname}-out_bytes_block,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_block,IF,$average,*\" ";
|
525 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_pass={$ifname}-bytes_in_pass,{$ifname}-bytes_out_pass,+\" ";
|
526 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_block={$ifname}-bytes_in_pass,{$ifname}-bytes_out_block,+\" ";
|
527 |
|
|
|
528 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_t_pass={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_pass,IF,$seconds,*\" ";
|
529 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_in_t_block={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes_block,IF,$seconds,*\" ";
|
530 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_t_pass={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_pass,IF,$seconds,*\" ";
|
531 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_out_t_block={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_block,IF,$seconds,*\" ";
|
532 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_t_pass={$ifname}-bytes_in_t_pass,{$ifname}-bytes_out_t_pass,+\" ";
|
533 |
|
|
$graphcmd .= "CDEF:\"{$ifname}-bytes_t_block={$ifname}-bytes_in_t_block,{$ifname}-bytes_out_t_block,+\" ";
|
534 |
e3d7c123
|
Seth Mos
|
if ($g > 0) {
|
535 |
|
|
$operand .= ",+";
|
536 |
|
|
$comma = ",";
|
537 |
|
|
}
|
538 |
7c6fe5c5
|
seth
|
$graphtputbip .= "{$comma}{$ifname}-in_bits_pass";
|
539 |
|
|
$graphtputbop .= "{$comma}{$ifname}-out_bits_pass";
|
540 |
|
|
$graphtputbtp .= "{$comma}{$ifname}-bits_io_pass";
|
541 |
|
|
$graphtputbib .= "{$comma}{$ifname}-in_bits_block";
|
542 |
|
|
$graphtputbob .= "{$comma}{$ifname}-out_bits_block";
|
543 |
|
|
$graphtputbtb .= "{$comma}{$ifname}-bits_io_block";
|
544 |
|
|
$graphtputbyip .= "{$comma}{$ifname}-bytes_in_t_pass";
|
545 |
|
|
$graphtputbyop .= "{$comma}{$ifname}-bytes_out_t_pass";
|
546 |
|
|
$graphtputbyib .= "{$comma}{$ifname}-bytes_in_t_block";
|
547 |
|
|
$graphtputbyob .= "{$comma}{$ifname}-bytes_out_t_block";
|
548 |
|
|
$graphtputbytp .= "{$comma}{$ifname}-bytes_t_pass";
|
549 |
|
|
$graphtputbytb .= "{$comma}{$ifname}-bytes_t_block";
|
550 |
e3d7c123
|
Seth Mos
|
$g++;
|
551 |
|
|
}
|
552 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"tput-in_bits_pass={$graphtputbip}{$operand}\" ";
|
553 |
|
|
$graphcmd .= "CDEF:\"tput-out_bits_pass={$graphtputbop}{$operand}\" ";
|
554 |
|
|
$graphcmd .= "CDEF:\"tput-bits_io_pass={$graphtputbtp}{$operand}\" ";
|
555 |
|
|
|
556 |
|
|
$graphcmd .= "CDEF:\"tput-in_bits_block={$graphtputbib}{$operand}\" ";
|
557 |
|
|
$graphcmd .= "CDEF:\"tput-out_bits_block={$graphtputbob}{$operand}\" ";
|
558 |
|
|
$graphcmd .= "CDEF:\"tput-bits_io_block={$graphtputbtb}{$operand}\" ";
|
559 |
|
|
|
560 |
|
|
$graphcmd .= "CDEF:\"tput-out_bits_pass_neg=tput-out_bits_pass,$multiplier,*\" ";
|
561 |
|
|
$graphcmd .= "CDEF:\"tput-out_bits_block_neg=tput-out_bits_block,$multiplier,*\" ";
|
562 |
|
|
|
563 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_in_t_pass={$graphtputbyip}{$operand}\" ";
|
564 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_out_t_pass={$graphtputbyop}{$operand}\" ";
|
565 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_t_pass={$graphtputbytp}{$operand}\" ";
|
566 |
|
|
|
567 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_in_t_block={$graphtputbyib}{$operand}\" ";
|
568 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_out_t_block={$graphtputbyob}{$operand}\" ";
|
569 |
|
|
$graphcmd .= "CDEF:\"tput-bytes_t_block={$graphtputbytb}{$operand}\" ";
|
570 |
|
|
|
571 |
|
|
$graphcmd .= "AREA:\"tput-in_bits_block#{$colortrafficdown[0]}:in-block \" ";
|
572 |
|
|
$graphcmd .= "AREA:\"tput-in_bits_pass#{$colortrafficdown[1]}:in-pass \" ";
|
573 |
|
|
|
574 |
|
|
$graphcmd .= "{$AREA}:\"tput-out_bits_block_neg#{$colortrafficup[1]}:out-block \" ";
|
575 |
|
|
$graphcmd .= "{$AREA}:\"tput-out_bits_pass_neg#{$colortrafficup[0]}:out-pass \" ";
|
576 |
|
|
|
577 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
578 |
|
|
$graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
|
579 |
7c6fe5c5
|
seth
|
$graphcmd .= "COMMENT:\"in-pass\t\" ";
|
580 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:MAX:%7.2lf %sb/s\" ";
|
581 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
582 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
583 |
|
|
$graphcmd .= "GPRINT:\"tput-bytes_in_t_pass:AVERAGE:%7.2lf %sB i\" ";
|
584 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
585 |
|
|
$graphcmd .= "COMMENT:\"out-pass\t\" ";
|
586 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:MAX:%7.2lf %sb/s\" ";
|
587 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:AVERAGE:%7.2lf %Sb/s\" ";
|
588 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_pass:LAST:%7.2lf %Sb/s\" ";
|
589 |
|
|
$graphcmd .= "GPRINT:\"tput-bytes_out_t_pass:AVERAGE:%7.2lf %sB o\" ";
|
590 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
591 |
7c6fe5c5
|
seth
|
$graphcmd .= "COMMENT:\"in-block\t\" ";
|
592 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:MAX:%7.2lf %sb/s\" ";
|
593 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
594 |
|
|
$graphcmd .= "GPRINT:\"tput-in_bits_block:LAST:%7.2lf %Sb/s\" ";
|
595 |
|
|
$graphcmd .= "GPRINT:\"tput-bytes_in_t_block:AVERAGE:%7.2lf %sB i\" ";
|
596 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
597 |
|
|
$graphcmd .= "COMMENT:\"out-block\t\" ";
|
598 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:MAX:%7.2lf %sb/s\" ";
|
599 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:AVERAGE:%7.2lf %Sb/s\" ";
|
600 |
|
|
$graphcmd .= "GPRINT:\"tput-out_bits_block:LAST:%7.2lf %Sb/s\" ";
|
601 |
|
|
$graphcmd .= "GPRINT:\"tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
|
602 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
603 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
604 |
95919c39
|
Seth Mos
|
}
|
605 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
606 |
cbe30115
|
Scott Ullrich
|
/* define graphcmd for packets stats */
|
607 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
608 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
609 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"packets/sec\" ";
|
610 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
611 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
612 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
613 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step\" ";
|
614 |
|
|
$graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step\" ";
|
615 |
|
|
$graphcmd .= "DEF:\"$curif-in_pps_block=$rrddbpath$curdatabase:inblock:AVERAGE:step=$step\" ";
|
616 |
|
|
$graphcmd .= "DEF:\"$curif-out_pps_block=$rrddbpath$curdatabase:outblock:AVERAGE:step=$step\" ";
|
617 |
7c6fe5c5
|
seth
|
|
618 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-in6_pps_pass=$rrddbpath$curdatabase:inpass6:AVERAGE:step=$step\" ";
|
619 |
|
|
$graphcmd .= "DEF:\"$curif-out6_pps_pass=$rrddbpath$curdatabase:outpass6:AVERAGE:step=$step\" ";
|
620 |
|
|
$graphcmd .= "DEF:\"$curif-in6_pps_block=$rrddbpath$curdatabase:inblock6:AVERAGE:step=$step\" ";
|
621 |
|
|
$graphcmd .= "DEF:\"$curif-out6_pps_block=$rrddbpath$curdatabase:outblock6:AVERAGE:step=$step\" ";
|
622 |
bf7c1674
|
Seth Mos
|
|
623 |
5fce73d3
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in_pps=$curif-in_pps_pass,$curif-in_pps_block,+\" ";
|
624 |
|
|
$graphcmd .= "CDEF:\"$curif-out_pps=$curif-out_pps_pass,$curif-out_pps_block,+\" ";
|
625 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-out_pps_pass_neg=$curif-out_pps_pass,$multiplier,*\" ";
|
626 |
|
|
$graphcmd .= "CDEF:\"$curif-out_pps_block_neg=$curif-out_pps_block,$multiplier,*\" ";
|
627 |
|
|
|
628 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-in6_pps=$curif-in6_pps_pass,$curif-in6_pps_block,+\" ";
|
629 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_pps=$curif-out6_pps_pass,$curif-out6_pps_block,+\" ";
|
630 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_pps_pass_neg=$curif-out6_pps_pass,$multiplier,*\" ";
|
631 |
|
|
$graphcmd .= "CDEF:\"$curif-out6_pps_block_neg=$curif-out6_pps_block,$multiplier,*\" ";
|
632 |
|
|
|
633 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-pps_in_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$average,*\" ";
|
634 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$average,*\" ";
|
635 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_in_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$average,*\" ";
|
636 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$average,*\" ";
|
637 |
|
|
|
638 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pps_in6_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$average,*\" ";
|
639 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out6_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$average,*\" ";
|
640 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_in6_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$average,*\" ";
|
641 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out6_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$average,*\" ";
|
642 |
|
|
|
643 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pps_io=$curif-in_pps,$curif-out_pps,+\" ";
|
644 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-pps_pass=$curif-pps_in_pass,$curif-pps_out_pass,+\" ";
|
645 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_block=$curif-pps_in_block,$curif-pps_out_block,+\" ";
|
646 |
|
|
|
647 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pps_io6=$curif-in6_pps,$curif-out6_pps,+\" ";
|
648 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_pass6=$curif-pps_in6_pass,$curif-pps_out6_pass,+\" ";
|
649 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_block6=$curif-pps_in6_block,$curif-pps_out6_block,+\" ";
|
650 |
|
|
|
651 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-pps_in_t_pass=$curif-in_pps_pass,0,12500000,LIMIT,UN,0,$curif-in_pps_pass,IF,$seconds,*\" ";
|
652 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out_t_pass=$curif-out_pps_pass,0,12500000,LIMIT,UN,0,$curif-out_pps_pass,IF,$seconds,*\" ";
|
653 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_in_t_block=$curif-in_pps_block,0,12500000,LIMIT,UN,0,$curif-in_pps_block,IF,$seconds,*\" ";
|
654 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out_t_block=$curif-out_pps_block,0,12500000,LIMIT,UN,0,$curif-out_pps_block,IF,$seconds,*\" ";
|
655 |
|
|
|
656 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pps_in6_t_pass=$curif-in6_pps_pass,0,12500000,LIMIT,UN,0,$curif-in6_pps_pass,IF,$seconds,*\" ";
|
657 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out6_t_pass=$curif-out6_pps_pass,0,12500000,LIMIT,UN,0,$curif-out6_pps_pass,IF,$seconds,*\" ";
|
658 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_in6_t_block=$curif-in6_pps_block,0,12500000,LIMIT,UN,0,$curif-in6_pps_block,IF,$seconds,*\" ";
|
659 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_out6_t_block=$curif-out6_pps_block,0,12500000,LIMIT,UN,0,$curif-out6_pps_block,IF,$seconds,*\" ";
|
660 |
|
|
|
661 |
7c6fe5c5
|
seth
|
$graphcmd .= "CDEF:\"$curif-pps_t_pass=$curif-pps_in_t_pass,$curif-pps_out_t_pass,+\" ";
|
662 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_t_block=$curif-pps_in_t_block,$curif-pps_out_t_block,+\" ";
|
663 |
|
|
|
664 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pps_t_pass6=$curif-pps_in6_t_pass,$curif-pps_out6_t_pass,+\" ";
|
665 |
|
|
$graphcmd .= "CDEF:\"$curif-pps_t_block6=$curif-pps_in6_t_block,$curif-pps_out6_t_block,+\" ";
|
666 |
|
|
|
667 |
7c6fe5c5
|
seth
|
$graphcmd .= "AREA:\"$curif-in_pps_block#{$colorpacketsdown[1]}:$curif-in-block\" ";
|
668 |
|
|
$graphcmd .= "AREA:\"$curif-in_pps_pass#{$colorpacketsdown[0]}:$curif-in-pass:STACK\" ";
|
669 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "AREA:\"$curif-in6_pps_block#{$colorpacketsdown[3]}:$curif-in6-block:STACK\" ";
|
670 |
|
|
$graphcmd .= "AREA:\"$curif-in6_pps_pass#{$colorpacketsdown[2]}:$curif-in6-pass:STACK\" ";
|
671 |
cebd086a
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
672 |
7c6fe5c5
|
seth
|
$graphcmd .= "$AREA:\"$curif-out_pps_block_neg#{$colorpacketsup[1]}:$curif-out-block\" ";
|
673 |
|
|
$graphcmd .= "$AREA:\"$curif-out_pps_pass_neg#{$colorpacketsup[0]}:$curif-out-pass:STACK\" ";
|
674 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "$AREA:\"$curif-out6_pps_block_neg#{$colorpacketsup[3]}:$curif-out6-block:STACK\" ";
|
675 |
|
|
$graphcmd .= "$AREA:\"$curif-out6_pps_pass_neg#{$colorpacketsup[2]}:$curif-out6-pass:STACK\" ";
|
676 |
7c6fe5c5
|
seth
|
|
677 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
678 |
d67d99a1
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\t period\\n\" ";
|
679 |
7c6fe5c5
|
seth
|
$graphcmd .= "COMMENT:\"in-pass\t\" ";
|
680 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:MAX:%7.2lf %s pps\" ";
|
681 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
682 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_pass:LAST:%7.2lf %S pps\" ";
|
683 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_in_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
684 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
685 |
|
|
$graphcmd .= "COMMENT:\"out-pass\t\" ";
|
686 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:MAX:%7.2lf %s pps\" ";
|
687 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
688 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_pps_pass:LAST:%7.2lf %S pps\" ";
|
689 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_out_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
690 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
691 |
|
|
$graphcmd .= "COMMENT:\"in-block\t\" ";
|
692 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:MAX:%7.2lf %s pps\" ";
|
693 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
694 |
|
|
$graphcmd .= "GPRINT:\"$curif-in_pps_block:LAST:%7.2lf %S pps\" ";
|
695 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_in_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
696 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
697 |
505483ce
|
smos
|
$graphcmd .= "COMMENT:\"out-block\t\" ";
|
698 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:MAX:%7.2lf %s pps\" ";
|
699 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
700 |
|
|
$graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" ";
|
701 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_out_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
702 |
cebd086a
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
703 |
|
|
|
704 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
705 |
bf7c1674
|
Seth Mos
|
$graphcmd .= "COMMENT:\"in-pass6\t\" ";
|
706 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:MAX:%7.2lf %s pps\" ";
|
707 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
708 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_pass:LAST:%7.2lf %S pps\" ";
|
709 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_in6_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
710 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
711 |
|
|
$graphcmd .= "COMMENT:\"out-pass6\t\" ";
|
712 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:MAX:%7.2lf %s pps\" ";
|
713 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:AVERAGE:%7.2lf %S pps\" ";
|
714 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_pass:LAST:%7.2lf %S pps\" ";
|
715 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_out6_t_pass:AVERAGE:%7.2lf %s pkts\" ";
|
716 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
717 |
|
|
$graphcmd .= "COMMENT:\"in-block6\t\" ";
|
718 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:MAX:%7.2lf %s pps\" ";
|
719 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
720 |
|
|
$graphcmd .= "GPRINT:\"$curif-in6_pps_block:LAST:%7.2lf %S pps\" ";
|
721 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_in6_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
722 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
723 |
|
|
$graphcmd .= "COMMENT:\"out-pass6\t\" ";
|
724 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:MAX:%7.2lf %s pps\" ";
|
725 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
726 |
|
|
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" ";
|
727 |
|
|
$graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
728 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
729 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
730 |
95919c39
|
Seth Mos
|
}
|
731 |
2f80d451
|
Seth Mos
|
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
732 |
|
|
/* define graphcmd for packets stats */
|
733 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
734 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
735 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"snr/channel/rate\" ";
|
736 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
737 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
738 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
739 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE:step=$step\" ";
|
740 |
|
|
$graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE:step=$step\" ";
|
741 |
|
|
$graphcmd .= "DEF:\"$curif-channel=$rrddbpath$curdatabase:channel:AVERAGE:step=$step\" ";
|
742 |
8512951f
|
Seth Mos
|
$graphcmd .= "LINE2:\"$curif-snr#{$colorwireless[0]}:$curif-snr\" ";
|
743 |
|
|
$graphcmd .= "LINE2:\"$curif-rate#{$colorwireless[1]}:$curif-rate\" ";
|
744 |
|
|
$graphcmd .= "LINE2:\"$curif-channel#{$colorwireless[2]}:$curif-channel\" ";
|
745 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
746 |
8512951f
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\\n\" ";
|
747 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"SNR\t\t\" ";
|
748 |
8512951f
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-snr:MAX:%7.2lf dBi \" ";
|
749 |
|
|
$graphcmd .= "GPRINT:\"$curif-snr:AVERAGE:%7.2lf dBi \" ";
|
750 |
|
|
$graphcmd .= "GPRINT:\"$curif-snr:LAST:%7.2lf dBi\" ";
|
751 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
752 |
|
|
$graphcmd .= "COMMENT:\"RATE\t\t\" ";
|
753 |
8512951f
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-rate:MAX:%7.2lf Mb \" ";
|
754 |
|
|
$graphcmd .= "GPRINT:\"$curif-rate:AVERAGE:%7.2lf Mb \" ";
|
755 |
|
|
$graphcmd .= "GPRINT:\"$curif-rate:LAST:%7.2lf Mb\" ";
|
756 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
757 |
|
|
$graphcmd .= "COMMENT:\"Channel\t\" ";
|
758 |
8512951f
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-channel:MAX:%7.2lf \" ";
|
759 |
|
|
$graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf \" ";
|
760 |
|
|
$graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf\" ";
|
761 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
762 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
763 |
95919c39
|
Seth Mos
|
}
|
764 |
3869a323
|
smos
|
elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
765 |
|
|
/* define graphcmd for vpn users stats */
|
766 |
|
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
767 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
768 |
3869a323
|
smos
|
$graphcmd .= "--vertical-label \"users\" ";
|
769 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
770 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
771 |
3869a323
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
772 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE:step=$step\" ";
|
773 |
3869a323
|
smos
|
$graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" ";
|
774 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
775 |
|
|
$graphcmd .= "COMMENT:\"\t\t\t maximum\t\t average\t current\\n\" ";
|
776 |
|
|
$graphcmd .= "COMMENT:\"Users Online\t\" ";
|
777 |
|
|
$graphcmd .= "GPRINT:\"$curif-users:MAX:%7.2lf \" ";
|
778 |
|
|
$graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf \" ";
|
779 |
|
|
$graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" ";
|
780 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
781 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
782 |
3869a323
|
smos
|
}
|
783 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
784 |
|
|
/* define graphcmd for states stats */
|
785 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
786 |
1e86f510
|
N0YB
|
$graphcmd .= "--start -$seconds -e -$average --step $step ";
|
787 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"states, ip\" ";
|
788 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
789 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
790 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
791 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE:step=$step\" ";
|
792 |
|
|
$graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE:step=$step\" ";
|
793 |
|
|
$graphcmd .= "DEF:\"$curif-pfnat=$rrddbpath$curdatabase:pfnat:AVERAGE:step=$step\" ";
|
794 |
|
|
$graphcmd .= "DEF:\"$curif-srcip=$rrddbpath$curdatabase:srcip:AVERAGE:step=$step\" ";
|
795 |
|
|
$graphcmd .= "DEF:\"$curif-dstip=$rrddbpath$curdatabase:dstip:AVERAGE:step=$step\" ";
|
796 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$curif-pfrate_t=$curif-pfrate,0,1000000,LIMIT,UN,0,$curif-pfrate,IF,$seconds,*\" ";
|
797 |
|
|
$graphcmd .= "LINE1:\"$curif-pfrate#{$colorstates[0]}:$curif-pfrate\" ";
|
798 |
|
|
$graphcmd .= "LINE1:\"$curif-pfstates#{$colorstates[1]}:$curif-pfstates\" ";
|
799 |
|
|
$graphcmd .= "LINE1:\"$curif-pfnat#{$colorstates[2]}:$curif-pfnat\" ";
|
800 |
|
|
$graphcmd .= "LINE1:\"$curif-srcip#{$colorstates[3]}:$curif-srcip\" ";
|
801 |
|
|
$graphcmd .= "LINE1:\"$curif-dstip#{$colorstates[4]}:$curif-dstip\" ";
|
802 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
803 |
|
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current period\\n\" ";
|
804 |
|
|
$graphcmd .= "COMMENT:\"state changes\" ";
|
805 |
9aa18b77
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-pfrate:MIN:%7.2lf %s cps\" ";
|
806 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfrate:AVERAGE:%7.2lf %s cps\" ";
|
807 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfrate:MAX:%7.2lf %s cps\" ";
|
808 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfrate:LAST:%7.2lf %S cps\" ";
|
809 |
7c6fe5c5
|
seth
|
$graphcmd .= "GPRINT:\"$curif-pfrate_t:AVERAGE:%7.2lf %s chg\" ";
|
810 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
811 |
|
|
$graphcmd .= "COMMENT:\"filter states\" ";
|
812 |
9aa18b77
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-pfstates:MIN:%7.2lf %s \" ";
|
813 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfstates:AVERAGE:%7.2lf %s \" ";
|
814 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfstates:MAX:%7.2lf %s \" ";
|
815 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfstates:LAST:%7.2lf %s \" ";
|
816 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
817 |
|
|
$graphcmd .= "COMMENT:\"nat states \" ";
|
818 |
9aa18b77
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-pfnat:MIN:%7.2lf %s \" ";
|
819 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfnat:AVERAGE:%7.2lf %s \" ";
|
820 |
|
|
$graphcmd .= "GPRINT:\"$curif-pfnat:MAX:%7.2lf %s \" ";
|
821 |
b03494e4
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-pfnat:LAST:%7.2lf %s \" ";
|
822 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
823 |
|
|
$graphcmd .= "COMMENT:\"Source addr. \" ";
|
824 |
9aa18b77
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-srcip:MIN:%7.2lf %s \" ";
|
825 |
|
|
$graphcmd .= "GPRINT:\"$curif-srcip:AVERAGE:%7.2lf %s \" ";
|
826 |
|
|
$graphcmd .= "GPRINT:\"$curif-srcip:MAX:%7.2lf %s \" ";
|
827 |
|
|
$graphcmd .= "GPRINT:\"$curif-srcip:LAST:%7.2lf %s \" ";
|
828 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
829 |
|
|
$graphcmd .= "COMMENT:\"Dest. addr. \" ";
|
830 |
9aa18b77
|
Seth Mos
|
$graphcmd .= "GPRINT:\"$curif-dstip:MIN:%7.2lf %s \" ";
|
831 |
|
|
$graphcmd .= "GPRINT:\"$curif-dstip:AVERAGE:%7.2lf %s \" ";
|
832 |
|
|
$graphcmd .= "GPRINT:\"$curif-dstip:MAX:%7.2lf %s \" ";
|
833 |
|
|
$graphcmd .= "GPRINT:\"$curif-dstip:LAST:%7.2lf %s \" ";
|
834 |
95919c39
|
Seth Mos
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
835 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
836 |
95919c39
|
Seth Mos
|
}
|
837 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
838 |
|
|
/* define graphcmd for processor stats */
|
839 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
840 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
841 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"utilization, number\" ";
|
842 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
843 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
844 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
845 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE:step=$step\" ";
|
846 |
|
|
$graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE:step=$step\" ";
|
847 |
|
|
$graphcmd .= "DEF:\"system=$rrddbpath$curdatabase:system:AVERAGE:step=$step\" ";
|
848 |
|
|
$graphcmd .= "DEF:\"interrupt=$rrddbpath$curdatabase:interrupt:AVERAGE:step=$step\" ";
|
849 |
|
|
$graphcmd .= "DEF:\"processes=$rrddbpath$curdatabase:processes:AVERAGE:step=$step\" ";
|
850 |
95919c39
|
Seth Mos
|
$graphcmd .= "AREA:\"user#{$colorprocessor[0]}:user\" ";
|
851 |
|
|
$graphcmd .= "AREA:\"nice#{$colorprocessor[1]}:nice:STACK\" ";
|
852 |
|
|
$graphcmd .= "AREA:\"system#{$colorprocessor[2]}:system:STACK\" ";
|
853 |
|
|
$graphcmd .= "AREA:\"interrupt#{$colorprocessor[3]}:interrupt:STACK\" ";
|
854 |
|
|
$graphcmd .= "LINE2:\"processes#{$colorprocessor[4]}:processes\" ";
|
855 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
856 |
|
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
857 |
|
|
$graphcmd .= "COMMENT:\"User util. \" ";
|
858 |
|
|
$graphcmd .= "GPRINT:\"user:MIN:%7.2lf %s \" ";
|
859 |
|
|
$graphcmd .= "GPRINT:\"user:AVERAGE:%7.2lf %s \" ";
|
860 |
|
|
$graphcmd .= "GPRINT:\"user:MAX:%7.2lf %s \" ";
|
861 |
|
|
$graphcmd .= "GPRINT:\"user:LAST:%7.2lf %S \" ";
|
862 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
863 |
|
|
$graphcmd .= "COMMENT:\"Nice util. \" ";
|
864 |
|
|
$graphcmd .= "GPRINT:\"nice:MIN:%7.2lf %s \" ";
|
865 |
|
|
$graphcmd .= "GPRINT:\"nice:AVERAGE:%7.2lf %s \" ";
|
866 |
|
|
$graphcmd .= "GPRINT:\"nice:MAX:%7.2lf %s \" ";
|
867 |
|
|
$graphcmd .= "GPRINT:\"nice:LAST:%7.2lf %s \" ";
|
868 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
869 |
|
|
$graphcmd .= "COMMENT:\"System util. \" ";
|
870 |
|
|
$graphcmd .= "GPRINT:\"system:MIN:%7.2lf %s \" ";
|
871 |
|
|
$graphcmd .= "GPRINT:\"system:AVERAGE:%7.2lf %s \" ";
|
872 |
|
|
$graphcmd .= "GPRINT:\"system:MAX:%7.2lf %s \" ";
|
873 |
|
|
$graphcmd .= "GPRINT:\"system:LAST:%7.2lf %s \" ";
|
874 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
875 |
|
|
$graphcmd .= "COMMENT:\"Interrupt \" ";
|
876 |
|
|
$graphcmd .= "GPRINT:\"interrupt:MIN:%7.2lf %s \" ";
|
877 |
|
|
$graphcmd .= "GPRINT:\"interrupt:AVERAGE:%7.2lf %s \" ";
|
878 |
|
|
$graphcmd .= "GPRINT:\"interrupt:MAX:%7.2lf %s \" ";
|
879 |
|
|
$graphcmd .= "GPRINT:\"interrupt:LAST:%7.2lf %s \" ";
|
880 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
881 |
|
|
$graphcmd .= "COMMENT:\"Processes \" ";
|
882 |
|
|
$graphcmd .= "GPRINT:\"processes:MIN:%7.2lf %s \" ";
|
883 |
|
|
$graphcmd .= "GPRINT:\"processes:AVERAGE:%7.2lf %s \" ";
|
884 |
|
|
$graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s \" ";
|
885 |
|
|
$graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s \" ";
|
886 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
887 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
888 |
95919c39
|
Seth Mos
|
}
|
889 |
f8e70893
|
Seth Mos
|
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
890 |
|
|
/* define graphcmd for memory usage stats */
|
891 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
892 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
893 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"utilization, percent\" ";
|
894 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
895 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
896 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
897 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE:step=$step\" ";
|
898 |
|
|
$graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE:step=$step\" ";
|
899 |
|
|
$graphcmd .= "DEF:\"free=$rrddbpath$curdatabase:free:AVERAGE:step=$step\" ";
|
900 |
|
|
$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
|
901 |
|
|
$graphcmd .= "DEF:\"wire=$rrddbpath$curdatabase:wire:AVERAGE:step=$step\" ";
|
902 |
95919c39
|
Seth Mos
|
$graphcmd .= "LINE2:\"active#{$colormemory[0]}:active\" ";
|
903 |
|
|
$graphcmd .= "LINE2:\"inactive#{$colormemory[1]}:inactive\" ";
|
904 |
|
|
$graphcmd .= "LINE2:\"free#{$colormemory[2]}:free\" ";
|
905 |
|
|
$graphcmd .= "LINE2:\"cache#{$colormemory[3]}:cache\" ";
|
906 |
|
|
$graphcmd .= "LINE2:\"wire#{$colormemory[4]}:wire\" ";
|
907 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
908 |
|
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
909 |
|
|
$graphcmd .= "COMMENT:\"Active. \" ";
|
910 |
|
|
$graphcmd .= "GPRINT:\"active:MIN:%7.2lf %s \" ";
|
911 |
|
|
$graphcmd .= "GPRINT:\"active:AVERAGE:%7.2lf %s \" ";
|
912 |
|
|
$graphcmd .= "GPRINT:\"active:MAX:%7.2lf %s \" ";
|
913 |
|
|
$graphcmd .= "GPRINT:\"active:LAST:%7.2lf %S \" ";
|
914 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
915 |
|
|
$graphcmd .= "COMMENT:\"Inactive. \" ";
|
916 |
|
|
$graphcmd .= "GPRINT:\"inactive:MIN:%7.2lf %s \" ";
|
917 |
|
|
$graphcmd .= "GPRINT:\"inactive:AVERAGE:%7.2lf %s \" ";
|
918 |
|
|
$graphcmd .= "GPRINT:\"inactive:MAX:%7.2lf %s \" ";
|
919 |
|
|
$graphcmd .= "GPRINT:\"inactive:LAST:%7.2lf %S \" ";
|
920 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
921 |
|
|
$graphcmd .= "COMMENT:\"Free. \" ";
|
922 |
|
|
$graphcmd .= "GPRINT:\"free:MIN:%7.2lf %s \" ";
|
923 |
|
|
$graphcmd .= "GPRINT:\"free:AVERAGE:%7.2lf %s \" ";
|
924 |
|
|
$graphcmd .= "GPRINT:\"free:MAX:%7.2lf %s \" ";
|
925 |
|
|
$graphcmd .= "GPRINT:\"free:LAST:%7.2lf %S \" ";
|
926 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
927 |
|
|
$graphcmd .= "COMMENT:\"Cached. \" ";
|
928 |
|
|
$graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" ";
|
929 |
|
|
$graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" ";
|
930 |
|
|
$graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" ";
|
931 |
|
|
$graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" ";
|
932 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
933 |
|
|
$graphcmd .= "COMMENT:\"Wired. \" ";
|
934 |
|
|
$graphcmd .= "GPRINT:\"wire:MIN:%7.2lf %s \" ";
|
935 |
|
|
$graphcmd .= "GPRINT:\"wire:AVERAGE:%7.2lf %s \" ";
|
936 |
|
|
$graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s \" ";
|
937 |
|
|
$graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S \" ";
|
938 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
939 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
940 |
95919c39
|
Seth Mos
|
}
|
941 |
ae9cb658
|
jim-p
|
elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
942 |
|
|
/* define graphcmd for mbuf usage stats */
|
943 |
|
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
944 |
|
|
$graphcmd .= "--start $start --end $end --step $step ";
|
945 |
c2a58cd1
|
jim-p
|
$graphcmd .= "--vertical-label \"utilization, percent\" ";
|
946 |
ae9cb658
|
jim-p
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
947 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
|
948 |
ae9cb658
|
jim-p
|
$graphcmd .= "--height 200 --width 620 ";
|
949 |
|
|
$graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE:step=$step\" ";
|
950 |
|
|
$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
|
951 |
|
|
$graphcmd .= "DEF:\"total=$rrddbpath$curdatabase:total:AVERAGE:step=$step\" ";
|
952 |
|
|
$graphcmd .= "DEF:\"max=$rrddbpath$curdatabase:max:AVERAGE:step=$step\" ";
|
953 |
|
|
$graphcmd .= "LINE2:\"current#{$colormbuf[0]}:current\" ";
|
954 |
|
|
$graphcmd .= "LINE2:\"cache#{$colormbuf[1]}:cache\" ";
|
955 |
|
|
$graphcmd .= "LINE2:\"total#{$colormbuf[2]}:total\" ";
|
956 |
|
|
$graphcmd .= "LINE2:\"max#{$colormbuf[3]}:max\" ";
|
957 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
958 |
|
|
$graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
|
959 |
|
|
$graphcmd .= "COMMENT:\"Current. \" ";
|
960 |
|
|
$graphcmd .= "GPRINT:\"current:MIN:%7.2lf %s \" ";
|
961 |
|
|
$graphcmd .= "GPRINT:\"current:AVERAGE:%7.2lf %s \" ";
|
962 |
|
|
$graphcmd .= "GPRINT:\"current:MAX:%7.2lf %s \" ";
|
963 |
|
|
$graphcmd .= "GPRINT:\"current:LAST:%7.2lf %S \" ";
|
964 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
965 |
|
|
$graphcmd .= "COMMENT:\"Cache. \" ";
|
966 |
|
|
$graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" ";
|
967 |
|
|
$graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" ";
|
968 |
|
|
$graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" ";
|
969 |
|
|
$graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" ";
|
970 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
971 |
|
|
$graphcmd .= "COMMENT:\"Total. \" ";
|
972 |
|
|
$graphcmd .= "GPRINT:\"total:MIN:%7.2lf %s \" ";
|
973 |
|
|
$graphcmd .= "GPRINT:\"total:AVERAGE:%7.2lf %s \" ";
|
974 |
|
|
$graphcmd .= "GPRINT:\"total:MAX:%7.2lf %s \" ";
|
975 |
|
|
$graphcmd .= "GPRINT:\"total:LAST:%7.2lf %S \" ";
|
976 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
977 |
|
|
$graphcmd .= "COMMENT:\"Max. \" ";
|
978 |
|
|
$graphcmd .= "GPRINT:\"max:MIN:%7.2lf %s \" ";
|
979 |
|
|
$graphcmd .= "GPRINT:\"max:AVERAGE:%7.2lf %s \" ";
|
980 |
|
|
$graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s \" ";
|
981 |
|
|
$graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S \" ";
|
982 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
983 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
984 |
ae9cb658
|
jim-p
|
}
|
985 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
986 |
cbe30115
|
Scott Ullrich
|
/* define graphcmd for queue stats */
|
987 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
988 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
989 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"bits/sec\" ";
|
990 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
991 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
992 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
993 |
95919c39
|
Seth Mos
|
if ($altq) {
|
994 |
|
|
$a_queues =& $altq->get_queue_list();
|
995 |
eb1f8f8e
|
Chris Buechler
|
$t = 0;
|
996 |
95919c39
|
Seth Mos
|
} else {
|
997 |
|
|
$a_queues = array();
|
998 |
cbe30115
|
Scott Ullrich
|
$i = 0;
|
999 |
|
|
$t = 0;
|
1000 |
|
|
}
|
1001 |
95919c39
|
Seth Mos
|
foreach ($a_queues as $name => $q) {
|
1002 |
|
|
$color = "$colorqueuesup[$t]";
|
1003 |
|
|
if($t > 0) { $stack = ":STACK"; }
|
1004 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE:step=$step\" ";
|
1005 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
|
1006 |
|
|
$graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
|
1007 |
401feeb3
|
Warren Baker
|
$graphcmd .= "$AREA:\"$name-bits_out#${color}:$name$stack\" ";
|
1008 |
95919c39
|
Seth Mos
|
$t++;
|
1009 |
|
|
if($t > 7) { $t = 0; }
|
1010 |
|
|
}
|
1011 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1012 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1013 |
95919c39
|
Seth Mos
|
}
|
1014 |
21a0464c
|
Ermal Luçi
|
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1015 |
6ab7ae50
|
Seth Mos
|
/* define graphcmd for queuedrop stats */
|
1016 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1017 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1018 |
95919c39
|
Seth Mos
|
$graphcmd .= "--vertical-label \"drops / sec\" ";
|
1019 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1020 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1021 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
1022 |
95919c39
|
Seth Mos
|
if ($altq) {
|
1023 |
|
|
$a_queues =& $altq->get_queue_list();
|
1024 |
bb641bf8
|
jim-p
|
$t = 0;
|
1025 |
95919c39
|
Seth Mos
|
} else {
|
1026 |
|
|
$a_queues = array();
|
1027 |
6ab7ae50
|
Seth Mos
|
$i = 0;
|
1028 |
|
|
$t = 0;
|
1029 |
|
|
}
|
1030 |
95919c39
|
Seth Mos
|
foreach ($a_queues as $name => $q) {
|
1031 |
|
|
$color = "$colorqueuesdropup[$t]";
|
1032 |
|
|
if($t > 0) { $stack = ":STACK"; }
|
1033 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE:step=$step\" ";
|
1034 |
95919c39
|
Seth Mos
|
$graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
|
1035 |
|
|
$graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
|
1036 |
|
|
$graphcmd .= "CDEF:\"$name-bits_out_neg=$name-bits_out,$multiplier,*\" ";
|
1037 |
401feeb3
|
Warren Baker
|
$graphcmd .= "$AREA:\"$name-bits_out_neg#${color}:$name$stack\" ";
|
1038 |
95919c39
|
Seth Mos
|
$t++;
|
1039 |
|
|
if($t > 7) { $t = 0; }
|
1040 |
|
|
}
|
1041 |
|
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1042 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1043 |
95919c39
|
Seth Mos
|
}
|
1044 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1045 |
cbe30115
|
Scott Ullrich
|
/* make a link quality graphcmd, we only have WAN for now, others too follow */
|
1046 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
|
1047 |
1e86f510
|
N0YB
|
--start $start --end $end --step $step \\
|
1048 |
2d1e985d
|
Renato Botelho
|
--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
|
1049 |
89d25faf
|
Seth Mos
|
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
|
1050 |
cbe30115
|
Scott Ullrich
|
--vertical-label \"ms / %\" \\
|
1051 |
7c5fbaa2
|
Seth Mos
|
--height 200 --width 620 \\
|
1052 |
7d906758
|
smos
|
--lower-limit 0 \\
|
1053 |
1e86f510
|
N0YB
|
DEF:delayraw=$rrddbpath$curdatabase:delay:AVERAGE:step=$step \\
|
1054 |
|
|
DEF:loss=$rrddbpath$curdatabase:loss:AVERAGE:step=$step \\
|
1055 |
96ae3e86
|
Seth Mos
|
\"CDEF:delay=delayraw,1000,*\" \\
|
1056 |
c444db24
|
Seth Mos
|
\"CDEF:roundavg=delay,PREV(delay),+,2,/\" \\
|
1057 |
1e36cb08
|
Seth Mos
|
\"CDEF:loss10=loss,$multiplier,*\" \\
|
1058 |
c444db24
|
Seth Mos
|
\"CDEF:r0=delay,20,MIN\" \\
|
1059 |
|
|
\"CDEF:r1=delay,60,MIN\" \\
|
1060 |
|
|
\"CDEF:r2=delay,180,MIN\" \\
|
1061 |
|
|
\"CDEF:r3=delay,420,MIN\" \\
|
1062 |
|
|
COMMENT:\"\t\t\t\t\tDelay\t\t\tPacket loss\\n\" \\
|
1063 |
|
|
AREA:delay#$colorqualityrtt[0]:\"> 420 ms\" \\
|
1064 |
|
|
GPRINT:delay:MIN:\"\t\tMin\\: %7.2lf ms\" \\
|
1065 |
4a505523
|
Seth Mos
|
GPRINT:loss:MIN:\"\tMin\\: %3.1lf %%\\n\" \\
|
1066 |
6ab7ae50
|
Seth Mos
|
AREA:r3#$colorqualityrtt[1]:\"180-420 ms\" \\
|
1067 |
c444db24
|
Seth Mos
|
GPRINT:delay:AVERAGE:\"\t\tAvg\\: %7.2lf ms\" \\
|
1068 |
4a505523
|
Seth Mos
|
GPRINT:loss:AVERAGE:\"\tAvg\\: %3.1lf %%\\n\" \\
|
1069 |
6ab7ae50
|
Seth Mos
|
AREA:r2#$colorqualityrtt[2]:\"60-180 ms\" \\
|
1070 |
c444db24
|
Seth Mos
|
GPRINT:delay:MAX:\"\t\tMax\\: %7.2lf ms\" \\
|
1071 |
4a505523
|
Seth Mos
|
GPRINT:loss:MAX:\"\tMax\\: %3.1lf %%\\n\" \\
|
1072 |
1e36cb08
|
Seth Mos
|
AREA:r1#$colorqualityrtt[3]:\"20-60 ms\\n\" \\
|
1073 |
6ab7ae50
|
Seth Mos
|
AREA:r0#$colorqualityrtt[4]:\"< 20 ms\" \\
|
1074 |
c444db24
|
Seth Mos
|
GPRINT:delay:LAST:\"\t\tLast\\: %7.2lf ms\" \\
|
1075 |
4a505523
|
Seth Mos
|
GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
|
1076 |
6ab7ae50
|
Seth Mos
|
AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
|
1077 |
c444db24
|
Seth Mos
|
LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
|
1078 |
2d1e985d
|
Renato Botelho
|
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
|
1079 |
95919c39
|
Seth Mos
|
}
|
1080 |
6ab7ae50
|
Seth Mos
|
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1081 |
cbe30115
|
Scott Ullrich
|
/* graph a spamd statistics graph */
|
1082 |
92273f24
|
jim-p
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
|
1083 |
1e86f510
|
N0YB
|
--start $start --end $end --step $step \\
|
1084 |
2d1e985d
|
Renato Botelho
|
--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
|
1085 |
92273f24
|
jim-p
|
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
|
1086 |
|
|
--vertical-label=\"Conn / Time, sec.\" \\
|
1087 |
|
|
--height 200 --width 620 --no-gridfit \\
|
1088 |
|
|
--lower-limit 0 \\
|
1089 |
1e86f510
|
N0YB
|
DEF:consmin=$rrddbpath$curdatabase:conn:MIN:step=$step \\
|
1090 |
|
|
DEF:consavg=$rrddbpath$curdatabase:conn:AVERAGE:step=$step \\
|
1091 |
|
|
DEF:consmax=$rrddbpath$curdatabase:conn:MAX:step=$step \\
|
1092 |
|
|
DEF:timemin=$rrddbpath$curdatabase:time:MIN:step=$step \\
|
1093 |
|
|
DEF:timeavg=$rrddbpath$curdatabase:time:AVERAGE:step=$step \\
|
1094 |
|
|
DEF:timemax=$rrddbpath$curdatabase:time:MAX:step=$step \\
|
1095 |
92273f24
|
jim-p
|
\"CDEF:timeminadj=timemin,0,86400,LIMIT,UN,0,timemin,IF\" \\
|
1096 |
|
|
\"CDEF:timeavgadj=timeavg,0,86400,LIMIT,UN,0,timeavg,IF\" \\
|
1097 |
|
|
\"CDEF:timemaxadj=timemax,0,86400,LIMIT,UN,0,timemax,IF\" \\
|
1098 |
|
|
\"CDEF:t1=timeminadj,timeavgadj,+,2,/,timeminadj,-\" \\
|
1099 |
|
|
\"CDEF:t2=timeavgadj,timemaxadj,+,2,/,timeminadj,-,t1,-\" \\
|
1100 |
|
|
\"CDEF:t3=timemaxadj,timeminadj,-,t1,-,t2,-\" \\
|
1101 |
|
|
AREA:timeminadj \\
|
1102 |
|
|
AREA:t1#$colorspamdtime[0]::STACK \\
|
1103 |
|
|
AREA:t2#$colorspamdtime[1]::STACK \\
|
1104 |
|
|
AREA:t3#$colorspamdtime[2]::STACK \\
|
1105 |
|
|
LINE2:timeavgadj#$colorspamdtime[3]:\"Time \" \\
|
1106 |
|
|
GPRINT:timeminadj:MIN:\"Min\\:%6.2lf\\t\" \\
|
1107 |
|
|
GPRINT:timeavgadj:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
|
1108 |
|
|
GPRINT:timemaxadj:MAX:\"Max\\:%6.2lf\\n\" \\
|
1109 |
|
|
AREA:consmax#$colorspamdconn[0] \\
|
1110 |
|
|
AREA:consmin#$colorspamdconn[1] \\
|
1111 |
|
|
LINE1:consmin#$colorspamdconn[2] \\
|
1112 |
|
|
LINE1:consmax#$colorspamdconn[3] \\
|
1113 |
|
|
LINE1:consavg#$colorspamdconn[4]:\"Cons \" \\
|
1114 |
|
|
GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
|
1115 |
|
|
GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
|
1116 |
|
|
GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
|
1117 |
2d1e985d
|
Renato Botelho
|
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1118 |
ec51a222
|
thompsa
|
}
|
1119 |
|
|
elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1120 |
7d906758
|
smos
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1121 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1122 |
ec51a222
|
thompsa
|
$graphcmd .= "--vertical-label \"signal\" ";
|
1123 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1124 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1125 |
7d906758
|
smos
|
$graphcmd .= "--height 200 --width 620 ";
|
1126 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-rssi=$rrddbpath$curdatabase:rssi:AVERAGE:step=$step\" ";
|
1127 |
5e589685
|
smos
|
$graphcmd .= "LINE2:\"$curif-rssi#{$colorwireless[0]}:$curif-rssi\" ";
|
1128 |
ec51a222
|
thompsa
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1129 |
|
|
$graphcmd .= "COMMENT:\"\t\t maximum\t\t average\t current\\n\" ";
|
1130 |
5e589685
|
smos
|
$graphcmd .= "COMMENT:\"RSSI\t\t\" ";
|
1131 |
|
|
$graphcmd .= "GPRINT:\"$curif-rssi:MAX:%7.2lf \" ";
|
1132 |
|
|
$graphcmd .= "GPRINT:\"$curif-rssi:AVERAGE:%7.2lf \" ";
|
1133 |
|
|
$graphcmd .= "GPRINT:\"$curif-rssi:LAST:%7.2lf \" ";
|
1134 |
ec51a222
|
thompsa
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1135 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1136 |
ec51a222
|
thompsa
|
}
|
1137 |
20413b72
|
Warren Baker
|
elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1138 |
|
|
/* define graphcmd for online Captive Portal users stats */
|
1139 |
|
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1140 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1141 |
20413b72
|
Warren Baker
|
$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
|
1142 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1143 |
73bf4a46
|
Warren Baker
|
$graphcmd .= "--base=1000 ";
|
1144 |
|
|
$graphcmd .= "--lower-limit=0 ";
|
1145 |
|
|
$graphcmd .= "--slope-mode ";
|
1146 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1147 |
20413b72
|
Warren Baker
|
$graphcmd .= "--height 200 --width 620 ";
|
1148 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE:step=$step\" ";
|
1149 |
73bf4a46
|
Warren Baker
|
$graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" ";
|
1150 |
1a6cb6e7
|
Warren Baker
|
$graphcmd .= "CDEF:\"$curif-totalusers_d=$curif-totalusers_t,FLOOR\" ";
|
1151 |
|
|
$graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" ";
|
1152 |
|
|
$graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" ";
|
1153 |
20413b72
|
Warren Baker
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1154 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1155 |
20413b72
|
Warren Baker
|
}
|
1156 |
|
|
elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
1157 |
|
|
/* define graphcmd for online Captive Portal users stats */
|
1158 |
|
|
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
1159 |
1e86f510
|
N0YB
|
$graphcmd .= "--start $start --end $end --step $step ";
|
1160 |
20413b72
|
Warren Baker
|
$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
|
1161 |
|
|
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
1162 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
1163 |
7e5f3edb
|
Warren Baker
|
$graphcmd .= "--base=1000 ";
|
1164 |
|
|
$graphcmd .= "--lower-limit=0 ";
|
1165 |
|
|
$graphcmd .= "--slope-mode ";
|
1166 |
|
|
$graphcmd .= "--height 200 --width 620 ";
|
1167 |
1e86f510
|
N0YB
|
$graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE:step=$step\" ";
|
1168 |
73bf4a46
|
Warren Baker
|
$graphcmd .= "AREA:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:Concurrent Users\" ";
|
1169 |
7e5f3edb
|
Warren Baker
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1170 |
|
|
$graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" ";
|
1171 |
|
|
$graphcmd .= "COMMENT:\"Users Online\t\" ";
|
1172 |
73bf4a46
|
Warren Baker
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%8.0lf \" ";
|
1173 |
|
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf \" ";
|
1174 |
|
|
$graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" ";
|
1175 |
7e5f3edb
|
Warren Baker
|
$graphcmd .= "COMMENT:\"\\n\" ";
|
1176 |
2d1e985d
|
Renato Botelho
|
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
|
1177 |
7e5f3edb
|
Warren Baker
|
}
|
1178 |
ec51a222
|
thompsa
|
else {
|
1179 |
95919c39
|
Seth Mos
|
$data = false;
|
1180 |
3a3fb8ea
|
Erik Fonnesbeck
|
log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase));
|
1181 |
95919c39
|
Seth Mos
|
}
|
1182 |
cbe30115
|
Scott Ullrich
|
|
1183 |
95919c39
|
Seth Mos
|
/* check modification time to see if we need to generate image */
|
1184 |
7d906758
|
smos
|
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
|
1185 |
668ce1f9
|
Seth Mos
|
if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 15 ) {
|
1186 |
c444db24
|
Seth Mos
|
if($data)
|
1187 |
2d1e985d
|
Renato Botelho
|
$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
|
1188 |
95919c39
|
Seth Mos
|
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
|
1189 |
6ab7ae50
|
Seth Mos
|
flush();
|
1190 |
cbe30115
|
Scott Ullrich
|
usleep(500);
|
1191 |
95919c39
|
Seth Mos
|
}
|
1192 |
|
|
} else {
|
1193 |
|
|
if($data)
|
1194 |
2d1e985d
|
Renato Botelho
|
$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
|
1195 |
95919c39
|
Seth Mos
|
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
|
1196 |
|
|
flush();
|
1197 |
|
|
usleep(500);
|
1198 |
|
|
}
|
1199 |
|
|
if(($graphcmdreturn <> 0) || (! $data)) {
|
1200 |
ddc55e12
|
Erik Fonnesbeck
|
log_error(sprintf(gettext('Failed to create graph with error code %1$s, the error is: %2$s'),$graphcmdreturn,$graphcmdoutput));
|
1201 |
95919c39
|
Seth Mos
|
if(strstr($curdatabase, "queues")) {
|
1202 |
3a3fb8ea
|
Erik Fonnesbeck
|
log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
|
1203 |
aa27de6e
|
Renato Botelho
|
unlink_if_exists($rrddbpath . $curif . $queues);
|
1204 |
95919c39
|
Seth Mos
|
flush();
|
1205 |
|
|
usleep(500);
|
1206 |
|
|
enable_rrd_graphing();
|
1207 |
cbe30115
|
Scott Ullrich
|
}
|
1208 |
95919c39
|
Seth Mos
|
if(strstr($curdatabase, "queuesdrop")) {
|
1209 |
3a3fb8ea
|
Erik Fonnesbeck
|
log_error(sprintf(gettext("failed to create graph from %s%s, removing database"),$rrddbpath,$curdatabase));
|
1210 |
aa27de6e
|
Renato Botelho
|
unlink_if_exists($rrddbpath . $curdatabase);
|
1211 |
95919c39
|
Seth Mos
|
flush();
|
1212 |
|
|
usleep(500);
|
1213 |
|
|
enable_rrd_graphing();
|
1214 |
e3d7c123
|
Seth Mos
|
}
|
1215 |
95919c39
|
Seth Mos
|
header("Content-type: image/png");
|
1216 |
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
1217 |
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
1218 |
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
1219 |
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
1220 |
|
|
header("Pragma: no-cache");
|
1221 |
|
|
$file= "/usr/local/www/themes/{$g['theme']}/images/misc/rrd_error.png";
|
1222 |
|
|
readfile($file);
|
1223 |
|
|
} else {
|
1224 |
7d906758
|
smos
|
$file = "$rrdtmppath$curdatabase-$curgraph.png";
|
1225 |
95919c39
|
Seth Mos
|
if(file_exists("$file")) {
|
1226 |
cbe30115
|
Scott Ullrich
|
header("Content-type: image/png");
|
1227 |
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
1228 |
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
1229 |
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
1230 |
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
1231 |
|
|
header("Pragma: no-cache");
|
1232 |
|
|
readfile($file);
|
1233 |
|
|
}
|
1234 |
95919c39
|
Seth Mos
|
}
|
1235 |
cbe30115
|
Scott Ullrich
|
|
1236 |
127b93cf
|
Ermal Lu?i
|
?>
|