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