added indexer stat to health page

This commit is contained in:
SJ
2013-08-09 10:13:54 +02:00
parent 8d201ed50a
commit 2a8c13d774
16 changed files with 221 additions and 2 deletions

View File

@ -39,6 +39,7 @@ $config['PROVIDED_BY'] = 'www.mailpiler.org';
$config['SITE_KEYWORDS'] = 'piler email archiver';
$config['SITE_DESCRIPTION'] = 'piler email archiver';
$config['INDEXER_BEACON'] = '/var/piler/stat/indexer';
// authentication against an ldap directory (disabled by default)

View File

@ -146,6 +146,10 @@ class ControllerHealthWorker extends Controller {
$this->data['usagetrend'] = 0;
}
$this->data['indexer_stat'] = $this->model_health_health->indexer_stat();
$this->render();
}

View File

@ -151,6 +151,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Benutzer importieren";
$_['text_import_users_from_LDAP'] = "Benutzer aus LDAP importieren";
$_['text_inbound'] = "eingehend";
$_['text_indexer_job'] = "Indexer job";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "intern";
$_['text_invalid_data'] = "Ungültige Daten";

View File

@ -151,6 +151,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Import users";
$_['text_import_users_from_LDAP'] = "Import users from LDAP";
$_['text_inbound'] = "inbound";
$_['text_indexer_job'] = "Indexer job";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "internal";
$_['text_invalid_data'] = "Invalid data";

View File

@ -151,6 +151,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Felhaszn<EFBFBD>l<EFBFBD>k import<72>l<EFBFBD>sa";
$_['text_import_users_from_LDAP'] = "Felhaszn<EFBFBD>l<EFBFBD>k import<72>l<EFBFBD>sa LDAP-b<>l";
$_['text_inbound'] = "bej<EFBFBD>v<EFBFBD>";
$_['text_indexer_job'] = "Indexer fut<75>s";
$_['text_install_sudo_apply'] = "Adja az al<61>bbi sort a /etc/sudoers file-hoz: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "bels<EFBFBD>";
$_['text_invalid_data'] = "<EFBFBD>rv<EFBFBD>nytelen adat(ok)";

View File

@ -151,6 +151,7 @@ $_['text_import'] = "Import";
$_['text_import_users'] = "Felhasználók importálása";
$_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő";
$_['text_indexer_job'] = "Indexer futás";
$_['text_install_sudo_apply'] = "Adja az alábbi sort a /etc/sudoers file-hoz: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "belső";
$_['text_invalid_data'] = "Érvénytelen adat(ok)";

View File

@ -147,6 +147,7 @@ $_['text_import'] = "Importar";
$_['text_import_users'] = "Importar usuários";
$_['text_import_users_from_LDAP'] = "Importar usuários de LDAP";
$_['text_inbound'] = "interno";
$_['text_indexer_job'] = "Indexer job";
$_['text_install_sudo_apply'] = "Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'";
$_['text_internal'] = "interno";
$_['text_invalid_data'] = "Dados inválidos";

View File

@ -198,6 +198,23 @@ class ModelHealthHealth extends Model {
return $dirSize;
}
public function indexer_stat() {
$data = array('', '');
if(file_exists(INDEXER_BEACON)) {
$st = stat(INDEXER_BEACON);
$t1 = date(DATE_TEMPLATE . " H:i", $st['mtime']);
$t2 = date(DATE_TEMPLATE . " H:i", $st['mtime']+30*60);
$data = array($t1, $t2);
}
return $data;
}
}

View File

@ -118,7 +118,7 @@ class ModelSaasCustomer extends Model
$query = $this->db->query("INSERT INTO " . TABLE_ONLINE . " (username, ts, last_activity, ipaddr) VALUES(?,?,?,?)", array($username, NOW, NOW, $_SERVER['REMOTE_ADDR']));
if($this->db->countAffected() == 0) {
$query = $this->db->query("UPDATE " . TABLE_ONLINE . " SET ts=?, last_activity=? WHERE username=? AND ipaddr=?", array(NOW, $username, $_SERVER['REMOTE_ADDR']));
$query = $this->db->query("UPDATE " . TABLE_ONLINE . " SET ts=?, last_activity=? WHERE username=? AND ipaddr=?", array(NOW, NOW, $username, $_SERVER['REMOTE_ADDR']));
}
return 1;

View File

@ -130,7 +130,7 @@ class ModelUserAuth extends Model {
if($ldap_auditor_member_dn == '') { return 0; }
foreach($e as $a) {
foreach (array("memberof") as $memberattr) {
foreach (array("memberof", "dn") as $memberattr) {
if(isset($a[$memberattr])) {
if(isset($a[$memberattr]['count'])) {

View File

@ -67,6 +67,16 @@
<th><?php print $text_periodic_purge; ?></th>
<td><span class="<?php if($options['enable_purge'] == 1) { ?>ok<?php } else { ?>error<?php } ?>"><?php if($options['enable_purge'] == 1) { print $text_enabled; ?>. <a href="<?php print HEALTH_URL; ?>&toggle_enable_purge"><?php print $text_disable; ?></a><?php } else { print $text_disabled; ?>. <a href="<?php print HEALTH_URL; ?>&toggle_enable_purge"><?php print $text_enable; ?></a><?php } ?> </span></td>
</tr>
<?php if($indexer_stat[0]) { ?>
<tr>
<th><?php print $text_indexer_job; ?></th>
<td><?php print $text_last; ?>: <?php print $indexer_stat[0]; ?>, <?php print $text_next; ?>: <?php print $indexer_stat[1]; ?></td>
</tr>
<?php } ?>
</table>
</div>

View File

@ -126,6 +126,13 @@
</div>
</div>
<?php if($indexer_stat[0]) { ?>
<div class="row">
<div class="cellhealthleft"><?php print $text_indexer_job; ?></div>
<div class="cellhealthright"><?php print $text_last; ?>: <?php print $indexer_stat[0]; ?>, <?php print $text_next; ?>: <?php print $indexer_stat[1]; ?></div>
</div>
<?php } ?>
</div>