summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/ifstats.php
diff options
context:
space:
mode:
authorJared Dillard <jdillard@netgate.com>2016-08-23 13:21:54 -0500
committerJared Dillard <jdillard@netgate.com>2016-08-23 13:22:12 -0500
commit849d3a37a125707cc97f5de9c81f352adf348fbb (patch)
treeb503d0db6e9003e8593dedbd1dd15d587f89c905 /src/usr/local/www/ifstats.php
parent22b8293dc3d969e9eab75e0ffc58566b998d0b0b (diff)
downloadpfsense-849d3a37a125707cc97f5de9c81f352adf348fbb.zip
pfsense-849d3a37a125707cc97f5de9c81f352adf348fbb.tar.gz
change traffic graphs to use d3.js
Diffstat (limited to 'src/usr/local/www/ifstats.php')
-rw-r--r--src/usr/local/www/ifstats.php59
1 files changed, 57 insertions, 2 deletions
diff --git a/src/usr/local/www/ifstats.php b/src/usr/local/www/ifstats.php
index f01eb25..8f1c300 100644
--- a/src/usr/local/www/ifstats.php
+++ b/src/usr/local/www/ifstats.php
@@ -26,12 +26,65 @@
##|*MATCH=ifstats.php*
##|-PRIV
- require_once('guiconfig.inc');
- require_once("interfaces.inc");
+$nocsrf = true;
+
+require_once('guiconfig.inc');
+require_once("interfaces.inc");
+
+
+//overload the use of this page until the conversion of both traffic graphs have been completed
+if($_POST['if']) {
+
+ $ifs = $_POST['if'];
+
+ $ifarray = explode("|", $ifs);
+
+ $temp = gettimeofday();
+ $timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;
+ $obj = [];
+ $count = 0;
+
+ foreach ($ifarray as $if) {
+
+ $realif = get_real_interface($if);
+
+ if (!$realif) {
+ $realif = $if; // Need for IPsec case interface.
+ }
+
+ $ifinfo = pfSense_get_interface_stats($realif);
+
+ $obj[$if] = [];
+
+ $obj[$if][0]['key'] = $if . "in";
+ $obj[$if][0]['values'] = array($timing, $ifinfo['inbytes']);
+
+ $obj[$if][1]['key'] = $if . "out";
+ $obj[$if][1]['values'] = array($timing, $ifinfo['outbytes']);
+/*
+ $obj[$count]['key'] = $if . "in";
+ $obj[$count]['name'] = $if . " (in)";
+ $obj[$count]['values'] = array($timing, $ifinfo['inbytes']);
+
+ $count++;
+
+ $obj[$count]['key'] = $if . "out";
+ $obj[$count]['name'] = $if . " (out)";
+ $obj[$count]['values'] = array($timing, $ifinfo['outbytes']);
+
+ $count++;
+*/
+ }
+
+ header('Content-Type: application/json');
+ echo json_encode($obj,JSON_PRETTY_PRINT|JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_NUMERIC_CHECK);
+
+} else {
$if = $_GET['if'];
$realif = get_real_interface($if);
+
if (!$realif) {
$realif = $if; // Need for IPsec case interface.
}
@@ -48,4 +101,6 @@
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
+}
+
?>
OpenPOWER on IntegriCloud