mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-26 19:50:11 +01:00
space projection fixes
This commit is contained in:
parent
a80dafafb6
commit
9d9d7e91e7
@ -68,6 +68,11 @@ class ControllerHealthWorker extends Controller {
|
|||||||
|
|
||||||
list($archivesizeraw, $this->data['counters']) = $this->model_stat_counter->get_counters();
|
list($archivesizeraw, $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() - $oldest_record_timestamp) / 86400 );
|
||||||
|
|
||||||
|
echo("Total Days: ".date("d M Y",time())." - ".date("d M Y",$oldest_record_timestamp)." = $total_number_days<br/>");
|
||||||
|
|
||||||
$this->data['archive_size'] = nice_size($archivesizeraw, ' ');
|
$this->data['archive_size'] = nice_size($archivesizeraw, ' ');
|
||||||
|
|
||||||
$this->data['prefix'] = '';
|
$this->data['prefix'] = '';
|
||||||
@ -81,26 +86,30 @@ class ControllerHealthWorker extends Controller {
|
|||||||
|
|
||||||
$sphinxsizeraw = $this->model_health_health->get_sphinx_size();
|
$sphinxsizeraw = $this->model_health_health->get_sphinx_size();
|
||||||
|
|
||||||
/* these next counters are for projecting space */
|
/* message count variables */
|
||||||
$averagemessagesweekraw = ($this->data['processed_emails'][1]) / 7;
|
$averagemessagesweekraw = ($this->data['processed_emails'][1]) / 7; //average messages per day, computed over the past week
|
||||||
$averagemessagesmonthraw = ($this->data['processed_emails'][2]) / 30;
|
$averagemessagesmonthraw = ($this->data['processed_emails'][2]) / 30; //average messages per day, computed over the past month
|
||||||
$averagemessagesizeraw = $archivesizeraw / $this->data['counters']['rcvd'];
|
$averagemessagestotalraw = ($this->data['counters']['rcvd']) / $total_number_days; //average messages per day, computed over the time period since the first email was archived
|
||||||
$averagesqlsizeraw = $sqlsizeraw / $this->data['counters']['rcvd'];
|
|
||||||
$averagesphinxsizeraw = $sphinxsizeraw / $this->data['counters']['rcvd'];
|
/* message size variables */
|
||||||
$averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw;
|
$averagemessagesizeraw = $archivesizeraw / $this->data['counters']['rcvd']; //average message size, computed for total messages in database
|
||||||
|
$averagesqlsizeraw = $sqlsizeraw / $this->data['counters']['rcvd']; //average message metadata size, computed for total messages in database
|
||||||
|
$averagesphinxsizeraw = $sphinxsizeraw / $this->data['counters']['rcvd']; //average message sphinx index size, computed for total messages in database
|
||||||
|
$averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagestotalraw; //average total message size per day, computed over the time period since the first email was archived
|
||||||
|
|
||||||
$datapart = 0;
|
$datapart = 0;
|
||||||
foreach($this->data['shortdiskinfo'] as $part) {
|
foreach($this->data['shortdiskinfo'] as $part) {
|
||||||
if( $part['partition'] == DATA_PARTITION ) { $datapart = $part['freespace']*1024; }
|
if( $part['partition'] == DATA_PARTITION ) { $datapart = $part['freespace']*1024; } // if the partition is the selected storage partition, record freespace on that partition
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data['averagemessages'] = round($averagemessagesweekraw); // average of messages over the past week
|
$this->data['oldestmessagets'] = $oldest_record_timestamp; // date of the oldest record in the db
|
||||||
$this->data['averagemessagesize'] = nice_size($averagemessagesizeraw,' '); // average message size on disk
|
$this->data['averagemessages'] = round($averagemessagesweekraw); // rounded average of messages over the past week
|
||||||
$this->data['averagesqlsize'] = nice_size($averagesqlsizeraw,' '); // average metadata size in sql
|
$this->data['averagemessagesize'] = nice_size($averagemessagesizeraw,' '); // formatted average message size on disk
|
||||||
$this->data['averagesphinxsize'] = nice_size($averagesphinxsizeraw,' '); // average sphinx index
|
$this->data['averagesqlsize'] = nice_size($averagesqlsizeraw,' '); // formatted average metadata size in sql
|
||||||
$this->data['averagesizeday'] = nice_size($averagesizedayraw,' '); // average size per day
|
$this->data['averagesphinxsize'] = nice_size($averagesphinxsizeraw,' '); // formatted average sphinx index
|
||||||
$this->data['daysleftatcurrentrate'] = convert_days_ymd($datapart / $averagesizedayraw); // number of days of free space left
|
$this->data['averagesizeday'] = nice_size($averagesizedayraw,' '); // formatted average size per day
|
||||||
if ( $averagemessagesweekraw > $averagemessagesmonthraw ) {
|
$this->data['daysleftatcurrentrate'] = convert_days_ymd($datapart / $averagesizedayraw); // estimated number of days of free space left
|
||||||
|
if ( $averagemessagesweekraw > $averagemessagesmonthraw ) { // determine if the trend of the last week compared to the last month is increasing, decreasing, or neutral (only applies to message count, not size)
|
||||||
$this->data['usagetrend'] = 1;
|
$this->data['usagetrend'] = 1;
|
||||||
} elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) {
|
} elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) {
|
||||||
$this->data['usagetrend'] = -1;
|
$this->data['usagetrend'] = -1;
|
||||||
|
@ -138,6 +138,7 @@ class ModelHealthHealth extends Model {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_database_size() {
|
public function get_database_size() {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
@ -148,12 +149,29 @@ class ModelHealthHealth extends Model {
|
|||||||
GROUP BY table_schema;");
|
GROUP BY table_schema;");
|
||||||
if(isset($query->rows)) {
|
if(isset($query->rows)) {
|
||||||
$data = array_pop($query->rows);
|
$data = array_pop($query->rows);
|
||||||
|
} else {
|
||||||
|
$data['size'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data['size'];
|
return $data['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_oldest_record_ts() {
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT MIN(`arrived`) AS `oldest_record_ts` FROM " . TABLE_META);
|
||||||
|
|
||||||
|
if(isset($query->rows)) {
|
||||||
|
$data = array_pop($query->rows);
|
||||||
|
} else {
|
||||||
|
$data['oldest_record_ts'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data['oldest_record_ts'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_sphinx_size($directory = DIR_SPHINX) {
|
public function get_sphinx_size($directory = DIR_SPHINX) {
|
||||||
$dirSize=0;
|
$dirSize=0;
|
||||||
|
|
||||||
|
@ -68,6 +68,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Cumulative Counts</th>
|
<th colspan="2">Cumulative Counts</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php print $text_oldest_record; ?></td>
|
||||||
|
<td><?php print date("d M Y", $oldestmessagets); ?></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php print $text_processed_emails; ?></td>
|
<td><?php print $text_processed_emails; ?></td>
|
||||||
<td><?php print $processed_emails[0]; ?> (<?php print $text_24_hours; ?>)<br /><?php print $processed_emails[1]; ?> (<?php print $text_1_week; ?>)<br /><?php print $processed_emails[2]; ?> (<?php print $text_30_days; ?>)</td>
|
<td><?php print $processed_emails[0]; ?> (<?php print $text_24_hours; ?>)<br /><?php print $processed_emails[1]; ?> (<?php print $text_1_week; ?>)<br /><?php print $processed_emails[2]; ?> (<?php print $text_30_days; ?>)</td>
|
||||||
|
@ -73,6 +73,12 @@
|
|||||||
<div class="cellhealthright"><span class="bold <?php if($options['enable_purge'] == 1) { ?>text-success<?php } else { ?>text-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></div>
|
<div class="cellhealthright"><span class="bold <?php if($options['enable_purge'] == 1) { ?>text-success<?php } else { ?>text-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></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="cellhealthleft"><?php print $text_oldest_record; ?></div>
|
||||||
|
<div class="cellhealthright">
|
||||||
|
<?php print date("d M Y", $oldestmessagets); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="cellhealthleft"><?php print $text_counters; ?></div>
|
<div class="cellhealthleft"><?php print $text_counters; ?></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user