summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-06-19 12:23:44 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-06-19 12:26:57 -0300
commit57627d9f3152f6ea984d3cdff71fa6e888784701 (patch)
treee6016b8dfd5ce90083c2026bd09bdee7f6678dbc
parentbef1056048aa2e0839fd5839e83da154f06c8c2c (diff)
downloadpfsense-57627d9f3152f6ea984d3cdff71fa6e888784701.zip
pfsense-57627d9f3152f6ea984d3cdff71fa6e888784701.tar.gz
Fix status_rrd_graph_img.php and also improve it:
- Remove escapeshellarg that broke command line - Only remove dangerous chars to avoid command injection - Replace all `hostname` calls by php_uname('n') - Replace all `date` calls by strftime() - Add $_gb to collect possibly garbage from exec return
-rw-r--r--usr/local/www/status_rrd_graph_img.php73
1 files changed, 37 insertions, 36 deletions
diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php
index 1f0edc5..b45e6a5 100644
--- a/usr/local/www/status_rrd_graph_img.php
+++ b/usr/local/www/status_rrd_graph_img.php
@@ -43,7 +43,8 @@ global $g;
$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
if ($_GET['database']) {
- $curdatabase = escapeshellarg(basename($_GET['database']));
+ $curdatabase = basename($_GET['database']);
+ $curdatabase = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($curdatabase, ENT_QUOTES | ENT_HTML401));
} else {
$curdatabase = "wan-traffic.rrd";
}
@@ -56,7 +57,7 @@ if ($_GET['style']) {
/* this is used for temp name */
if ($_GET['graph']) {
- $curgraph = escapeshellarg($_GET['graph']);
+ $curgraph = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($_GET['graph'], ENT_QUOTES | ENT_HTML401));
} else {
$curgraph = "custom";
}
@@ -329,7 +330,7 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
$graphcmd .= "--start $start --end $end --step $step --vertical-label \"bits/sec\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step ";
$graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step ";
@@ -474,7 +475,7 @@ if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabas
$graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" ";
$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif(strstr($curdatabase, "-throughput.rrd")) {
/* define graphcmd for throughput stats */
@@ -483,7 +484,7 @@ elseif(strstr($curdatabase, "-throughput.rrd")) {
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"bits/sec\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$iflist = get_configured_interface_list();
@@ -602,7 +603,7 @@ elseif(strstr($curdatabase, "-throughput.rrd")) {
$graphcmd .= "GPRINT:\"tput-out_bits_block:LAST:%7.2lf %Sb/s\" ";
$graphcmd .= "GPRINT:\"tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for packets stats */
@@ -610,7 +611,7 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"packets/sec\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step\" ";
@@ -728,7 +729,7 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat
$graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" ";
$graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for packets stats */
@@ -736,7 +737,7 @@ elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"snr/channel/rate\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE:step=$step\" ";
@@ -761,7 +762,7 @@ elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf \" ";
$graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf\" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for vpn users stats */
@@ -769,7 +770,7 @@ elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"users\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE:step=$step\" ";
$graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" ";
@@ -780,7 +781,7 @@ elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf \" ";
$graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for states stats */
@@ -788,7 +789,7 @@ elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdata
$graphcmd .= "--start -$seconds -e -$average --step $step ";
$graphcmd .= "--vertical-label \"states, ip\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE:step=$step\" ";
@@ -834,7 +835,7 @@ elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdata
$graphcmd .= "GPRINT:\"$curif-dstip:MAX:%7.2lf %s \" ";
$graphcmd .= "GPRINT:\"$curif-dstip:LAST:%7.2lf %s \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for processor stats */
@@ -842,7 +843,7 @@ elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curd
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"utilization, number\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE:step=$step\" ";
@@ -886,7 +887,7 @@ elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curd
$graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s \" ";
$graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for memory usage stats */
@@ -894,7 +895,7 @@ elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdata
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"utilization, percent\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE:step=$step\" ";
@@ -938,7 +939,7 @@ elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdata
$graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s \" ";
$graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for mbuf usage stats */
@@ -946,7 +947,7 @@ elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdataba
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"utilization, percent\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE:step=$step\" ";
$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
@@ -982,7 +983,7 @@ elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdataba
$graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s \" ";
$graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for queue stats */
@@ -990,7 +991,7 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"bits/sec\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
if ($altq) {
$a_queues =& $altq->get_queue_list();
@@ -1011,7 +1012,7 @@ elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdata
if($t > 7) { $t = 0; }
}
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for queuedrop stats */
@@ -1019,7 +1020,7 @@ elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$cur
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"drops / sec\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
if ($altq) {
$a_queues =& $altq->get_queue_list();
@@ -1041,13 +1042,13 @@ elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$cur
if($t > 7) { $t = 0; }
}
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* make a link quality graphcmd, we only have WAN for now, others too follow */
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
--start $start --end $end --step $step \\
- --title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
+ --title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
--vertical-label \"ms / %\" \\
--height 200 --width 620 \\
@@ -1077,13 +1078,13 @@ elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdat
GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
+ COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
}
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* graph a spamd statistics graph */
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
--start $start --end $end --step $step \\
- --title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
+ --title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
--color SHADEA#eeeeee --color SHADEB#eeeeee \\
--vertical-label=\"Conn / Time, sec.\" \\
--height 200 --width 620 --no-gridfit \\
@@ -1116,14 +1117,14 @@ elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdataba
GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"signal\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-rssi=$rrddbpath$curdatabase:rssi:AVERAGE:step=$step\" ";
$graphcmd .= "LINE2:\"$curif-rssi#{$colorwireless[0]}:$curif-rssi\" ";
@@ -1134,7 +1135,7 @@ elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "GPRINT:\"$curif-rssi:AVERAGE:%7.2lf \" ";
$graphcmd .= "GPRINT:\"$curif-rssi:LAST:%7.2lf \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for online Captive Portal users stats */
@@ -1145,7 +1146,7 @@ elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "--base=1000 ";
$graphcmd .= "--lower-limit=0 ";
$graphcmd .= "--slope-mode ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--height 200 --width 620 ";
$graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE:step=$step\" ";
$graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" ";
@@ -1153,7 +1154,7 @@ elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curda
$graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" ";
$graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for online Captive Portal users stats */
@@ -1161,7 +1162,7 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur
$graphcmd .= "--start $start --end $end --step $step ";
$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
- $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
+ $graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
$graphcmd .= "--base=1000 ";
$graphcmd .= "--lower-limit=0 ";
$graphcmd .= "--slope-mode ";
@@ -1175,7 +1176,7 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur
$graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf \" ";
$graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" ";
$graphcmd .= "COMMENT:\"\\n\" ";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
}
elseif((strstr($curdatabase, "ntpd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for ntpd (was: mbuf) usage stats */
@@ -1230,14 +1231,14 @@ else {
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 15 ) {
if($data)
- exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
+ $_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
flush();
usleep(500);
}
} else {
if($data)
- exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
+ $_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
flush();
usleep(500);
OpenPOWER on IntegriCloud