added fix to list of gateways. when ipv4 and ipv6 are enabled you need gateway_name as a primary key. changed grafana to group by gateway_name instead of interface. Not sure why there are so many changes having exported the json. perhaps i have a different version of grafana?
I only changed the gateway variable to: SHOW TAG VALUES FROM "gateways" WITH KEY = "gateway_name" WHERE "host" =~ /^$Host$/ Changed group by on Gateway RTT and Gateway Loss charts to gateway_name Added gateway_name to Gateway Summary. Added interface to this list so both gateway_name and interface can be seen. telegraf --test --config /usr/local/etc/telegraf.conf before: > gateways,host=fw.anson.lan,interface=igb0 defaultgw=1,delay=0,gwdescr="Interface WAN_DHCP Gateway",loss=100,monitor="192.168.0.1",source="192.168.0.30",status="down",stddev=0,substatus="highloss" 1620242074000000000 > gateways,host=fw.anson.lan,interface=igb0 defaultgw=0,delay=0,gwdescr="Interface WAN_DHCP6 Gateway",loss=0,monitor="",source="",status="",stddev=0,substatus="N/A" 1620242074000000000 The changes to the telegraf output can be seen below: telegraf --test --config /usr/local/etc/telegraf.conf after: > gateways,gateway_name=WAN_DHCP,host=fw.anson.lan,interface=igb0 defaultgw=1,delay=0,gwdescr="Interface WAN_DHCP Gateway",loss=100,monitor="192.168.0.1",source="192.168.0.30",status="down",stddev=0,substatus="highloss" 1620242589000000000 > gateways,gateway_name=WAN_DHCP6,host=fw.anson.lan,interface=igb0 defaultgw=0,delay=0,gwdescr="Interface WAN_DHCP6 Gateway",loss=0,monitor="",source="",status="",stddev=0,substatus="N/A" 1620242589000000000
This commit is contained in:
parent
028295ff98
commit
2c916e6ad7
File diff suppressed because it is too large
Load Diff
@ -67,9 +67,20 @@ foreach ($iflist as $ifname => $friendly) {
|
||||
$gw_array = return_gateways_array();
|
||||
$gw_statuses = return_gateways_status(true);
|
||||
|
||||
$debug = false;
|
||||
|
||||
if($debug){
|
||||
print_r($a_gateways);
|
||||
print_r($gateways_status);
|
||||
}
|
||||
|
||||
foreach ($gw_array as $gw => $gateway) {
|
||||
|
||||
$name = $gw_statuses[$gw]["name"];
|
||||
//take the name from the $a_gateways list
|
||||
$name = $gateway["name"];
|
||||
|
||||
//$gateways_status is not guarranteed to contain the same number of gateways as $a_gateways
|
||||
|
||||
$monitor = $gw_statuses[$gw]["monitorip"];
|
||||
$source = $gw_statuses[$gw]["srcip"];
|
||||
$delay = $gw_statuses[$gw]["delay"];
|
||||
@ -106,9 +117,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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user