mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 22:21:59 +01:00
webui fixes
This commit is contained in:
parent
78e750fde5
commit
d323e076ac
@ -3,6 +3,10 @@
|
||||
$webuidir = "";
|
||||
$verbose = 0;
|
||||
|
||||
$archivesizeraw = $sqlsizeraw = $sphinxsizeraw = 0;
|
||||
$averagemessagesweekraw = $averagemessagesmonthraw = $averagemessagesizeraw = $averagesizedayraw = $averagesqlsizeraw = $averagesphinxsizeraw = 0;
|
||||
|
||||
|
||||
if(isset($_SERVER['argv'][1])) { $webuidir = $_SERVER['argv'][1]; }
|
||||
|
||||
for($i=2; $i<$_SERVER['argc']; $i++){
|
||||
@ -66,13 +70,42 @@ $mail = new ModelMailMail();
|
||||
list($totalmem, $meminfo, $totalswap, $swapinfo) = $health->meminfo();
|
||||
$shortdiskinfo = $health->diskinfo();
|
||||
|
||||
list($archive_size, $counters) = $counter->get_counters();
|
||||
list($archivesizeraw, $counters) = $counter->get_counters();
|
||||
|
||||
$archive_size = nice_size($archivesizeraw, ' ');
|
||||
|
||||
$sysinfo = $health->sysinfo();
|
||||
|
||||
$options = $health->get_options();
|
||||
|
||||
|
||||
/* these next counters are for projecting space */
|
||||
$averagemessagesweekraw = ($processed_emails[1]) / 7;
|
||||
$averagemessagesmonthraw = ($processed_emails[2]) / 30;
|
||||
$averagemessagesizeraw = $archivesizeraw / $counters['rcvd'];
|
||||
$averagesqlsizeraw = $sqlsizeraw / $counters['rcvd'];
|
||||
$averagesphinxsizeraw = $sphinxsizeraw / $counters['rcvd'];
|
||||
$averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw;
|
||||
foreach($shortdiskinfo as $part) {
|
||||
if( $part['partition'] == DATA_PARTITION ) { $datapart = $part['freespace']*1024; }
|
||||
}
|
||||
|
||||
$averagemessages = round($averagemessagesweekraw); // average of messages over the past week
|
||||
$averagemessagesize = nice_size($averagemessagesizeraw,' '); // average message size on disk
|
||||
$averagesqlsize = nice_size($averagesqlsizeraw,' '); // average metadata size in sql
|
||||
$averagesphinxsize = nice_size($averagesphinxsizeraw,' '); // average sphinx index
|
||||
$averagesizeday = nice_size($averagesizedayraw,' '); // average size per day
|
||||
$daysleftatcurrentrate = convert_days_ymd($datapart / $averagesizedayraw); // number of days of free space left
|
||||
if ( $averagemessagesweekraw > $averagemessagesmonthraw ) {
|
||||
$useagetrend = 1;
|
||||
} elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) {
|
||||
$useagetrend = -1;
|
||||
} else {
|
||||
$useagetrend = 0;
|
||||
}
|
||||
|
||||
|
||||
/* start email message */
|
||||
|
||||
$msg = "From: " . SMTP_FROMADDR . EOL;
|
||||
$msg .= "To: " . ADMIN_EMAIL . EOL;
|
||||
$msg .= "Subject: =?UTF-8?Q?" . preg_replace("/\n/", "", my_qp_encode($text_daily_piler_report)) . "?=" . EOL;
|
||||
@ -81,7 +114,7 @@ $mail = new ModelMailMail();
|
||||
$msg .= EOL . EOL;
|
||||
|
||||
ob_start();
|
||||
|
||||
|
||||
include($webuidir . "/view/theme/default/templates/health/daily-report.tpl");
|
||||
|
||||
$msg .= ob_get_contents();
|
||||
|
@ -349,3 +349,20 @@ create table if not exists `google_imap` (
|
||||
key(`email`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `counter_stats` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`date` int(11) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`domain` varchar(255) NOT NULL,
|
||||
`sent` int(11) NOT NULL,
|
||||
`recd` int(11) NOT NULL,
|
||||
`sentsize` int(11) NOT NULL,
|
||||
`recdsize` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `date` (`date`),
|
||||
KEY `email` (`email`),
|
||||
KEY `domain` (`domain`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
|
@ -7,5 +7,20 @@ create table if not exists `domain_user` (
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `counter_stats` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`date` int(11) NOT NULL,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`domain` varchar(255) NOT NULL,
|
||||
`sent` int(11) NOT NULL,
|
||||
`recd` int(11) NOT NULL,
|
||||
`sentsize` int(11) NOT NULL,
|
||||
`recdsize` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `date` (`date`),
|
||||
KEY `email` (`email`),
|
||||
KEY `domain` (`domain`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
alter table metadata drop index message_id;
|
||||
|
||||
|
100
util/generate_stats.php
Normal file
100
util/generate_stats.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// init/set default values
|
||||
$webuidir = '';
|
||||
$process_all = false;
|
||||
$start = NULL;
|
||||
$end = NULL;
|
||||
$timestart = microtime(true);
|
||||
|
||||
// get options from command line
|
||||
$opts = 'h::';
|
||||
$lopts = array(
|
||||
'webui:',
|
||||
'start::',
|
||||
'end::',
|
||||
);
|
||||
|
||||
if ( $options = getopt( $opts, $lopts ) )
|
||||
{
|
||||
if ( isset($options['webui']) )
|
||||
{
|
||||
$webuidir = $options['webui'];
|
||||
} else
|
||||
{
|
||||
echo("\nError: must provide path to WebUI directory\n\n"); // todo: language
|
||||
|
||||
display_help();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset($options['h']) )
|
||||
{
|
||||
display_help();
|
||||
exit;
|
||||
} elseif ( isset($options['start']) )
|
||||
{
|
||||
$start = $options['start'];
|
||||
} elseif ( isset($options['end']) )
|
||||
{
|
||||
$end = $options['end'];
|
||||
}
|
||||
} else {
|
||||
display_help();
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once($webuidir . "/config.php");
|
||||
require(DIR_SYSTEM . "/startup.php");
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
|
||||
$loader = new Loader();
|
||||
|
||||
$language = new Language();
|
||||
Registry::set('language', $language);
|
||||
|
||||
if(MEMCACHED_ENABLED) {
|
||||
$memcache = new Memcache();
|
||||
foreach ($memcached_servers as $m){
|
||||
$memcache->addServer($m[0], $m[1]);
|
||||
}
|
||||
|
||||
Registry::set('memcache', $memcache);
|
||||
}
|
||||
|
||||
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX);
|
||||
Registry::set('db', $db);
|
||||
|
||||
$loader->model('accounting/accounting');
|
||||
$messagestats = new ModelAccountingAccounting();
|
||||
|
||||
$_SESSION['username'] = 'cli-admin';
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
extract($language->data);
|
||||
|
||||
//$day_to_process = strtotime($day_to_process);
|
||||
$records = $messagestats->run_counters($start,$end);
|
||||
|
||||
$timeend = microtime(true);
|
||||
$timegone = $timeend - $timestart;
|
||||
|
||||
echo("\nFinished Executing Statistics Generation\n");
|
||||
echo("*************************************************\n");
|
||||
echo("Start Date: ".date("d M Y",$records['starttimestamp'])."\n");
|
||||
echo("Stop Date: ".date("d M Y",$records['endtimestamp'])."\n");
|
||||
echo("Removed ".$records['deletedstats']." records\n");
|
||||
echo("Added ".$records['addedstats']." records\n");
|
||||
echo("Completed Run in ".$timegone." seconds\n\n");
|
||||
|
||||
# Functions
|
||||
function display_help() {
|
||||
$phpself = basename(__FILE__);
|
||||
echo("\nUsage: $phpself --webui [PATH] [OPTIONS...]\n\n");
|
||||
echo("\t--webui=\"[REQUIRED: path to the Piler WebUI Directory]\"\n\n");
|
||||
echo("options:\n");
|
||||
echo("\t-a Reruns statistics for all records in the message view\n");
|
||||
echo("\t-h Prints this help screen and exits\n");
|
||||
echo("\t--start=\"Beginning of date range to process, ok values are today, yesterday or DDMMMYYYY...anything php's strtotime can process. Optional, will default to beginning of current day.\"\n");
|
||||
echo("\t--stop=\"End of date range, same parameters as above. Optional (will default to end of current day)\"\n\n");
|
||||
}
|
||||
?>
|
@ -61,6 +61,7 @@ $config['DEFAULT_POLICY'] = 'default_policy';
|
||||
|
||||
$config['DIR_BASE'] = '/var/www/piler.yourdomain.com/';
|
||||
|
||||
$config['DIR_SPHINX'] = '/var/piler/sphinx/';
|
||||
$config['DIR_STAT'] = '/var/piler/stat';
|
||||
$config['DIR_IMAP'] = '/var/piler/imap';
|
||||
$config['DIR_TMP'] = '/var/piler/tmp';
|
||||
@ -122,7 +123,7 @@ $memcached_servers = array(
|
||||
);
|
||||
|
||||
$partitions_to_monitor = array('/', '/home', '/var', '/tmp');
|
||||
|
||||
$config['DATA_PARTITION'] = '/var';
|
||||
|
||||
$langs = array(
|
||||
'hu',
|
||||
@ -174,6 +175,8 @@ define('TABLE_REMOTE', 'remote');
|
||||
define('TABLE_DOMAIN', 'domain');
|
||||
define('TABLE_DOMAIN_USER', 'domain_user');
|
||||
define('TABLE_COUNTER', 'counter');
|
||||
define('TABLE_COUNTER_MSG', 'counter_messages');
|
||||
define('TABLE_STAT_COUNTER', 'counter_stats');
|
||||
define('TABLE_AUDIT', 'audit');
|
||||
define('TABLE_ARCHIVING_RULE', 'archiving_rule');
|
||||
define('TABLE_RETENTION_RULE', 'retention_rule');
|
||||
|
99
webui/controller/accounting/accounting.php
Normal file
99
webui/controller/accounting/accounting.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerAccountingAccounting extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
$this->id = "content";
|
||||
$this->template = "accounting/accounting.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('user/user');
|
||||
$this->load->model('group/group');
|
||||
$this->load->model('accounting/accounting');
|
||||
$counters = new ModelAccountingAccounting();
|
||||
|
||||
$this->data['page'] = 0;
|
||||
$this->data['page_len'] = get_page_length();
|
||||
$this->data['sort'] = 'item';
|
||||
$this->data['sorttype'] = 0;
|
||||
$this->data['order'] = 0;
|
||||
|
||||
// get page
|
||||
if(isset($this->request->get['page']) && is_numeric($this->request->get['page']) && $this->request->get['page'] > 0) {
|
||||
$this->data['page'] = $this->request->get['page'];
|
||||
}
|
||||
|
||||
// get sort field
|
||||
if ( isset($this->request->get['sort']) ) {
|
||||
if(@$this->request->get['sort'] == "item") { $this->data['sort'] = 'item'; }
|
||||
if(@$this->request->get['sort'] == "oldest") { $this->data['sort'] = 'oldest'; $this->data['sorttype'] = 1; }
|
||||
if(@$this->request->get['sort'] == "newest") { $this->data['sort'] = 'newest'; $this->data['sorttype'] = 1; }
|
||||
if(@$this->request->get['sort'] == "sent") { $this->data['sort'] = 'sent'; }
|
||||
if(@$this->request->get['sort'] == "sentsize") { $this->data['sort'] = 'sentsize'; $this->data['sorttype'] = 2; }
|
||||
if(@$this->request->get['sort'] == "sentavg") { $this->data['sort'] = 'sentavg'; $this->data['sorttype'] = 2; }
|
||||
if(@$this->request->get['sort'] == "recd") { $this->data['sort'] = 'recd'; }
|
||||
if(@$this->request->get['sort'] == "recdsize") { $this->data['sort'] = 'recdsize'; $this->data['sorttype'] = 2; }
|
||||
if(@$this->request->get['sort'] == "recdavg") { $this->data['sort'] = 'recdavg'; $this->data['sorttype'] = 2; }
|
||||
}
|
||||
|
||||
// get sort order
|
||||
if(isset($this->request->get['order']) && is_numeric($this->request->get['order'])) {
|
||||
$this->data['order'] = $this->request->get['order'];
|
||||
}
|
||||
|
||||
// get type of accounting view
|
||||
if(@$this->request->get['view'] == "email") {
|
||||
$this->data['view'] = 'email';
|
||||
$this->data['viewname'] = "Emails";
|
||||
$this->data['accounting'] = $counters->get_accounting('email',$this->data['page'], $this->data['page_len'], $this->data['sort'], $this->data['order']);
|
||||
$this->data['total_records'] = $counters->count_accounting('email');
|
||||
}
|
||||
|
||||
if(@$this->request->get['view'] == "domain") {
|
||||
$this->data['view'] = 'domain';
|
||||
$this->data['viewname'] = "Domains";
|
||||
$this->data['accounting'] = $counters->get_accounting('domain',$this->data['page'], $this->data['page_len'], $this->data['sort'], $this->data['order']);
|
||||
$this->data['total_records'] = $counters->count_accounting('domain');
|
||||
}
|
||||
|
||||
if($this->data['accounting']) {
|
||||
foreach($this->data['accounting'] as $id=>$row) {
|
||||
if($this->data['sorttype'] == 0){
|
||||
$this->data['accounting'][$id]['display'] = $row[$this->data['sort']];
|
||||
}
|
||||
if($this->data['sorttype'] == 1){
|
||||
$this->data['accounting'][$id]['display'] = date("d M Y",$row[$this->data['sort']]);
|
||||
}
|
||||
if($this->data['sorttype'] == 2){
|
||||
$this->data['accounting'][$id]['display'] = nice_size($row[$this->data['sort']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->document->title = $this->data['text_accounting'];
|
||||
|
||||
$this->data['today'] = time()-(time()%86400);
|
||||
$this->data['days'] = 15;
|
||||
|
||||
$this->data['timespan'] = @$this->request->get['timespan'];
|
||||
$this->data['uid'] = @$this->request->get['uid'];
|
||||
|
||||
$this->data['admin_user'] = Registry::get('admin_user');
|
||||
$this->data['readonly_admin'] = Registry::get('readonly_admin');
|
||||
|
||||
$this->data['prev_page'] = $this->data['page'] - 1;
|
||||
$this->data['next_page'] = $this->data['page'] + 1;
|
||||
|
||||
$this->data['total_pages'] = floor($this->data['total_records'] / $this->data['page_len']);
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -6,6 +6,9 @@ class ControllerHealthWorker extends Controller {
|
||||
|
||||
public function index(){
|
||||
|
||||
$archivesizeraw = $sqlsizeraw = $sphinxsizeraw = 0;
|
||||
$averagemessagesweekraw = $averagemessagesmonthraw = $averagemessagesizeraw = $averagesizedayraw = $averagesqlsizeraw = $averagesphinxsizeraw = 0;
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "health/worker.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
@ -60,7 +63,9 @@ class ControllerHealthWorker extends Controller {
|
||||
$db->select_db($db->database);
|
||||
|
||||
|
||||
list($this->data['archive_size'], $this->data['counters']) = $this->model_stat_counter->get_counters();
|
||||
list($archivesizeraw, $this->data['counters']) = $this->model_stat_counter->get_counters();
|
||||
|
||||
$this->data['archive_size'] = nice_size($archivesizeraw, ' ');
|
||||
|
||||
$this->data['prefix'] = '';
|
||||
if(isset($this->data['counters'][MEMCACHED_PREFIX . 'rcvd'])) { $this->data['prefix'] = MEMCACHED_PREFIX; }
|
||||
@ -68,7 +73,38 @@ class ControllerHealthWorker extends Controller {
|
||||
$this->data['sysinfo'] = $this->model_health_health->sysinfo();
|
||||
|
||||
$this->data['options'] = $this->model_health_health->get_options();
|
||||
|
||||
$sqlsizeraw = $this->model_health_health->get_database_size();
|
||||
|
||||
$sphinxsizeraw = $this->model_health_health->get_sphinx_size();
|
||||
|
||||
/* these next counters are for projecting space */
|
||||
$averagemessagesweekraw = ($this->data['processed_emails'][1]) / 7;
|
||||
$averagemessagesmonthraw = ($this->data['processed_emails'][2]) / 30;
|
||||
$averagemessagesizeraw = $archivesizeraw / $this->data['counters']['rcvd'];
|
||||
$averagesqlsizeraw = $sqlsizeraw / $this->data['counters']['rcvd'];
|
||||
$averagesphinxsizeraw = $sphinxsizeraw / $this->data['counters']['rcvd'];
|
||||
$averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw;
|
||||
|
||||
$datapart = 0;
|
||||
foreach($this->data['shortdiskinfo'] as $part) {
|
||||
if( $part['partition'] == DATA_PARTITION ) { $datapart = $part['freespace']*1024; }
|
||||
}
|
||||
|
||||
$this->data['averagemessages'] = round($averagemessagesweekraw); // average of messages over the past week
|
||||
$this->data['averagemessagesize'] = nice_size($averagemessagesizeraw,' '); // average message size on disk
|
||||
$this->data['averagesqlsize'] = nice_size($averagesqlsizeraw,' '); // average metadata size in sql
|
||||
$this->data['averagesphinxsize'] = nice_size($averagesphinxsizeraw,' '); // average sphinx index
|
||||
$this->data['averagesizeday'] = nice_size($averagesizedayraw,' '); // average size per day
|
||||
$this->data['daysleftatcurrentrate'] = convert_days_ymd($datapart / $averagesizedayraw); // number of days of free space left
|
||||
if ( $averagemessagesweekraw > $averagemessagesmonthraw ) {
|
||||
$this->data['usagetrend'] = 1;
|
||||
} elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) {
|
||||
$this->data['usagetrend'] = -1;
|
||||
} else {
|
||||
$this->data['usagetrend'] = 0;
|
||||
}
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
@ -364,5 +364,18 @@ $_['text_primary_domain'] = "Primary Domain";
|
||||
$_['text_search_domains'] = "Search domains";
|
||||
$_['text_search_domain_to_add'] = "Search domain to add";
|
||||
|
||||
$_['text_space_projection'] = 'Space Projection';
|
||||
$_['text_average_messages_day'] = 'Average Messages per Day';
|
||||
$_['text_average_message_size'] = 'Average Message + Metadata + Index Size';
|
||||
$_['text_average_size_day'] = 'Average Size per Day';
|
||||
$_['text_partition_full'] = 'Partition Projected to be Full in';
|
||||
$_['text_usage_trend'] = 'Usage Trend';
|
||||
$_['text_usage_increasing'] = 'Increasing';
|
||||
$_['text_usage_decreasing'] = 'Decreasing';
|
||||
$_['text_usage_neutral'] = 'Neutral';
|
||||
$_['text_accounting'] = 'Archive Accounting';
|
||||
$_['text_accounting_email'] = 'By-Email Accounting';
|
||||
$_['text_accounting_domain'] = 'By-Domain Accounting';
|
||||
|
||||
|
||||
?>
|
||||
|
@ -365,4 +365,17 @@ $_['text_primary_domain'] = "Els
|
||||
$_['text_search_domains'] = "Domainek keresése";
|
||||
$_['text_search_domain_to_add'] = "Írja be a domain nevének elejét";
|
||||
|
||||
$_['text_space_projection'] = 'Tárterület előrejelzés';
|
||||
$_['text_average_messages_day'] = 'Levelek számának napi átlaga';
|
||||
$_['text_average_message_size'] = 'Átlagos levélméret + Meta adatok + Index méret';
|
||||
$_['text_average_size_day'] = 'Napi átlag méret';
|
||||
$_['text_partition_full'] = 'partíció beteléséig hátralevő idő';
|
||||
$_['text_usage_trend'] = 'Kihasználtság trend';
|
||||
$_['text_usage_increasing'] = 'nő';
|
||||
$_['text_usage_decreasing'] = 'csökken';
|
||||
$_['text_usage_neutral'] = 'nem változik';
|
||||
$_['text_accounting'] = 'Archívum statisztika';
|
||||
$_['text_accounting_email'] = 'Email szerint';
|
||||
$_['text_accounting_domain'] = 'Domain szerint';
|
||||
|
||||
?>
|
||||
|
@ -365,4 +365,17 @@ $_['text_primary_domain'] = "Elsődleges Domain";
|
||||
$_['text_search_domains'] = "Domainek keresése";
|
||||
$_['text_search_domain_to_add'] = "Írja be a domain nevének elejét";
|
||||
|
||||
$_['text_space_projection'] = 'Tárterület előrejelzés';
|
||||
$_['text_average_messages_day'] = 'Levelek számának napi átlaga';
|
||||
$_['text_average_message_size'] = 'Átlagos levélméret + Meta adatok + Index méret';
|
||||
$_['text_average_size_day'] = 'Napi átlag méret';
|
||||
$_['text_partition_full'] = 'partíció beteléséig hátralevő idő';
|
||||
$_['text_usage_trend'] = 'Kihasználtság trend';
|
||||
$_['text_usage_increasing'] = 'nő';
|
||||
$_['text_usage_decreasing'] = 'csökken';
|
||||
$_['text_usage_neutral'] = 'nem változik';
|
||||
$_['text_accounting'] = 'Archívum statisztika';
|
||||
$_['text_accounting_email'] = 'Email szerint';
|
||||
$_['text_accounting_domain'] = 'Domain szerint';
|
||||
|
||||
?>
|
||||
|
@ -364,4 +364,17 @@ $_['text_primary_domain'] = "Primary Domain";
|
||||
$_['text_search_domains'] = "Search domains";
|
||||
$_['text_search_domain_to_add'] = "Search domain to add";
|
||||
|
||||
$_['text_space_projection'] = 'Space Projection';
|
||||
$_['text_average_messages_day'] = 'Average Messages per Day';
|
||||
$_['text_average_message_size'] = 'Average Message + Metadata + Index Size';
|
||||
$_['text_average_size_day'] = 'Average Size per Day';
|
||||
$_['text_partition_full'] = 'Partition Projected to be Full in';
|
||||
$_['text_usage_trend'] = 'Useage Trend';
|
||||
$_['text_usage_increasing'] = 'Increasing';
|
||||
$_['text_usage_decreasing'] = 'Decreasing';
|
||||
$_['text_usage_neutral'] = 'Neutral';
|
||||
$_['text_accounting'] = 'Archive Accounting';
|
||||
$_['text_accounting_email'] = 'By-Email Accounting';
|
||||
$_['text_accounting_domain'] = 'By-Domain Accounting';
|
||||
|
||||
?>
|
||||
|
242
webui/model/accounting/accounting.php
Normal file
242
webui/model/accounting/accounting.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
class ModelAccountingAccounting extends Model
|
||||
{
|
||||
|
||||
public function run_counters( $start=NULL, $end = NULL )
|
||||
{
|
||||
$now = time();
|
||||
$counter = array();
|
||||
$accepteddomains = array_flip( $this->__getAcceptedDomains() );
|
||||
$return = array(
|
||||
'starttimestamp' => 0,
|
||||
'endtimestamp' => 0,
|
||||
'addedstats' => 0,
|
||||
'deletedstats' => 0,
|
||||
);
|
||||
|
||||
if ( !is_null($start) )
|
||||
{
|
||||
$start = $this->__decodeDate( $start );
|
||||
} elseif ( is_null($start) )
|
||||
{
|
||||
//if we are passed nothing, operate on today
|
||||
$start = $this->__decodeDate( "00:00:00" );
|
||||
}
|
||||
|
||||
if ( !is_null($end) )
|
||||
{
|
||||
$end = $this->__decodeDate( $end );
|
||||
$end = $end + 86400;
|
||||
} elseif ( is_null($end) )
|
||||
{
|
||||
//if we are passed nothing, operate on today
|
||||
$end = $this->__decodeDate( "00:00:00" );
|
||||
$end = $end + 86400;
|
||||
}
|
||||
|
||||
$return['starttimestamp'] = $start;
|
||||
$return['endtimestamp'] = $end;
|
||||
|
||||
// run query to return all messages
|
||||
$tousers = $this->db->query('SELECT `sent`-(`sent`%86400) as `day`,`to`,count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$end.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `to`;');
|
||||
$fromusers = $this->db->query('SELECT `sent`-(`sent`%86400) as `day`,`from`,count(*) as `count`,sum(`size`) as `size` FROM ' . VIEW_MESSAGES . ' WHERE `sent` >= '.$start.' AND `sent` < '.$end.' GROUP BY FROM_UNIXTIME(`day`, "%Y.%m.%d."), `from`;');
|
||||
|
||||
// process results from above four queries
|
||||
if($tousers->num_rows > 0)
|
||||
{
|
||||
foreach($tousers->rows as $row)
|
||||
{
|
||||
$counter[$row['day']][$row['to']]['recd'] = $row['count'];
|
||||
$counter[$row['day']][$row['to']]['sizerecd'] = $row['size'];
|
||||
}
|
||||
}
|
||||
if($fromusers->num_rows > 0)
|
||||
{
|
||||
foreach($fromusers->rows as $row)
|
||||
{
|
||||
$counter[$row['day']][$row['from']]['sent'] = $row['count'];
|
||||
$counter[$row['day']][$row['from']]['sizesent'] = $row['size'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $counter as $date=>$users )
|
||||
{
|
||||
|
||||
// execute queries to update the users and domains counter table
|
||||
$deletestats = $this->db->query("DELETE FROM " . TABLE_STAT_COUNTER . " WHERE `date` = $date;");
|
||||
$return['deletedstats'] = $return['deletedstats'] + $this->db->countAffected();
|
||||
|
||||
foreach( $users as $username => $userdata)
|
||||
{
|
||||
//todo: consolidate
|
||||
$sent = isset($userdata['sent']) ? $userdata['sent'] : 0;
|
||||
$recd = isset($userdata['recd']) ? $userdata['recd'] : 0;
|
||||
$sizesent = isset($userdata['sizesent']) ? $userdata['sizesent'] : 0;
|
||||
$sizerecd = isset($userdata['sizerecd']) ? $userdata['sizerecd'] : 0;
|
||||
|
||||
$parts = explode('@',$username);
|
||||
|
||||
if ( isset($accepteddomains[ $parts[1] ]) ) {
|
||||
$addusers = $this->db->query("INSERT INTO " . TABLE_STAT_COUNTER . " (`date`,`email`,`domain`,`sent`,`recd`,`sentsize`,`recdsize`) VALUES($date,'$username','".$parts[1]."',$sent,$recd,$sizesent,$sizerecd);");
|
||||
$return['addedstats'] = $return['addedstats'] + $this->db->countAffected();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("processed %s to %s: %d records deleted, %d records added",date("d M Y",$return['starttimestamp']),date("d M Y",$return['endtimestamp']),$return['deletedstats'],$return['addedstats'])); }
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function get_accounting($item = 'email',$page=0,$pagelen=0,$sort='item',$order=0 ) {
|
||||
|
||||
// item can be either email or domain, maybe folder in the future??
|
||||
|
||||
$_order = 0;
|
||||
$_order = "";
|
||||
$limit = "";
|
||||
$return = array();
|
||||
|
||||
/*
|
||||
if(MEMCACHED_ENABLED) {
|
||||
$memcache = Registry::get('memcache');
|
||||
|
||||
$statscounter = $memcache->get(Registry::get('statscounters'));
|
||||
|
||||
if(isset($counter[MEMCACHED_PREFIX . 'counters_last_update'])) {
|
||||
if(isset($counter[MEMCACHED_PREFIX . 'size'])) { $asize = nice_size($counter[MEMCACHED_PREFIX . 'size'], ' '); }
|
||||
unset($counter[MEMCACHED_PREFIX . 'size']);
|
||||
|
||||
return array ($asize, $counter);
|
||||
}
|
||||
} */
|
||||
|
||||
$account_for_emails = $this->__getEmails();
|
||||
$account_for_domains = $this->__getDomains();
|
||||
|
||||
|
||||
|
||||
if ($item == 'email') {
|
||||
$account_for_emails = $this->__getEmails();
|
||||
$account_for_domains = $this->__getDomains();
|
||||
$query = "SELECT `email` AS `item`,MIN(`date`) as `oldest`,MAX(`date`) as `newest`,sum(`sent`) as `sent`,sum(`recd`) as `recd`,SUM(`sentsize`) as `sentsize`,AVG(`sentsize`) as `sentavg`,SUM(`recdsize`) as `recdsize`,AVG(`recdsize`) as `recdavg` FROM " . TABLE_STAT_COUNTER;
|
||||
$where = "WHERE `email` IN ('".implode("','",$account_for_emails)."') OR `domain` IN ('".implode("','",$account_for_domains)."')";
|
||||
$group = "GROUP BY `email`";
|
||||
} elseif ($item == 'domain') {
|
||||
$account_for_domains = $this->__getDomains();
|
||||
$query = "SELECT `domain` AS `item`,MIN(`date`) as `oldest`,MAX(`date`) as `newest`,sum(`sent`) as `sent`,sum(`recd`) as `recd`,SUM(`sentsize`) as `sentsize`,AVG(`sentsize`) as `sentavg`,SUM(`recdsize`) as `recdsize`,AVG(`recdsize`) as `recdavg` FROM " . TABLE_STAT_COUNTER;
|
||||
$where = "WHERE `domain` IN ('".implode("','",$account_for_domains)."')";
|
||||
$group = "GROUP BY `domain`";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($order == 0) { $order = "ASC"; }
|
||||
else { $order = "DESC"; }
|
||||
|
||||
$_order = "ORDER BY `$sort` $order";
|
||||
|
||||
$from = (int)$page * (int)$pagelen;
|
||||
|
||||
if($pagelen > 0) { $limit = " LIMIT " . (int)$from . ", " . (int)$pagelen; }
|
||||
|
||||
$query = $this->db->query($query.' '.$where.' '.$group.' '.$_order.' '.$limit.';');
|
||||
|
||||
if($query->num_rows >= 1)
|
||||
{
|
||||
return $query->rows;
|
||||
} else {
|
||||
// no results found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function count_accounting($item = 'email') {
|
||||
|
||||
$account_for_emails = $this->__getEmails();
|
||||
$account_for_domains = $this->__getDomains();
|
||||
|
||||
$query = "SELECT `email` AS `item`,MIN(`date`) as `oldest`,MAX(`date`) as `newest`,sum(`sent`) as `sent`,sum(`recd`) as `recd`,sum(`sentsize`) as `sentsize`,sum(`recdsize`) as `recdsize` FROM " . TABLE_STAT_COUNTER;
|
||||
|
||||
if ($item == 'email') {
|
||||
$where = "WHERE `email` IN ('".implode("','",$account_for_emails)."') OR `domain` IN ('".implode("','",$account_for_domains)."')";
|
||||
$group = "GROUP BY `email`";
|
||||
} elseif ($item == 'domain') {
|
||||
$where = "WHERE `domain` IN ('".implode("','",$account_for_domains)."')";
|
||||
$group = "GROUP BY `domain`";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->query($query.' '.$where.' '.$group.';');
|
||||
|
||||
return $query->num_rows;
|
||||
}
|
||||
|
||||
private function __getEmails() {
|
||||
$return = array();
|
||||
array_push($return,$_SESSION['email']);
|
||||
foreach ($_SESSION['emails'] as $e) {
|
||||
array_push($return,$e);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function __getDomains() {
|
||||
$return = array();
|
||||
|
||||
if(Registry::get('admin_user') >= 1) {
|
||||
$return = $this->__getAcceptedDomains();
|
||||
}elseif(Registry::get('auditor_user') == 1) {
|
||||
array_push($return,$_SESSION['domain']);
|
||||
foreach ($return as $d) {
|
||||
array_push($return,$d);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
private function __getAcceptedDomains() {
|
||||
// todo: move to domains model?
|
||||
$return = array();
|
||||
|
||||
$query = $this->db->query("SELECT domain, mapped FROM " . TABLE_DOMAIN . " ORDER BY domain ASC");
|
||||
|
||||
foreach($query->rows as $domain)
|
||||
{
|
||||
if ($domain['domain'] == $domain['mapped']) {
|
||||
array_push($return,$domain['domain']);
|
||||
} else {
|
||||
array_push($return,$domain['mapped']);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function __decodeDate( $input ) {
|
||||
|
||||
if ( !is_numeric($input) )
|
||||
{
|
||||
// if we are passed words (yesterday, today), convert to unix timestamps representing the start of the day
|
||||
$input = strtotime($input);
|
||||
$return = $input - ($input%86400);
|
||||
|
||||
} elseif ( is_numeric($input) )
|
||||
{
|
||||
// if we are passed unix timestamps, ensure they represent the start of the day
|
||||
$return = $input - ($input%86400);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -80,7 +80,7 @@ class ModelHealthHealth extends Model {
|
||||
public function diskinfo() {
|
||||
$shortinfo = array();
|
||||
|
||||
$s = exec("df -h", $output);
|
||||
$s = exec("df", $output);
|
||||
|
||||
$partitions = Registry::get('partitions_to_monitor');
|
||||
|
||||
@ -90,6 +90,7 @@ class ModelHealthHealth extends Model {
|
||||
if(isset($p[5]) && in_array($p[5], $partitions)) {
|
||||
$shortinfo[] = array(
|
||||
'partition' => $p[5],
|
||||
'freespace' => $p[3],
|
||||
'utilization' => preg_replace("/\%/", "", $p[4])
|
||||
);
|
||||
}
|
||||
@ -137,6 +138,46 @@ class ModelHealthHealth extends Model {
|
||||
|
||||
}
|
||||
|
||||
public function get_database_size() {
|
||||
$data = array();
|
||||
|
||||
$query = $this->db->query("SELECT table_schema AS `name`,
|
||||
SUM( data_length + index_length ) AS `size`
|
||||
FROM information_schema.TABLES
|
||||
WHERE table_schema = '".DB_DATABASE."'
|
||||
GROUP BY table_schema;");
|
||||
if(isset($query->rows)) {
|
||||
$data = array_pop($query->rows);
|
||||
}
|
||||
|
||||
return $data['size'];
|
||||
}
|
||||
|
||||
|
||||
public function get_sphinx_size() {
|
||||
$dirSize=0;
|
||||
$directory = DIR_SPHINX;
|
||||
|
||||
if(!$dh=opendir($directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while($file = readdir($dh)) {
|
||||
if($file == "." || $file == "..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(is_file($directory."/".$file)) {
|
||||
$dirSize += filesize($directory."/".$file);
|
||||
}
|
||||
if(is_dir($directory."/".$file)) {
|
||||
$dirSize += getDirectorySize($directory."/".$file);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
return $dirSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,14 @@ class ModelUserUser extends Model {
|
||||
public function get_users_all_domains($uid = 0) {
|
||||
$data = array();
|
||||
|
||||
array_push($data, $_SESSION['domain']);
|
||||
|
||||
if($uid > 0) {
|
||||
$query = $this->db->query("SELECT domain FROM " . TABLE_DOMAIN_USER . " WHERE uid=?", array((int)$uid));
|
||||
|
||||
if(isset($query->rows)) {
|
||||
foreach ($query->rows as $q) {
|
||||
array_push($data, $q['domain']);
|
||||
if(!in_array($q['domain'], $data)) { array_push($data, $q['domain']); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -460,4 +460,18 @@ function make_short_string($what, $length) {
|
||||
}
|
||||
|
||||
|
||||
function convert_days_ymd($convert) {
|
||||
$years = ($convert / 365) ; // days / 365 days
|
||||
$years = floor($years); // Remove all decimals
|
||||
|
||||
$month = ($convert % 365) / 30.5; // I choose 30.5 for Month (30,31) ;)
|
||||
$month = floor($month); // Remove all decimals
|
||||
|
||||
$days = ($convert % 365) % 30.5; // the rest of days
|
||||
|
||||
// Return array of years, months, days
|
||||
return array( $years,$month,$days );
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -590,8 +590,6 @@ var Piler =
|
||||
document.body.style.cursor = 'default';
|
||||
})
|
||||
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
|
||||
|
||||
setInterval('Piler.load_health()', Piler.health_refresh * 1000);
|
||||
},
|
||||
|
||||
|
||||
|
79
webui/view/theme/default/templates/accounting/accounting.tpl
Normal file
79
webui/view/theme/default/templates/accounting/accounting.tpl
Normal file
@ -0,0 +1,79 @@
|
||||
<p> </p>
|
||||
|
||||
<p>
|
||||
<?php if ($view == 'email') { echo '<strong>'.$text_accounting_email.'</strong>'; } else { echo '<a href="index.php?route=accounting/accounting&view=email">'.$text_accounting_email.'</a>'; } ?> |
|
||||
<?php if ($view == 'domain') { echo '<strong>'.$text_accounting_domain.'</strong>'; } else { echo '<a href="index.php?route=accounting/accounting&view=domain">'.$text_accounting_domain.'</a>'; } ?>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<?php if ( $accounting ) { ?>
|
||||
|
||||
<div id="pagenav">
|
||||
<?php if($page > 0){ ?><a href="index.php?route=accounting/accounting&page=0&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> « <?php if($page > 0){ ?></a><?php } ?>
|
||||
<?php if($page > 0){ ?><a href="index.php?route=accounting/accounting&page=<?php print $prev_page; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> ‹ <?php if($page > 0){ ?></a><?php } ?>
|
||||
<?php if(count($accounting) > 0) { print $accounting[0]['display']; ?> - <?php print $accounting[count($accounting)-1]['display']; } ?>
|
||||
<?php if($total_records >= $page_len*($page+1) && $total_records > $page_len){ ?><a href="index.php?route=accounting/accounting&page=<?php print $next_page; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> › <?php if($total_records >= $page_len*($page+1) && $total_records > $page_len){ ?></a><?php } ?>
|
||||
<?php if($page < $total_pages){ ?><a href="index.php?route=accounting/accounting&page=<?php print $total_pages; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> » <?php if($page < $total_pages){ ?></a><?php } ?>
|
||||
</div>
|
||||
|
||||
<div id="ss1" style="margin-top: 10px;">
|
||||
<div class="domainrow">
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell">Sent</div>
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell">Received</div>
|
||||
<div class="domaincell"> </div>
|
||||
<div class="domaincell"> </div>
|
||||
</div>
|
||||
<div class="domainrow">
|
||||
<div class="domaincell"><?php echo $viewname; ?> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=item&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=item&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Oldest Record <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=oldest&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=oldest&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Newest Record <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=newest&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=newest&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Items <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sent&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sent&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Size <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sentsize&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sentsize&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Avg Size <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sentavg&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=sentavg&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Items <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recd&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recd&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Size <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recdsize&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recdsize&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
<div class="domaincell">Avg Size <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recdavg&order=0"><img src="<?php print ICON_ARROW_UP; ?>" border="0"></a> <a href="index.php?route=accounting/accounting&view=<?php echo $view; ?>&sort=recdavg&order=1"><img src="<?php print ICON_ARROW_DOWN; ?>" border="0"></a></div>
|
||||
</div>
|
||||
|
||||
<?php foreach($accounting as $details) {?>
|
||||
<div class="domainrow">
|
||||
<div class="domaincell"><?php echo $details['item']; ?></div>
|
||||
<div class="domaincell"><?php echo date("d M Y",$details['oldest']); ?></div>
|
||||
<div class="domaincell"><?php echo date("d M Y",$details['newest']); ?></div>
|
||||
<div class="domaincell">
|
||||
<?php echo $details['sent']; ?>
|
||||
</div>
|
||||
<div class="domaincell">
|
||||
<?php echo nice_size($details['sentsize']); ?>
|
||||
</div>
|
||||
<div class="domaincell">
|
||||
<?php echo nice_size($details['sentavg']); ?>
|
||||
</div>
|
||||
<div class="domaincell">
|
||||
<?php echo $details['recd']; ?>
|
||||
</div>
|
||||
<div class="domaincell">
|
||||
<?php echo nice_size($details['recdsize']); ?>
|
||||
</div>
|
||||
<div class="domaincell">
|
||||
<?php echo nice_size($details['recdavg']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div id="pagenav">
|
||||
<?php if($page > 0){ ?><a href="index.php?route=accounting/accounting&page=0&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> « <?php if($page > 0){ ?></a><?php } ?>
|
||||
<?php if($page > 0){ ?><a href="index.php?route=accounting/accounting&page=<?php print $prev_page; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> ‹ <?php if($page > 0){ ?></a><?php } ?>
|
||||
<?php if(count($accounting) > 0) { print $accounting[0]['display']; ?> - <?php print $accounting[count($accounting)-1]['display']; } ?>
|
||||
<?php if($total_records >= $page_len*($page+1) && $total_records > $page_len){ ?><a href="index.php?route=accounting/accounting&page=<?php print $next_page; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> › <?php if($total_records >= $page_len*($page+1) && $total_records > $page_len){ ?></a><?php } ?>
|
||||
<?php if($page < $total_pages){ ?><a href="index.php?route=accounting/accounting&page=<?php print $total_pages; ?>&view=<?php echo $view; ?>&sort=<?php print $sort; ?>&order=<?php print $order; ?>" class="navlink"><?php } ?> » <?php if($page < $total_pages){ ?></a><?php } ?>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<p>No <?php echo $viewname; ?> Found</p>
|
||||
<?php } ?>
|
@ -20,7 +20,7 @@
|
||||
<script type="text/javascript" src="/view/javascript/piler.js"></script>
|
||||
</head>
|
||||
|
||||
<body<?php if(isset($this->request->get['route']) && $this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health();"<?php } ?>>
|
||||
<body<?php if(isset($this->request->get['route']) && $this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php } ?>>
|
||||
|
||||
<div id="piler1">
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
<ul class="sub_menu">
|
||||
<li><a href="index.php?route=stat/stat×pan=daily"><?php print $text_statistics; ?></a></li>
|
||||
<li><a href="index.php?route=health/health"><?php print $text_health; ?></a></li>
|
||||
<li><a href="index.php?route=accounting/accounting&view=email"><?php print $text_accounting; ?></a></li>
|
||||
<?php if(ENABLE_AUDIT == 1) { ?>
|
||||
<li><a href="index.php?route=audit/audit"><?php print $text_audit; ?></a></li>
|
||||
<?php } ?>
|
||||
|
@ -91,6 +91,17 @@
|
||||
<div class="cellhealthright"><?php foreach($shortdiskinfo as $partition) { ?><span class="<?php if($partition['utilization'] < HEALTH_RATIO) { ?>ok<?php } else { ?>error<?php } ?>"><?php print $partition['partition']; ?> <?php print $partition['utilization']; ?>%</span> <?php } ?></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="cellhealthleft"><?php print $text_space_projection; ?></div>
|
||||
<div class="cellhealthright">
|
||||
<?php print $averagemessages; ?> (<?php print $text_average_messages_day; ?>)<br/>
|
||||
<?php print $averagemessagesize; ?> + <?php print $averagesqlsize; ?> + <?php print $averagesphinxsize; ?> (<?php print $text_average_message_size; ?>)<br/>
|
||||
<?php print $averagesizeday; ?> (<?php print $text_average_size_day; ?>)<br/>
|
||||
<?php print $daysleftatcurrentrate[0]; ?> years, <?php print $daysleftatcurrentrate[1]; ?> months, <?php print $daysleftatcurrentrate[2]; ?> days ("<?php print DATA_PARTITION; ?>" <?php print $text_partition_full; ?>)<br/>
|
||||
<?php if ( $usagetrend > 0 ) { print $text_usage_increasing; } elseif( $usagetrend < 0 ) { print $text_useage_decreasing; } else { print $text_usage_neutral; } ?> (<?php print $text_usage_trend; ?>)<br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></div>
|
||||
|
||||
</body>
|
||||
|
@ -86,6 +86,32 @@
|
||||
<?php } } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="cellhealthleft"><?php print $text_space_projection; ?></div>
|
||||
<div class="cellhealthright">
|
||||
<div class="row">
|
||||
<div class="cellhealthright"><?php print $text_average_messages_day; ?></div>
|
||||
<div class="cellhealthright"><?php print $averagemessages; ?></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cellhealthright"><?php print $text_average_message_size; ?></div>
|
||||
<div class="cellhealthright"><?php print $averagemessagesize; ?> + <?php print $averagesqlsize; ?> + <?php print $averagesphinxsize; ?></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cellhealthright"><?php print $text_average_size_day; ?></div>
|
||||
<div class="cellhealthright"><?php print $averagesizeday; ?></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cellhealthright">"<?php print DATA_PARTITION; ?>" <?php print $text_partition_full; ?></div>
|
||||
<div class="cellhealthright"><?php print $daysleftatcurrentrate[0]; ?> years, <?php print $daysleftatcurrentrate[1]; ?> months, <?php print $daysleftatcurrentrate[2]; ?> days</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="cellhealthright"><?php print $text_usage_trend; ?></div>
|
||||
<div class="cellhealthright"><?php if ( $usagetrend > 0 ) { print $text_usage_increasing; } elseif( $usagetrend < 0 ) { print $text_usage_decreasing; } else { print $text_usage_neutral; } ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user