mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add a meter for states, too
This commit is contained in:
parent
2c7f71d97e
commit
4a83831c53
@ -22,6 +22,7 @@ function get_stats() {
|
||||
$stats['cpufreq'] = get_cpufreq();
|
||||
$stats['load_average'] = get_load_average();
|
||||
$stats['mbuf'] = get_mbuf();
|
||||
$stats['statepercent'] = get_pfstate(true);
|
||||
$stats = join("|", $stats);
|
||||
return $stats;
|
||||
}
|
||||
@ -138,7 +139,7 @@ function cpu_usage() {
|
||||
return $cpuUsage;
|
||||
}
|
||||
|
||||
function get_pfstate() {
|
||||
function get_pfstate($percent=false) {
|
||||
global $config;
|
||||
$matches = "";
|
||||
if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0)
|
||||
@ -149,7 +150,10 @@ function get_pfstate() {
|
||||
if (preg_match("/([0-9]+)/", $curentries, $matches)) {
|
||||
$curentries = $matches[1];
|
||||
}
|
||||
return $curentries . "/" . $maxstates;
|
||||
if ($percent)
|
||||
return ($curentries / $maxstates) * 100;
|
||||
else
|
||||
return $curentries . "/" . $maxstates;
|
||||
}
|
||||
|
||||
function has_temp() {
|
||||
|
||||
@ -44,6 +44,7 @@ function stats(x) {
|
||||
updateCpuFreq(values[9]);
|
||||
updateLoadAverage(values[10]);
|
||||
updateMbuf(values[11]);
|
||||
updateStateMeter(values[12]);
|
||||
}
|
||||
|
||||
function updateMemory(x) {
|
||||
@ -101,6 +102,15 @@ function updateState(x) {
|
||||
jQuery("#pfstate").html(x);
|
||||
}
|
||||
|
||||
function updateStateMeter(x) {
|
||||
if(jQuery('#pfstateusagemeter'))
|
||||
jQuery("#pfstateusagemeter").html(x + '%');
|
||||
if(jQuery('#pfstatewidtha'))
|
||||
jQuery("#pfstatewidtha").css('width',x + 'px');
|
||||
if(jQuery('#pfstatewidthb'))
|
||||
jQuery("#pfstatewidthb").css('width',(100 - x) + 'px');
|
||||
}
|
||||
|
||||
function updateGatewayStats(x){
|
||||
if (widgetActive("gateways")){
|
||||
gateways_split = x.split(",");
|
||||
|
||||
@ -186,7 +186,11 @@ $curcfg = $config['system']['firmware'];
|
||||
<tr>
|
||||
<td width="25%" class="vncellt"><?=gettext("State table size");?></td>
|
||||
<td width="75%" class="listr">
|
||||
<span id="pfstate"><?= htmlspecialchars(get_pfstate()); ?></span>
|
||||
<?php $pfstatetext = get_pfstate();
|
||||
$pfstateusage = get_pfstate(true);
|
||||
?>
|
||||
<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" />
|
||||
<br/><span id="pfstateusagemeter"><?= $pfstateusage.'%'; ?></span> (<span id="pfstate"><?= htmlspecialchars($pfstatetext); ?></span>)
|
||||
<br />
|
||||
<a href="diag_dump_states.php"><?=gettext("Show states");?></a>
|
||||
</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user