Project

General

Profile

« Previous | Next » 

Revision 8ff9cc38

Added by Jim Pingle about 12 years ago

Make mbufs update via ajax

View differences:

usr/local/www/includes/functions.inc.php
21 21
	$stats['gateways'] = get_gatewaystats();
22 22
	$stats['cpufreq'] = get_cpufreq();
23 23
	$stats['load_average'] = get_load_average();
24
	$stats['mbuf'] = get_mbuf();
24 25
	$stats = join("|", $stats);
25 26
	return $stats;
26 27
}
......
162 163
	return;
163 164
}
164 165

  
166
function get_mbuf() {
167
	$mbufs_output=trim(`netstat -mb | grep "mbuf clusters in use" | awk '{ print $1 }'`);
168
	list( $mbufs_current, $mbufs_cache, $mbufs_total, $mbufs_max ) = explode( "/", $mbufs_output);
169
	$mbufusage = round(($mbufs_total / $mbufs_max) * 100);
170
}
171

  
165 172
function get_temp() {
166 173
	$temp_out = "";
167 174
	exec("/sbin/sysctl dev.cpu.0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
usr/local/www/javascript/index/ajax.js
43 43
        updateGatewayStats(values[8]);
44 44
        updateCpuFreq(values[9]);
45 45
        updateLoadAverage(values[10]);
46
        updateMbuf(values[11]);
46 47
}
47 48

  
48 49
function updateMemory(x) {
......
54 55
		jQuery("#memwidthb").css('width', (100 - x) + 'px');
55 56
}
56 57

  
58
function updateMbuf(x) {
59
	if(jQuery('#mbufusagemeter'))
60
		jQuery("#mbufusagemeter").html(x + '%');
61
	if(jQuery('#mbufwidtha'))
62
		jQuery("#mbufwidtha").css('width',x + 'px');
63
	if(jQuery('#mbufwidthb'))
64
		jQuery("#mbufwidthb").css('width', (100 - x) + 'px');
65
}
66

  
57 67
function updateCPU(x) {
58 68
	if(jQuery('#cpumeter'))
59 69
		jQuery("#cpumeter").html(x + '%');

Also available in: Unified diff