summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorCristian Feldman <vizvayu@gmail.com>2012-05-24 18:52:27 -0300
committerCristian Feldman <vizvayu@gmail.com>2012-05-24 18:52:27 -0300
commit25a46a3cb249ea3eeb8319e5ab161dfd3c5160ae (patch)
tree801cb32787cc42a797a8b69089b0504dd4694a2d /usr/local
parenta55be495a200e5ae5ebc08e5bb8156f6ac6b502a (diff)
downloadpfsense-25a46a3cb249ea3eeb8319e5ab161dfd3c5160ae.zip
pfsense-25a46a3cb249ea3eeb8319e5ab161dfd3c5160ae.tar.gz
Added load average information to the System Information widget
Diffstat (limited to 'usr/local')
-rw-r--r--usr/local/www/includes/functions.inc.php8
-rw-r--r--usr/local/www/javascript/index/ajax.js6
-rw-r--r--usr/local/www/widgets/widgets/system_information.widget.php6
3 files changed, 20 insertions, 0 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php
index 3039c35..806a084 100644
--- a/usr/local/www/includes/functions.inc.php
+++ b/usr/local/www/includes/functions.inc.php
@@ -20,6 +20,7 @@ function get_stats() {
$stats['interfacestatus'] = get_interfacestatus();
$stats['gateways'] = get_gatewaystats();
$stats['cpufreq'] = get_cpufreq();
+ $stats['load_average'] = get_load_average();
$stats = join("|", $stats);
return $stats;
}
@@ -231,6 +232,13 @@ function get_cpufreq() {
return $out;
}
+
+function get_load_average() {
+ $load_average = "";
+ exec("/usr/bin/uptime | /usr/bin/sed 's/^.*: //'", $load_average);
+ return $load_average[0];
+}
+
function get_interfacestats() {
global $config;
diff --git a/usr/local/www/javascript/index/ajax.js b/usr/local/www/javascript/index/ajax.js
index eab0119..5cae407 100644
--- a/usr/local/www/javascript/index/ajax.js
+++ b/usr/local/www/javascript/index/ajax.js
@@ -42,6 +42,7 @@ function stats(x) {
updateInterfaces(values[7]);
updateGatewayStats(values[8]);
updateCpuFreq(values[9]);
+ updateLoadAverage(values[10]);
}
function updateMemory(x) {
@@ -106,6 +107,11 @@ function updateCpuFreq(x) {
jQuery("#cpufreq").html(x);
}
+function updateLoadAverage(x) {
+ if(jQuery('#load_average'))
+ jQuery("#load_average").html(x);
+}
+
function updateInterfaceStats(x){
if (widgetActive("interface_statistics")){
statistics_split = x.split(",");
diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php
index 776679a..f057866 100644
--- a/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/usr/local/www/widgets/widgets/system_information.widget.php
@@ -202,6 +202,12 @@ $curcfg = $config['system']['firmware'];
</tr>
<?php endif; ?>
<tr>
+ <td width="25%" class="vncellt">Load average</td>
+ <td width="75%" class="listr">
+ <div id="load_average" title="Last 1, 5 and 15 minutes"><?= get_load_average(); ?></div>
+ </td>
+ </tr>
+ <tr>
<td width="25%" class="vncellt">CPU usage</td>
<td width="75%" class="listr">
<?php $cpuUsage = "0"; ?>
OpenPOWER on IntegriCloud