Comments (8)
Hi again, looking good. :) Now it works without any alterations. Great work!
Thank you.
Result:
{
"lan": {
"inKbps":200.06687090799,
"outKbps":553.31116912934,
"interface":"bge1"
},
"wan": {
"inKbps":1074.477155649,
"outKbps":376.96074702806,
"interface":"bge0",
"friendlyiface":"wan",
"name":"WAN_DHCP",
"status":"okay",
"monitorip":"X.X.X.X",
"sourceip":"X.X.X.X",
"delay":"40.233ms",
"loss":"2%"
}
}
from pfsense-status-gateways-json.
I gave it one last try. I think this version should hopefully solve the problem for good! Seems em is used for intel, and bge for broadcom chipsets. But with this new version, none of it should matter since I should be accessing the correct names directly. It also shows you all the names, interfaces, etc for reference.
from pfsense-status-gateways-json.
Are you saying that you have a second WAN interface (besides "wan_dhcp") that's not showing? If so, make sure it has a name (not even sure it can't, but just in case). All the script is doing is calling pfsense's return_gateways_status($byname = true)
. So whatever shows up there should appear in the json:
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/gwlb.inc
The only other thing I can think of is that the script removes the "gw_" header (if there is one), which goes back to the original idea. If there is no name, $pfgateways[$iface]['name'] = $iface;
will likely fail and not add to the array.
if (substr($iface,0,3) == "gw_") $iface = substr($iface,3);
from pfsense-status-gateways-json.
Hi again, no, I don't have another WAN. But the one showing is not showing any traffic. When in fact traffic is both coming in and being sent. :)
PS: In between these posts I had a complete crash of my PfSense box, reinstalled it restored the settings and added the php file again... But same result as above. No traffic on the WAN...
Am I missing something? :)
from pfsense-status-gateways-json.
It seems one reason I had removed my "gw_" header is that interface statistics are not returned with it. I believe the "gw_" can be changed, and perhaps your version of "gw_" is "wan_". See if removing that from your interface name solves the problem.
if (substr($iface,0,4) == "wan_") $iface = substr($iface,4);
from pfsense-status-gateways-json.
Hmm... If I add under the foreach statement the following...
foreach ($gateways_status as $a_gateway) {
print_r($a_gateway);
This is the (only) array I get:
Is there
Array (
[monitorip] => 81.233.82.1
[srcip] => 81.233.82.162
[name] => WAN_DHCP
[delay] => 69.481ms
[stddev] => 43.64ms
[loss] => 12%
[status] => loss
)
So, then I added a new line under if ($_GET['rates'] == 1) {:
if ($_GET['rates'] == 1) {
$iface = "wan";
Forcing the interface name, and tada! It works. :)
This is the result...
{
"lan":{
"inKbps":813.62255664651,
"outKbps":159.44097443015},
"wan":{
"inKbps":247.99436511482,
"outKbps":47.978611709496,
"name":"wan",
"status":"okay",
"monitorip":"X.X.X.X",
"sourceip":"X.X.X.X",
"delay":"51.083ms",
"loss":"0.0%"
}
}
Update:
Instead of above, I change the if substr line to this:
if (substr($iface,3,7) == "_dhcp") $iface = substr($iface,0,3);
It's of course basically the same as "forcing" it to "wan". :)
from pfsense-status-gateways-json.
Glad you got it working! If you want to try it, to make things simpler I also changed the code slightly to ignore the names altogether and just iterate directly through the "real" interface names em0, em1, etc.
from pfsense-status-gateways-json.
Oh, well. That is not the name of my devices actually... :)
I guess that really depends on the hardware you are using.
Mine are called "bge0" (wan) and "bge1" (lan). :)
from pfsense-status-gateways-json.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pfsense-status-gateways-json.