Merge pull request #37 from wrightsonm/master

Gateways Grafana Tabs not working correctly when WAN has ipv4 and ipv6 enabled
This commit is contained in:
VictorRobellini 2021-05-06 00:02:42 -04:00 committed by GitHub
commit f254b34a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9547 additions and 273 deletions

File diff suppressed because it is too large Load Diff

View File

@ -65,11 +65,21 @@ foreach ($iflist as $ifname => $friendly) {
}
$gw_array = return_gateways_array();
//$gw_statuses is not guarranteed to contain the same number of gateways as $gw_array
$gw_statuses = return_gateways_status(true);
$debug = false;
if($debug){
print_r($gw_array);
print_r($gw_statuses);
}
foreach ($gw_array as $gw => $gateway) {
$name = $gw_statuses[$gw]["name"];
//take the name from the $a_gateways list
$name = $gateway["name"];
$monitor = $gw_statuses[$gw]["monitorip"];
$source = $gw_statuses[$gw]["srcip"];
$delay = $gw_statuses[$gw]["delay"];
@ -106,9 +116,10 @@ foreach ($gw_array as $gw => $gateway) {
$substatus = "N/A";
}
printf("gateways,host=%s,interface=%s monitor=\"%s\",source=\"%s\",defaultgw=%s,gwdescr=\"%s\",delay=%s,stddev=%s,loss=%s,status=\"%s\",substatus=\"%s\"\n",
printf("gateways,host=%s,interface=%s,gateway_name=%s monitor=\"%s\",source=\"%s\",defaultgw=%s,gwdescr=\"%s\",delay=%s,stddev=%s,loss=%s,status=\"%s\",substatus=\"%s\"\n",
$host,
$interface,
$name,//name is required as it is possible to have 2 gateways on 1 interface. i.e. WAN_DHCP and WAN_DHCP6
$monitor,
$source,
$defaultgw,