Revision 4a83831c
Added by Jim Pingle about 12 years ago
usr/local/www/includes/functions.inc.php | ||
---|---|---|
22 | 22 |
$stats['cpufreq'] = get_cpufreq(); |
23 | 23 |
$stats['load_average'] = get_load_average(); |
24 | 24 |
$stats['mbuf'] = get_mbuf(); |
25 |
$stats['statepercent'] = get_pfstate(true); |
|
25 | 26 |
$stats = join("|", $stats); |
26 | 27 |
return $stats; |
27 | 28 |
} |
... | ... | |
138 | 139 |
return $cpuUsage; |
139 | 140 |
} |
140 | 141 |
|
141 |
function get_pfstate() { |
|
142 |
function get_pfstate($percent=false) {
|
|
142 | 143 |
global $config; |
143 | 144 |
$matches = ""; |
144 | 145 |
if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) |
... | ... | |
149 | 150 |
if (preg_match("/([0-9]+)/", $curentries, $matches)) { |
150 | 151 |
$curentries = $matches[1]; |
151 | 152 |
} |
152 |
return $curentries . "/" . $maxstates; |
|
153 |
if ($percent) |
|
154 |
return ($curentries / $maxstates) * 100; |
|
155 |
else |
|
156 |
return $curentries . "/" . $maxstates; |
|
153 | 157 |
} |
154 | 158 |
|
155 | 159 |
function has_temp() { |
usr/local/www/javascript/index/ajax.js | ||
---|---|---|
44 | 44 |
updateCpuFreq(values[9]); |
45 | 45 |
updateLoadAverage(values[10]); |
46 | 46 |
updateMbuf(values[11]); |
47 |
updateStateMeter(values[12]); |
|
47 | 48 |
} |
48 | 49 |
|
49 | 50 |
function updateMemory(x) { |
... | ... | |
101 | 102 |
jQuery("#pfstate").html(x); |
102 | 103 |
} |
103 | 104 |
|
105 |
function updateStateMeter(x) { |
|
106 |
if(jQuery('#pfstateusagemeter')) |
|
107 |
jQuery("#pfstateusagemeter").html(x + '%'); |
|
108 |
if(jQuery('#pfstatewidtha')) |
|
109 |
jQuery("#pfstatewidtha").css('width',x + 'px'); |
|
110 |
if(jQuery('#pfstatewidthb')) |
|
111 |
jQuery("#pfstatewidthb").css('width',(100 - x) + 'px'); |
|
112 |
} |
|
113 |
|
|
104 | 114 |
function updateGatewayStats(x){ |
105 | 115 |
if (widgetActive("gateways")){ |
106 | 116 |
gateways_split = x.split(","); |
usr/local/www/widgets/widgets/system_information.widget.php | ||
---|---|---|
186 | 186 |
<tr> |
187 | 187 |
<td width="25%" class="vncellt"><?=gettext("State table size");?></td> |
188 | 188 |
<td width="75%" class="listr"> |
189 |
<span id="pfstate"><?= htmlspecialchars(get_pfstate()); ?></span> |
|
189 |
<?php $pfstatetext = get_pfstate(); |
|
190 |
$pfstateusage = get_pfstate(true); |
|
191 |
?> |
|
192 |
<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="pfstatewidtha" id="pfstatewidtha" width="<?= round($pfstateusage); ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="pfstatewidthb" id="pfstatewidthb" width="<?= (100 - $pfstateusage); ?>" 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" /> |
|
193 |
<br/><span id="pfstateusagemeter"><?= $pfstateusage.'%'; ?></span> (<span id="pfstate"><?= htmlspecialchars($pfstatetext); ?></span>) |
|
190 | 194 |
<br /> |
191 | 195 |
<a href="diag_dump_states.php"><?=gettext("Show states");?></a> |
192 | 196 |
</td> |
Also available in: Unified diff
Add a meter for states, too