Closed Snille closed 7 years ago
Looks like the "$gateways_status" variable is just an empty array. Maybe that's why it does not work?
It's possible it's something with a newer version of PHP they're using. I haven't upgraded to the latest pfSense yet so can't check myself right now. But from looking at the latest code, they seem to initialize the variable with array() before calling return_gateways_status():
$gateways_status = array(); $gateways_status = return_gateways_status(true);
Try adding that first line and see if it works for you. If so, I'll update the repo. Thanks!
Nope, still only get the "lan" interface in the json. :(
from their code, really the only other line from pfsense's "status_gateways.php" there is require_once("guiconfig.inc");
. Perhaps they changed something that requires that first. Maybe try dropping the following php file into that directory to see if that gives you anything.
testgateways.php:
require_once("guiconfig.inc");
//define('COLOR', true);
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
print_r($gateways_status);
Nope, just an empty array... :( Array ( )
That's really strange then, possible something else is going on then with your setup, because that's the exact code from the pfsense interface! how about when you visit your router's "Status: Gateways" page. Does that show the information, or is it blank too? http://routerip/status_gateways.php
Oh, that gave a hint! :) First I got this when entering the URL: Then I wounder, is that really right.... So I "restarted" the gateways? (clicked the circle arrow at the top right corner) and then I got this: And now it works! :)
Sorry for all your troubles... I actually did not know you could restart the "gateways". :)
ok great, glad you finally solved it! hopefully this thread will at least help others who also run into the same issue! 👍
Hi, I updated to latest version of pfSense 2.3.4-RELEASE (amd64) Then I lost my "wan" interface in the JSON output.
If I print the "$a_gateways" I get this:
Array ( [VPN_VPNV4] => Array ( [interface] => bge1 [gateway] => dynamic [name] => VPN_VPNV4 [weight] => 1 [ipprotocol] => inet [interval] => [descr] => Interface VPN_VPNV4 Gateway [dynamic] => 1 [monitor] => dynamic [friendlyiface] => lan [attribute] => 0 ) [WAN_DHCP] => Array ( [interface] => bge0 [gateway] => 81.233.82.1 [name] => WAN_DHCP [weight] => 1 [ipprotocol] => inet [interval] => [descr] => Interface WAN_DHCP Gateway [defaultgw] => 1 [dynamic] => 1 [monitor] => 81.233.82.1 [friendlyiface] => wan [attribute] => 1 ) )
But the JSON output is: {"lan":{"inKbps":3864.2620418484,"outKbps":5268.2221868671,"interface":"bge1"}}
Not sure why this happens... Any ideas? :)
Best regards Snille