stored counter stats

This commit is contained in:
SJ 2014-05-05 16:00:33 +02:00
parent 3bf589ab5c
commit f356574ea5
9 changed files with 16 additions and 9 deletions

View File

@ -196,7 +196,7 @@ struct session_data {
int direction;
int tls;
int spam_message;
int fd, hdr_len, tot_len, store_len, num_of_rcpt_to, rav;
int fd, hdr_len, tot_len, stored_len, num_of_rcpt_to, rav;
int need_scan;
float __acquire, __parsed, __av, __store, __compress, __encrypt;
char bodydigest[2*DIGEST_LENGTH+1];

View File

@ -111,6 +111,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
bzero(&counters, sizeof(counters));
counters.c_rcvd = 1;
counters.c_size += sdata->tot_len;
counters.c_stored_size = sdata->stored_len;
update_counters(sdata, data, &counters, cfg);
break;

View File

@ -455,7 +455,7 @@ void init_session_data(struct session_data *sdata, struct __config *cfg){
sdata->hdr_len = 0;
sdata->tot_len = 0;
sdata->store_len = 0;
sdata->stored_len = 0;
sdata->num_of_rcpt_to = 0;
sdata->ms_journal = 0;

View File

@ -233,6 +233,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
inj = process_message(&sdata, &sstate, data, cfg);
unlink(sstate.message_id_hash);
counters.c_size += sdata.tot_len;
counters.c_stored_size = sdata.stored_len;
}
}
@ -268,7 +269,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
(sdata.__acquire+sdata.__parsed+sdata.__av+sdata.__compress+sdata.__encrypt+sdata.__store)/1000000.0,
sdata.__acquire/1000000.0, sdata.__parsed/1000000.0, sdata.__av/1000000.0, sdata.__compress/1000000.0, sdata.__encrypt/1000000.0, sdata.__store/1000000.0);
syslog(LOG_PRIORITY, "%s: from=%s, size=%d/%d, attachments=%d, reference=%s, message-id=%s, retention=%d, %s, status=%s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sdata.store_len, sstate.n_attachments, sstate.reference, sstate.message_id, sstate.retention, delay, status);
syslog(LOG_PRIORITY, "%s: from=%s, size=%d/%d, attachments=%d, reference=%s, message-id=%s, retention=%d, %s, status=%s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sdata.stored_len, sstate.n_attachments, sstate.reference, sstate.message_id, sstate.retention, delay, status);

View File

@ -158,7 +158,7 @@ int store_file(struct session_data *sdata, char *filename, int startpos, int len
if(n > 0 && n == writelen){
ret = 1;
sdata->store_len += writelen;
sdata->stored_len += writelen;
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored '%s' %d/%d bytes", sdata->ttmpfile, filename, len, writelen);
}
else {

View File

@ -64,12 +64,13 @@ class ControllerHealthWorker extends Controller {
$db = Registry::get('db');
$db->select_db($db->database);
list($archivesizeraw, $this->data['counters']) = $this->model_stat_counter->get_counters();
list($archivesizeraw, $archivestoredsizeraw, $this->data['counters']) = $this->model_stat_counter->get_counters();
$oldest_record_timestamp = $this->model_health_health->get_oldest_record_ts();
$total_number_days = round( (time() - $this->model_health_health->get_first_email_arrival_ts()) / 86400 );
$this->data['archive_size'] = nice_size($archivesizeraw, ' ');
$this->data['archive_stored_size'] = nice_size($archivestoredsizeraw, ' ');
$this->data['prefix'] = '';
if(isset($this->data['counters'][MEMCACHED_PREFIX . 'rcvd'])) { $this->data['prefix'] = MEMCACHED_PREFIX; }

View File

@ -13,9 +13,11 @@ class ModelStatCounter extends Model {
if(isset($counter[MEMCACHED_PREFIX . 'counters_last_update'])) {
if(isset($counter[MEMCACHED_PREFIX . 'size'])) { $asize = $counter[MEMCACHED_PREFIX . 'size']; }
if(isset($counter[MEMCACHED_PREFIX . 'stored_size'])) { $ssize = $counter[MEMCACHED_PREFIX . 'stored_size']; }
unset($counter[MEMCACHED_PREFIX . 'size']);
unset($counter[MEMCACHED_PREFIX . 'stored_size']);
return array ($asize, $counter);
return array ($asize, $ssize, $counter);
}
}
@ -23,13 +25,15 @@ class ModelStatCounter extends Model {
if($query->num_rows == 1) {
$asize = $query->row['size'];
$ssize = $query->row['stored_size'];
unset($query->row['size']);
unset($query->row['stored_size']);
$counter = $query->row;
}
return array ($asize, $counter);
return array ($asize, $ssize, $counter);
}

View File

@ -40,7 +40,7 @@
<table class="table table-striped">
<tr>
<th><?php print $text_archive_size; ?>:</th>
<td><?php print $archive_size; ?>B</td>
<td><?php print $archive_size; ?>B (<?php print $archive_stored_size; ?>B)</td>
</tr>
<tr>

View File

@ -31,7 +31,7 @@
<div class="row">
<div class="cellhealthleft"><?php print $text_archive_size; ?></div>
<div class="cellhealthright"><?php print $archive_size; ?>B</div>
<div class="cellhealthright"><?php print $archive_size; ?>B (<?php print $archive_stored_size; ?>B)</div>
</div>
<div class="row">