diff options
author | Bill Marquette <billm@pfsense.org> | 2005-09-15 02:55:19 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2005-09-15 02:55:19 +0000 |
commit | 1804023da9ad604cb57af7e934352ef84e127736 (patch) | |
tree | 9e0289ec45e291b749467dab96dbe59b1cbf2b1a /usr | |
parent | 9f0309d3ab54a3c781fdbce3358e12f07eb7b893 (diff) | |
download | pfsense-1804023da9ad604cb57af7e934352ef84e127736.zip pfsense-1804023da9ad604cb57af7e934352ef84e127736.tar.gz |
Make 4801 temp monitor work (and make it work with sajax)
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 11 | ||||
-rwxr-xr-x | usr/local/www/index.php | 8 | ||||
-rw-r--r-- | usr/local/www/javascript/index/sajax.js | 13 | ||||
-rwxr-xr-x | usr/local/www/sajax/index.sajax.php | 4 |
4 files changed, 30 insertions, 6 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index defe0a1..dddc5ab 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -65,6 +65,17 @@ function get_pfstate() { return $curentries . $maxstates; } +function get_temp($type) { + switch($type) { + case '4801': + $ret = rtrim(`/usr/local/sbin/env4801 | /usr/bin/grep Temp |/usr/bin/cut -c24-25`); + break; + default: + return; + } + + return $ret; +} function disk_usage() { diff --git a/usr/local/www/index.php b/usr/local/www/index.php index cfbd15b..be6e120 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -50,7 +50,7 @@ $oSajax = new sajax(); $oSajax->sajax_remote_uri = 'sajax/index.sajax.php'; $oSajax->sajax_request_type = 'POST'; - $oSajax->sajax_export("mem_usage","cpu_usage","get_uptime","get_pfstate"); + $oSajax->sajax_export("mem_usage","cpu_usage","get_uptime","get_pfstate", "get_temp"); $oSajax->sajax_handle_client_request(); ############################################################################ @@ -211,14 +211,16 @@ include("fbegin.inc"); <?php /* XXX - Stub in the HW monitor for net4801 - needs to use platform var's once we start using them */ /* XXX - this should be grep net4801, but the graph doesn't update right now and I don't want to fix it right now - billm */ - $is4801 = `/sbin/dmesg -a | grep NET4801`; + $is4801 = `/sbin/dmesg -a | /usr/bin/grep net4801`; if($is4801 <> ""): exec("/usr/local/sbin/env4801 -i"); - $Temp = rtrim(`/usr/local/sbin/env4801 | grep Temp |cut -c24-25`); + $hwtype = "4801"; + ?> <tr> <td width='25%' class='vncellt'>Temperature</td> <td width='75%' class='listr'> + <?php $temp = get_temp($hwtype); ?> <img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" name="Tempwidtha" id="tempwidtha" width="<?= $temp; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" name="Tempwidthb" id="tempwidthb" width="<?= (100 - $temp); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> <input style="border: 0px solid white;" size="30" name="Tempmeter" id="Tempmeter" value="<?= $temp."C"; ?>" /> diff --git a/usr/local/www/javascript/index/sajax.js b/usr/local/www/javascript/index/sajax.js index 110812d..036b38d 100644 --- a/usr/local/www/javascript/index/sajax.js +++ b/usr/local/www/javascript/index/sajax.js @@ -4,6 +4,7 @@ function updateMeters() x_mem_usage(updateMemory); x_get_uptime(updateUptime); x_get_pfstate(updateState); + x_get_temp(updateTemp); window.setTimeout('updateMeters()', 5000); } @@ -24,6 +25,16 @@ function updateCPU(x) document.getElementById("cpuwidthb").style.width = (100 - x) + 'px'; } +function updateTemp(x) +{ + if(document.getElementById("tempmeter")) { + document.getElementById("tempmeter").value = x + '%'; + + document.getElementById("tempwidtha").style.width = x + 'px'; + document.getElementById("tempwidthb").style.width = (100 - x) + 'px'; + } +} + function updateUptime(x) { document.getElementById("uptime").value = x; @@ -34,4 +45,4 @@ function updateState(x) document.getElementById("pfstate").value = x; } -window.setTimeout('updateMeters()', 5000);
\ No newline at end of file +window.setTimeout('updateMeters()', 5000); diff --git a/usr/local/www/sajax/index.sajax.php b/usr/local/www/sajax/index.sajax.php index baa2913..6de3a6f 100755 --- a/usr/local/www/sajax/index.sajax.php +++ b/usr/local/www/sajax/index.sajax.php @@ -4,6 +4,6 @@ require("../includes/functions.inc.php"); $oSajax = new sajax(); - $oSajax->sajax_export("mem_usage","cpu_usage","get_uptime","get_pfstate"); + $oSajax->sajax_export("mem_usage","cpu_usage","get_uptime","get_pfstate", "get_temp"); $oSajax->sajax_handle_client_request(); -?>
\ No newline at end of file +?> |