[Web] Add JVM memory indiator and add minor fixes

master
andryyy 2019-09-17 20:11:53 +02:00
parent b178326736
commit 0487f5ea1d
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
5 changed files with 43 additions and 11 deletions

View File

@ -40,4 +40,8 @@ table.footable>tbody>tr.footable-empty>td {
} }
tbody { tbody {
font-size:14px; font-size:14px;
}
.container-indicator {
width: 15px;
height: 15px;
} }

View File

@ -76,11 +76,17 @@ else {
<?php <?php
if ($solr_status !== false): if ($solr_status !== false):
?> ?>
<p><?=$lang['debug']['solr_uptime'];?>: ~<?=round($solr_status['uptime'] / 1000 / 60 / 60);?>h</p> <div class="progress">
<p><?=$lang['debug']['solr_started_at'];?>: <?=$solr_status['startTime'];?></p> <div class="progress-bar progress-bar-info" role="progressbar" style="width:<?=round($solr_status['jvm']['memory']['raw']['used%']);?>%"></div>
<p><?=$lang['debug']['solr_last_modified'];?>: <?=$solr_status['index']['lastModified'];?></p> </div>
<p><?=$lang['debug']['solr_size'];?>: <?=$solr_status['index']['size'];?></p> <p><?=$lang['debug']['jvm_memory_solr'];?>: <?=$solr_status['jvm']['memory']['total'] - $solr_status['jvm']['memory']['free'];?> / <?=$solr_status['jvm']['memory']['total'];?>
<p><?=$lang['debug']['solr_docs'];?>: <?=$solr_status['index']['numDocs'];?></p> (<?=round($solr_status['jvm']['memory']['raw']['used%']);?>%)</p>
<hr>
<p><?=$lang['debug']['solr_uptime'];?>: ~<?=round($solr_status['status']['dovecot-fts']['uptime'] / 1000 / 60 / 60);?>h</p>
<p><?=$lang['debug']['solr_started_at'];?>: <?=$solr_status['status']['dovecot-fts']['startTime'];?></p>
<p><?=$lang['debug']['solr_last_modified'];?>: <?=$solr_status['status']['dovecot-fts']['index']['lastModified'];?></p>
<p><?=$lang['debug']['solr_size'];?>: <?=$solr_status['status']['dovecot-fts']['index']['size'];?></p>
<p><?=$lang['debug']['solr_docs'];?>: <?=$solr_status['status']['dovecot-fts']['index']['numDocs'];?></p>
<?php <?php
else: else:
?> ?>
@ -124,9 +130,9 @@ else {
$started = '?'; $started = '?';
} }
?> ?>
<small>(Started on <?=$started;?>), <small>(<?=$lang['debug']['started_on'];?> <?=$started;?>),
<a href data-toggle="modal" data-container="<?=$container;?>" data-target="#RestartContainer"><?=$lang['debug']['restart_container'];?></a></small> <a href data-toggle="modal" data-container="<?=$container;?>" data-target="#RestartContainer"><?=$lang['debug']['restart_container'];?></a></small>
<span class="pull-right label label-<?=($container_info['State'] !== false && !empty($container_info['State'])) ? (($container_info['State']['Running'] == 1) ? 'success' : 'danger') : 'default'; ?>">&nbsp;&nbsp;&nbsp;</span> <span class="pull-right container-indicator label label-<?=($container_info['State'] !== false && !empty($container_info['State'])) ? (($container_info['State']['Running'] == 1) ? 'success' : 'danger') : 'default'; ?>">&nbsp;</span>
</li> </li>
<?php <?php
} }

View File

@ -1574,16 +1574,34 @@ function solr_status() {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0); curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 20); curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$response = curl_exec($curl); $response_core = curl_exec($curl);
if ($response === false) { if ($response_core === false) {
$err = curl_error($curl); $err = curl_error($curl);
curl_close($curl); curl_close($curl);
return false; return false;
} }
else { else {
curl_close($curl); curl_close($curl);
$status = json_decode($response, true); $curl = curl_init();
$status_core = json_decode($response_core, true);
$url = 'http://solr:8983/solr/admin/info/system';
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$response_sysinfo = curl_exec($curl);
if ($response_sysinfo === false) {
$err = curl_error($curl);
curl_close($curl);
return false;
}
else {
curl_close($curl);
$status_sysinfo = json_decode($response_sysinfo, true);
$status = array_merge($status_core, $status_sysinfo);
return (!empty($status['status']['dovecot-fts']) && !empty($status['jvm']['memory'])) ? $status : false;
}
return (!empty($status['status']['dovecot-fts'])) ? $status['status']['dovecot-fts'] : false; return (!empty($status['status']['dovecot-fts'])) ? $status['status']['dovecot-fts'] : false;
} }
return false; return false;

View File

@ -769,6 +769,8 @@ $lang['debug']['log_info'] = '<p>mailcow <b>in-memory Logs</b> werden in Redis L
<p><b>Statische Logs</b> sind weitestgehend Aktivitätsprotokolle, die nicht in den Docker Daemon geschrieben werden, jedoch permanent verfügbar sein müssen (ausgeschlossen API Logs).</p>'; <p><b>Statische Logs</b> sind weitestgehend Aktivitätsprotokolle, die nicht in den Docker Daemon geschrieben werden, jedoch permanent verfügbar sein müssen (ausgeschlossen API Logs).</p>';
$lang['debug']['in_memory_logs'] = 'In-memory Logs'; $lang['debug']['in_memory_logs'] = 'In-memory Logs';
$lang['debug']['started_on'] = 'Gestartet am';
$lang['debug']['jvm_memory_solr'] = 'JVM Speicherauslastung';
$lang['debug']['external_logs'] = 'Externe Logs'; $lang['debug']['external_logs'] = 'Externe Logs';
$lang['debug']['static_logs'] = 'Statische Logs'; $lang['debug']['static_logs'] = 'Statische Logs';
$lang['debug']['solr_status'] = 'Solr Status'; $lang['debug']['solr_status'] = 'Solr Status';

View File

@ -786,6 +786,8 @@ $lang['danger']['spam_learn_error'] = "Spam learn error: %s";
$lang['success']['qlearn_spam'] = "Message ID %s was learned as spam and deleted"; $lang['success']['qlearn_spam'] = "Message ID %s was learned as spam and deleted";
$lang['debug']['system_containers'] = 'System & Containers'; $lang['debug']['system_containers'] = 'System & Containers';
$lang['debug']['started_on'] = 'Started on';
$lang['debug']['jvm_memory_solr'] = 'JVM memory usage';
$lang['debug']['solr_status'] = 'Solr status'; $lang['debug']['solr_status'] = 'Solr status';
$lang['debug']['solr_dead'] = 'Solr is starting, disabled or died.'; $lang['debug']['solr_dead'] = 'Solr is starting, disabled or died.';
$lang['debug']['logs'] = 'Logs'; $lang['debug']['logs'] = 'Logs';