summaryrefslogtreecommitdiffstats
path: root/usr/local/www/ifstats.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-08-20 19:30:33 +0000
committerErmal <eri@pfsense.org>2010-08-20 19:30:50 +0000
commit8e23b225f4274db43b3448aa8c739f4a12ee2037 (patch)
treeb75ea8eb68b4672059d6a4d1817789f889b5510d /usr/local/www/ifstats.php
parentbd961c65906fe2f2c6aec4324dc3268d31aab1b7 (diff)
downloadpfsense-8e23b225f4274db43b3448aa8c739f4a12ee2037.zip
pfsense-8e23b225f4274db43b3448aa8c739f4a12ee2037.tar.gz
Ticket #682. Use pfSense modules function to collect interface stats.
Diffstat (limited to 'usr/local/www/ifstats.php')
-rw-r--r--usr/local/www/ifstats.php22
1 files changed, 3 insertions, 19 deletions
diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php
index 562748f..09050cf 100644
--- a/usr/local/www/ifstats.php
+++ b/usr/local/www/ifstats.php
@@ -43,30 +43,14 @@
require_once('guiconfig.inc');
require_once("interfaces.inc");
- $ifinfo = array();
-
$if = $_GET['if'];
$realif = get_real_interface($if);
if(!$realif)
$realif = $if; // Need for IPSec case interface.
- /* run netstat to determine link info */
- $linkinfo = "";
- unset($linkinfo);
- exec("/usr/bin/netstat -I {$realif} -nWb -f link", $linkinfo);
- $linkinfo = preg_split("/\s+/", $linkinfo[1]);
- if (preg_match("/^enc|^tun|^pppoe|^pptp/i", $realif)) {
- $ifinfo['inpkts'] = $linkinfo[3];
- $ifinfo['inbytes'] = $linkinfo[6];
- $ifinfo['outpkts'] = $linkinfo[7];
- $ifinfo['outbytes'] = $linkinfo[9];
- } else {
- $ifinfo['inpkts'] = $linkinfo[4];
- $ifinfo['inbytes'] = $linkinfo[7];
- $ifinfo['outpkts'] = $linkinfo[8];
- $ifinfo['outbytes'] = $linkinfo[10];
- }
+ $ifinfo = pfSense_get_interface_stats($realif);
+
$temp = gettimeofday();
$timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;
@@ -78,4 +62,4 @@
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud