summaryrefslogtreecommitdiffstats
path: root/usr/local/www/includes/functions.inc.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-03-11 17:28:17 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-03-11 17:28:37 -0400
commit3dfa6a5214276556ce089a17e597ac4a345fe319 (patch)
treeb133221929d95da82c453928674079f5a93fb405 /usr/local/www/includes/functions.inc.php
parent00707bc52dec72ada2b2b142ffbf4dccc8025c12 (diff)
downloadpfsense-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.php41
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 = "";
OpenPOWER on IntegriCloud