diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-03-11 17:28:17 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-03-11 17:28:37 -0400 |
commit | 3dfa6a5214276556ce089a17e597ac4a345fe319 (patch) | |
tree | b133221929d95da82c453928674079f5a93fb405 /usr/local/www/includes/functions.inc.php | |
parent | 00707bc52dec72ada2b2b142ffbf4dccc8025c12 (diff) | |
download | pfsense-3dfa6a5214276556ce089a17e597ac4a345fe319.zip pfsense-3dfa6a5214276556ce089a17e597ac4a345fe319.tar.gz |
Add ajax mojo to gateway status widget
Diffstat (limited to 'usr/local/www/includes/functions.inc.php')
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 8f549d6..218f732 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -6,7 +6,6 @@ if(Connection_Aborted()) { require_once("config.inc"); - function get_stats() { $stats['cpu'] = cpu_usage(); $stats['mem'] = mem_usage(); @@ -16,12 +15,48 @@ function get_stats() { $stats['datetime'] = update_date_time(); $stats['interfacestatistics'] = get_interfacestats(); $stats['interfacestatus'] = get_interfacestatus(); - + $stats['gateways'] = get_gatewaystats(); $stats = join("|", $stats); - return $stats; } +function get_gatewaystats() { + $gateways_status = array(); + $gateways_status = return_gateways_status(); + $data = ""; + $isfirst = true; + foreach($gateways_status as $gw) { + if(!$isfirst) + $data .= ","; + $isfirst = false; + $data .= $gw['name'] . ","; + $data .= $gw['gateway'] . ","; + $data .= $gw['delay'] . ","; + $data .= $gw['loss'] . ","; + switch($gw['status']) { + case "None": + $online = "Online"; + $bgcolor = "lightgreen"; + break; + case "\"down\"": + $online = "Offline"; + $bgcolor = "lightcoral"; + break; + case "\"delay\"": + $online = "Warning, Latency"; + $bgcolor = "khaki"; + break; + case "\"loss\"": + $online = "Warning, Packetloss"; + $bgcolor = "khaki"; + break; + default: + $online = "No data"; + } + $data .= "<tr><td id=\"gateway{$counter}\" bgcolor=\"$bgcolor\" > $online </td>"; + } + return $data; +} function get_uptime() { $boottime = ""; |