#!/usr/local/bin/php-cgi -f $gateway) { //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 = $gateways_status[$i]["monitorip"]; $source = $gateways_status[$i]["srcip"]; $delay = $gateways_status[$i]["delay"]; $stddev = $gateways_status[$i]["stddev"]; $loss = $gateways_status[$i]["loss"]; $status = $gateways_status[$i]["status"]; $substatus = $gateways_status[$i]["substatus"]; $interface = $gateway["interface"]; $friendlyname = $gateway["friendlyiface"]; # This is not the friendly interface name so I'm not using it $friendlyifdescr = $gateway["friendlyifdescr"]; $gwdescr = $gateway["descr"]; $defaultgw = $gateway['isdefaultgw']; if (isset($gateway['isdefaultgw'])) { $defaultgw = "1"; } else { $defaultgw = "0"; } if ($gateways_status[$i]) { if (isset($gateway['monitor_disable'])) { $monitor = "Unmonitored"; $delay = "Pending"; $stdev = "Pending"; $loss = "Pending"; } } 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 # $friendlyifdescr, $monitor, $source, $defaultgw, $gwdescr, floatval($delay), floatval($stddev), floatval($loss), $status, $substatus ); }; ?>