Turn off useless shm display in header. Add ram and swap usage
This commit is contained in:
parent
26ac52aaa9
commit
452d28a66b
|
@ -265,7 +265,8 @@ function getNormalNavBarHTML($running, $user, $bandwidth_options, $view, $skin)
|
||||||
echo getSysLoadHTML();
|
echo getSysLoadHTML();
|
||||||
echo getDbConHTML();
|
echo getDbConHTML();
|
||||||
echo getStorageHTML();
|
echo getStorageHTML();
|
||||||
echo getShmHTML();
|
echo getRamHTML();
|
||||||
|
#echo getShmHTML();
|
||||||
#echo getLogIconHTML();
|
#echo getLogIconHTML();
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -323,7 +324,8 @@ function getCollapsedNavBarHTML($running, $user, $bandwidth_options, $view, $ski
|
||||||
echo getSysLoadHTML();
|
echo getSysLoadHTML();
|
||||||
echo getDbConHTML();
|
echo getDbConHTML();
|
||||||
echo getStorageHTML();
|
echo getStorageHTML();
|
||||||
echo getShmHTML();
|
echo getRamHTML();
|
||||||
|
#echo getShmHTML();
|
||||||
echo getLogIconHTML();
|
echo getLogIconHTML();
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -456,6 +458,37 @@ function getStorageHTML() {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRamHTML() {
|
||||||
|
$result = '';
|
||||||
|
if ( !canView('System') ) return $result;
|
||||||
|
$contents = file_get_contents('/proc/meminfo');
|
||||||
|
preg_match_all('/(\w+):\s+(\d+)\s/', $contents, $matches);
|
||||||
|
$meminfo = array_combine($matches[1], $matches[2]);
|
||||||
|
$mem_used = $meminfo['MemTotal'] - $meminfo['MemFree'] - $meminfo['Buffers'] - $meminfo['Cached'];
|
||||||
|
$mem_used_percent = (int)(100*$mem_used/$meminfo['MemTotal']);
|
||||||
|
$used_class = '';
|
||||||
|
if ($mem_used_percent > 95) {
|
||||||
|
$used_class = 'text-danger';
|
||||||
|
} else if ($mem_used_percent > 90) {
|
||||||
|
$used_class = 'text-warning';
|
||||||
|
}
|
||||||
|
$swap_used = $meminfo['SwapTotal'] - $meminfo['SwapFree'];
|
||||||
|
$swap_used_percent = (int)(100*$swap_used/$meminfo['SwapTotal']);
|
||||||
|
$swap_class = '';
|
||||||
|
if ($swap_used_percent > 95) {
|
||||||
|
$swap_class = 'text-danger';
|
||||||
|
} else if ($swap_used_percent > 90) {
|
||||||
|
$swap_class = 'text-warning';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= ' <li id="getRamHTML" class="nav-item dropdown mx-2" title="' .human_filesize($mem_used). ' of ' .human_filesize($meminfo['MemTotal']). '">'.
|
||||||
|
'<span class="'.$used_class.'">'.translate('Memory').': '.$mem_used_percent.'%</span> '.
|
||||||
|
'<span class="'.$swap_class.'">'.translate('Swap').': '.$swap_used_percent.'%</span> '.
|
||||||
|
'</li>'.PHP_EOL;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the html representing the current capacity of mapped memory filesystem (usually /dev/shm)
|
// Returns the html representing the current capacity of mapped memory filesystem (usually /dev/shm)
|
||||||
function getShmHTML() {
|
function getShmHTML() {
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
Loading…
Reference in New Issue