diff options
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/status_rrd_graph.php | 16 | ||||
-rw-r--r-- | usr/local/www/status_rrd_graph_img.php | 39 | ||||
-rwxr-xr-x | usr/local/www/status_rrd_graph_settings.php | 10 |
3 files changed, 64 insertions, 1 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 28b1b4c..4505a02 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -122,6 +122,9 @@ if ($_GET['option']) { continue 2; } } + case "captiveportal": + $curoption = "allgraphs"; + break; default: $curoption = "wan"; break; @@ -173,6 +176,7 @@ $dbheader = array("allgraphs-traffic.rrd", "allgraphs-wireless.rrd", "allgraphs-cellular.rrd", "allgraphs-vpnusers.rrd", + "captiveportal-allgraphs.rrd", "allgraphs-packets.rrd", "system-allgraphs.rrd", "system-throughput.rrd", @@ -196,6 +200,9 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } + if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + $captiveportal = true; + } } /* append the existing array to the header */ $ui_databases = array_merge($dbheader, $databases); @@ -344,6 +351,10 @@ function get_dates($curperiod, $graph) { if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array("VPN", $tabactive, "status_rrd_graph.php?cat=vpnusers"); } + if($captiveportal) { + if($curcat == "captiveportal") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Captive Portal", $tabactive, "status_rrd_graph.php?cat=captiveportal"); + } if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("Custom"), $tabactive, "status_rrd_graph.php?cat=custom"); if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } @@ -387,6 +398,11 @@ function get_dates($curperiod, $graph) { $replace = array(" :: ", "", $friendly); switch($curcat) { + case "captiveportal": + $optionc = str_replace($search, $replace, $optionc[1]); + echo "<option value=\"$optionc\""; + $prettyprint = ucwords(str_replace($search, $replace, $optionc)); + break; case "system": $optionc = str_replace($search, $replace, $optionc[1]); echo "<option value=\"$optionc\""; diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 4610233..34040db 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -209,6 +209,7 @@ if(file_exists($rrdcolors)) { $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); + $colorcaptiveportalusers = array('990000'); } switch ($curstyle) { @@ -910,6 +911,44 @@ elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curda $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\"`\" "; } +elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for online Captive Portal users stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"Captive Portal Users\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE\" "; + $graphcmd .= "LINE2:\"$curif-loggedinusers#{$colorcaptiveportalusers[0]}:$curif-loggedinusers\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; + $graphcmd .= "COMMENT:\"Users Online\t\" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:LAST:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:AVERAGE:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:MAX:%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\"`\" "; +} +elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for online Captive Portal users stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"Captive Portal Users\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE\" "; + $graphcmd .= "LINE2:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:$curif-concurrentusers\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; + $graphcmd .= "COMMENT:\"Users Online\t\" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%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\"`\" "; +} else { $data = false; log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php index 7accd25..a4b562e 100755 --- a/usr/local/www/status_rrd_graph_settings.php +++ b/usr/local/www/status_rrd_graph_settings.php @@ -54,7 +54,8 @@ $categories = array('system' => gettext("System"), 'traffic' => gettext("Traffic"), 'packets' => gettext("Packets"), 'quality' => gettext("Quality"), - 'queues' => gettext("Queues")); + 'queues' => gettext("Queues"), + 'captiveportal' => gettext("Captive Portal")); $styles = array('inverse' => gettext("Inverse"), 'absolute' => gettext("Absolute")); $periods = array("absolute" => gettext("Absolute Timespans"), @@ -101,6 +102,9 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } + if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + $captiveportal = true; + } } $pgtitle = array(gettext("Status"),gettext("RRD Graphs")); @@ -143,6 +147,10 @@ include("head.inc"); if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("VPN"), $tabactive, "status_rrd_graph.php?cat=vpnusers"); } + if($captiveportal) { + if($curcat == "captiveportal") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array(gettext("Captive Portal"), $tabactive, "status_rrd_graph.php?cat=captiveportal"); + } if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("Custom"), $tabactive, "status_rrd_graph.php?cat=custom"); if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } |