diff options
author | jim-p <jimp@pfsense.org> | 2013-07-16 16:09:16 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-07-16 16:09:44 -0400 |
commit | 2cb760dae2fa2214240bb0083b060966be548604 (patch) | |
tree | 92311e66b68bac3b5b220ee4da9cc37d540a260e /usr/local/www/includes | |
parent | 97f544d7e59ebebaf9d434f67878d671c6ca5275 (diff) | |
download | pfsense-2cb760dae2fa2214240bb0083b060966be548604.zip pfsense-2cb760dae2fa2214240bb0083b060966be548604.tar.gz |
Some more tweaks to state and mbuf update/output on dashboard widget.
Diffstat (limited to 'usr/local/www/includes')
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 359887c..2d3295a 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -22,6 +22,7 @@ function get_stats() { $stats['cpufreq'] = get_cpufreq(); $stats['load_average'] = get_load_average(); $stats['mbuf'] = get_mbuf(); + $stats['mbufpercent'] = get_mbuf(true); $stats['statepercent'] = get_pfstate(true); $stats = join("|", $stats); return $stats; @@ -151,7 +152,7 @@ function get_pfstate($percent=false) { $curentries = $matches[1]; } if ($percent) - return ($curentries / $maxstates) * 100; + return round(($curentries / $maxstates) * 100, 0); else return $curentries . "/" . $maxstates; } @@ -167,11 +168,13 @@ function get_hwtype() { return; } -function get_mbuf() { +function get_mbuf($percent=false) { $mbufs_output=trim(`/usr/bin/netstat -mb | /usr/bin/grep "mbuf clusters in use" | /usr/bin/awk '{ print $1 }'`); list( $mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max ) = explode( "/", $mbufs_output); - $mbufusage = round(($mbufs_total / $mbufs_max) * 100); - return $mbufusage; + if ($percent) + return round(($mbufs_total / $mbufs_max) * 100, 0); + else + return "{$mbufs_total}/{$mbufs_max}"; } function get_temp() { |