2010-02-10 Sancho Lerena <slerena@artica.es>
* godmode/db/db_main.php: Added new metrics about DB usage. Added last time pandora_db.pl was running in the system. * godmode/db/db_info.php: Added graphic from db_main git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2347 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
888714e237
commit
c219d06ef2
|
@ -1,5 +1,10 @@
|
|||
2010-02-10 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* godmode/db/db_main.php: Added new metrics about DB usage. Added
|
||||
last time pandora_db.pl was running in the system.
|
||||
|
||||
* godmode/db/db_info.php: Added graphic from db_main
|
||||
|
||||
* operation/reporting/reporting_viewer_pdf.php
|
||||
include/functions_reporting_pdf.php: Small fixes for PDF reporting.
|
||||
Decode entities to show texts correctly in description of each element.
|
||||
|
|
|
@ -41,6 +41,16 @@ if (! give_acl ($config['id_user'], 0, "DM")) {
|
|||
|
||||
echo "<h2>".__('Database maintenance')." » ";
|
||||
echo __('Database information')."</h2>";
|
||||
|
||||
if ($config['flash_charts']) {
|
||||
$width=600;
|
||||
$height=400;
|
||||
echo grafico_db_agentes_purge ($id_agente, $width, $height);
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_purge&id=-1&height=400&width=600">';
|
||||
}
|
||||
|
||||
|
||||
echo '<div id="db_info_graph">';
|
||||
echo '<table border=0>';
|
||||
echo '<tr><td>';
|
||||
|
|
|
@ -28,33 +28,142 @@ if (! give_acl ($config['id_user'], 0, "DM")) {
|
|||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
// Todo for a good DB maintenance
|
||||
/*
|
||||
- Delete too on datos_string and and datos_inc tables
|
||||
|
||||
- A function to "compress" data, and interpolate big chunks of data (1 month - 60000 registers)
|
||||
onto a small chunk of interpolated data (1 month - 600 registers)
|
||||
// Get some general DB stats (not very heavy)
|
||||
// NOTE: this is not realtime monitoring stats, are more focused on DB sanity
|
||||
|
||||
- A more powerful selection (by Agent, by Module, etc).
|
||||
*/
|
||||
$stat_access = get_db_sql ("SELECT COUNT(*) FROM tagent_access WHERE id_agent != 0");
|
||||
$stat_data = get_db_sql ("SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0");
|
||||
$stat_data_string = get_db_sql ("SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0");
|
||||
$stat_modules = get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE id_agente_modulo != 0");
|
||||
$stat_event = get_db_sql (" SELECT COUNT(*) FROM tevento");
|
||||
$stat_agente = get_db_sql (" SELECT COUNT(*) FROM tagente");
|
||||
$stat_uknown = get_db_sql ("SELECT COUNT(*) FROM tagente WHERE ultimo_contacto < NOW() - (intervalo *2)");
|
||||
$stat_noninit = get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE utimestamp = 0;");
|
||||
|
||||
echo '<h2>'.__('Database maintenance').' » '.__('Current database maintenance setup').'</h2>
|
||||
<table width="550" cellspacing="3" cellpadding="3" border="0">
|
||||
<tr><td>
|
||||
<i>'.__('Max. time before compact data').':</i> <b>'.$config['days_compact'].' '.__('days').'</b><br /><br />
|
||||
<i>'.__('Max. time before purge').':</i> <b>'.$config['days_purge'].' '.__('days').'</b><br /><br />
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<div align="justify">
|
||||
'.__('Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\'s very important to keep up-to-date database to get the best performance and results in Pandora').'
|
||||
</div><br />';
|
||||
if ($config['flash_charts']) {
|
||||
$width=600;
|
||||
$height=400;
|
||||
echo grafico_db_agentes_purge ($id_agente, $width, $height);
|
||||
// Todo: Recalculate this data dinamically using the capacity and total agents
|
||||
|
||||
$max_access = 1000000;
|
||||
$max_data = 12000000;
|
||||
|
||||
echo '<h2>'.__('Database maintenance').' » '.__('Current database maintenance setup').'</h2>';
|
||||
|
||||
echo '<table class=databox width="550" cellspacing="4" cellpadding="4" border="0">';
|
||||
|
||||
// Current setup
|
||||
|
||||
echo '<tr><th colspan=2><i>';
|
||||
echo __('Database setup');
|
||||
echo '</i></td></tr>';
|
||||
|
||||
echo '<tr class="rowOdd"><td>';
|
||||
echo __('Max. time before compact data');
|
||||
echo '<td><b>';
|
||||
echo $config['days_compact'].' '.__('days');
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Max. time before purge');
|
||||
echo '<td><b>';
|
||||
echo $config['days_purge'].' '.__('days');
|
||||
echo '</b></td></tr>';
|
||||
|
||||
|
||||
// DB size stats
|
||||
|
||||
echo '<tr><th colspan=2><i>';
|
||||
echo __('Database size stats');
|
||||
echo '</i></td></tr>';
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Total agents');
|
||||
echo '<td><b>';
|
||||
echo $stat_agente;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowOdd"><td>';
|
||||
echo __('Total events');
|
||||
echo '<td><b>';
|
||||
echo $stat_event;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Total data items (tagente_datos)');
|
||||
echo '<td><b>';
|
||||
|
||||
if ($stat_data > $max_data)
|
||||
echo "<font color='#ff0000'>$stat_data</font>";
|
||||
else
|
||||
echo $stat_data;
|
||||
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowOdd"><td>';
|
||||
echo __('Total data string items (tagente_datos_string)');
|
||||
echo '<td><b>';
|
||||
echo $stat_data_string;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Total modules configured');
|
||||
echo '<td><b>';
|
||||
echo $stat_modules;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
|
||||
|
||||
echo '<tr class="rowOdd"><td>';
|
||||
echo __('Total agent access records');
|
||||
echo '<td><b>';
|
||||
if ($stat_access > $max_access)
|
||||
echo "<font color='#ff0000'>$stat_access</font>";
|
||||
else
|
||||
echo $stat_access;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
// Sanity
|
||||
|
||||
echo '<tr><th colspan=2><i>';
|
||||
echo __('Database sanity');
|
||||
echo '</i></td></tr>';
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Total uknown agents');
|
||||
echo '<td><b>';
|
||||
echo $stat_uknown;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
echo '<tr class="rowOdd"><td>';
|
||||
echo __('Total non-init modules');
|
||||
echo '<td><b>';
|
||||
echo $stat_noninit;
|
||||
echo '</b></td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<tr class="rowPair"><td>';
|
||||
echo __('Last time on DB maintance');
|
||||
echo '<td>';
|
||||
|
||||
if (!isset($config['db_maintance'])){
|
||||
echo "<b><font size=12px>".__("Never")."</font></b>";
|
||||
} else {
|
||||
echo '<img src="include/fgraph.php?tipo=db_agente_purge&id=-1&height=400&width=600">';
|
||||
$seconds = time()-$config['db_maintance'];
|
||||
if ($seconds > 90000) //(1,1 days)
|
||||
echo "<b><font color='#ff0000' size=12px>";
|
||||
else
|
||||
echo "<font><b>";
|
||||
|
||||
echo human_time_description($seconds);
|
||||
echo " *";
|
||||
}
|
||||
echo '</td></tr>
|
||||
</table>';
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
echo '<tr><td colspan=2>';
|
||||
echo '<div align="justify"><br><hr width=100%>';
|
||||
echo '(*) '.__('Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\'s very important to keep up-to-date database to get the best performance and results in Pandora');
|
||||
echo '</div>';
|
||||
echo '</td></tr></table>';
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue