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:24:01 -0500
commit8024c54a47d72e0f9f423d59600c34a8e72ad8ab (patch)
tree30f5b6c03cdfdfa8fa2b1bd849a98467795e1c9b /src/usr/local/www/ifstats.php
parent17ffb8346ff62406831ed83cf9b0855684aca3a0 (diff)
downloadpfsense-8024c54a47d72e0f9f423d59600c34a8e72ad8ab.zip
pfsense-8024c54a47d72e0f9f423d59600c34a8e72ad8ab.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 69a3db3..d259772 100644
--- a/src/usr/local/www/ifstats.php
+++ b/src/usr/local/www/ifstats.php
@@ -58,12 +58,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.
}
@@ -80,4 +133,6 @@
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
+}
+
?>
OpenPOWER on IntegriCloud