mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Make mbufs update via ajax
This commit is contained in:
parent
980b9cc6f8
commit
e4a0be9bee
@ -21,6 +21,7 @@ function get_stats() {
|
||||
$stats['gateways'] = get_gatewaystats();
|
||||
$stats['cpufreq'] = get_cpufreq();
|
||||
$stats['load_average'] = get_load_average();
|
||||
$stats['mbuf'] = get_mbuf();
|
||||
$stats = join("|", $stats);
|
||||
return $stats;
|
||||
}
|
||||
@ -162,6 +163,12 @@ function get_hwtype() {
|
||||
return;
|
||||
}
|
||||
|
||||
function get_mbuf() {
|
||||
$mbufs_output=trim(`netstat -mb | grep "mbuf clusters in use" | awk '{ print $1 }'`);
|
||||
list( $mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max ) = explode( "/", $mbufs_output);
|
||||
$mbufusage = round(($mbufs_total / $mbufs_max) * 100);
|
||||
}
|
||||
|
||||
function get_temp() {
|
||||
$temp_out = "";
|
||||
exec("/sbin/sysctl dev.cpu.0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
|
||||
|
||||
@ -43,6 +43,7 @@ function stats(x) {
|
||||
updateGatewayStats(values[8]);
|
||||
updateCpuFreq(values[9]);
|
||||
updateLoadAverage(values[10]);
|
||||
updateMbuf(values[11]);
|
||||
}
|
||||
|
||||
function updateMemory(x) {
|
||||
@ -54,6 +55,15 @@ function updateMemory(x) {
|
||||
jQuery("#memwidthb").css('width', (100 - x) + 'px');
|
||||
}
|
||||
|
||||
function updateMbuf(x) {
|
||||
if(jQuery('#mbufusagemeter'))
|
||||
jQuery("#mbufusagemeter").html(x + '%');
|
||||
if(jQuery('#mbufwidtha'))
|
||||
jQuery("#mbufwidtha").css('width',x + 'px');
|
||||
if(jQuery('#mbufwidthb'))
|
||||
jQuery("#mbufwidthb").css('width', (100 - x) + 'px');
|
||||
}
|
||||
|
||||
function updateCPU(x) {
|
||||
if(jQuery('#cpumeter'))
|
||||
jQuery("#cpumeter").html(x + '%');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user