diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4b9fc40255..6b8e15bf8d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,5 +1,10 @@ 2010-02-10 Sancho Lerena + * 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. diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 04604f9750..acdfcfbb6c 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -41,6 +41,16 @@ if (! give_acl ($config['id_user'], 0, "DM")) { echo "

".__('Database maintenance')." » "; echo __('Database information')."

"; + +if ($config['flash_charts']) { + $width=600; + $height=400; + echo grafico_db_agentes_purge ($id_agente, $width, $height); +} else { + echo ''; +} + + echo '
'; echo ''; echo '
'; diff --git a/pandora_console/godmode/db/db_main.php b/pandora_console/godmode/db/db_main.php index d0f25640a9..bd84b3fcac 100644 --- a/pandora_console/godmode/db/db_main.php +++ b/pandora_console/godmode/db/db_main.php @@ -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) - - - A more powerful selection (by Agent, by Module, etc). -*/ -echo '

'.__('Database maintenance').' » '.__('Current database maintenance setup').'

- - -"; + + +echo '
-'.__('Max. time before compact data').': '.$config['days_compact'].' '.__('days').'

-'.__('Max. time before purge').': '.$config['days_purge'].' '.__('days').'

-
-
-'.__('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').' -

'; -if ($config['flash_charts']) { - $width=600; - $height=400; - echo grafico_db_agentes_purge ($id_agente, $width, $height); +// Get some general DB stats (not very heavy) +// NOTE: this is not realtime monitoring stats, are more focused on DB sanity + +$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;"); + +// Todo: Recalculate this data dinamically using the capacity and total agents + +$max_access = 1000000; +$max_data = 12000000; + +echo '

'.__('Database maintenance').' » '.__('Current database maintenance setup').'

'; + +echo ''; + +// Current setup + +echo ''; + +echo ''; + +echo ''; + + +// DB size stats + +echo ''; + +echo ''; + +echo ''; + +echo ''; + +echo ''; + +echo ''; + + + +echo ''; + +// Sanity + +echo ''; + +echo ''; + +echo ''; + + + + +echo ' -
'; +echo __('Database setup'); +echo '
'; +echo __('Max. time before compact data'); +echo ''; +echo $config['days_compact'].' '.__('days'); +echo '
'; +echo __('Max. time before purge'); +echo ''; +echo $config['days_purge'].' '.__('days'); +echo '
'; +echo __('Database size stats'); +echo '
'; +echo __('Total agents'); +echo ''; +echo $stat_agente; +echo '
'; +echo __('Total events'); +echo ''; +echo $stat_event; +echo '
'; +echo __('Total data items (tagente_datos)'); +echo ''; + +if ($stat_data > $max_data) + echo "$stat_data"; +else + echo $stat_data; + +echo '
'; +echo __('Total data string items (tagente_datos_string)'); +echo ''; +echo $stat_data_string; +echo '
'; +echo __('Total modules configured'); +echo ''; +echo $stat_modules; +echo '
'; +echo __('Total agent access records'); +echo ''; +if ($stat_access > $max_access) + echo "$stat_access"; +else + echo $stat_access; +echo '
'; +echo __('Database sanity'); +echo '
'; +echo __('Total uknown agents'); +echo ''; +echo $stat_uknown; +echo '
'; +echo __('Total non-init modules'); +echo ''; +echo $stat_noninit; +echo '
'; +echo __('Last time on DB maintance'); +echo ''; + +if (!isset($config['db_maintance'])){ + echo "".__("Never").""; } else { - echo ''; + $seconds = time()-$config['db_maintance']; + if ($seconds > 90000) //(1,1 days) + echo ""; + else + echo ""; + + echo human_time_description($seconds); + echo " *"; } -echo '
'; +echo "
'; +echo '


'; +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 '
'; +echo '
'; ?>