diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f2219f948a..4a45f526f1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,103 @@ +2010-02-19 Sancho Lerena + + * functions_events.php: Fixed typo (switched meaning) in two labels. + + * include/styles/pandora.css: Changed background color of th default style. + + * include/functions_reporting.php: Improved function get_group_stats(). Now + supports stats from batch-mode and get realtime stats in a more efficient + way. Fixed get_fired_alerts_reporting_table() to avoid problems in external + reporting (PDF & XML). + + * include/functions_servers.php: get_server_performance() now uses batch mode + stats reporting, and improved also the realtime stats generation. Same with + function get_server_info(). + + * include/functions_config.php: Added new config tokens (not fully + implemented yet) for event, trap, strings and audit automatic purge. + + * include/functions_ui.php: Added new print_page_header() function to set + the new standard header in all pages, using the "tabbed" format to show + the title, subtitle and other options like help, or custom-tabs for the page + + * pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to + tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to + agents_unknown. + + * extensions/ext_backup: New directory to place "deleted" extensions. + + * extensions/dbmanager/dbmanager.css: Table names now are in it's original + lowercase/uppercase format. + + * extensions/dbmanager.php: Updated headers, and now return "empty" when + a search is empty, instead "error" as before. + + * extensions/users_connected.php + extensions/module_groups.php + extensions/plugin_registration.php + extensions/pandora_logs.php + operation/incidents/incident.php + operation/snmpconsole/snmp_view.php + operation/users/user.php + operation/users/user_edit.php + godmode/agentes/planned_downtime.php + operation/events/events.php + operation/visual_console/index.php + operation/agentes/estado_generalagente.php + operation/agentes/estado_agente.php + operation/agentes/exportdata.php + operation/agentes/ver_agente.php + operation/agentes/status_monitor.php + operation/agentes/alerts_status.php + operation/users/user_statistics.php: Added new header format. + + * operation/agentes/estado_grupo.php: Removed old group view. + + * operation/agentes/tactical.php: Adapted to use new realtime/batch + statistical system. Placed events above server info. Showing only pending + events and other minor changes. + + * operation/agentes/group_view.php: NEW screen, replacing old one. Probably + most ugly, but much more useful than before. + + * operation/agentes/networkmap.php: Added title. + + * operation/messages/message.php: Added title and adding some exists in + code was missing before. + + * operation/reporting/reporting_viewer.php: Added title. + + * operation/reporting/graph_viewer.php: Added title. + + * operation/reporting/custom_reporting.php: Added title. + + * operation/servers/view_server.php: + + * operation/menu.php: Replaced old group view with new (this has english + name). Removed autorefresh "by default" in server view. + + * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo. + + * extras/pandora_diag.php: Minor changes, removed some info and added other. + + * general/logon_ok.php: Minor aesthetic changes. + + * general/header.php: Fixed missing ";" + + * operation/extensions.php, + godmode/extensions.php: Added support for delete extensions. + + * godmode/menu.php: New setup items. + + * godmode/setup/setup.php, + godmode/setup/performance.php, + godmode/setup/setup_visuals.php: Reordered setup options, new setup section + "Performance", added new performance options to set "realtime" statistics + or "batchmode" with it's own interval. Some setup info is now shared with + the servers (but it it's any change in setup, servers should be restarted + anyway). + + 2010-02-19 Miguel de Dios * include/functions_gis.php: adapt to new tables. diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 7ab99bb442..0874f288c3 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -40,8 +40,9 @@ function dbmanager_query ($sql, &$error) { if (! empty ($retval)) return $retval; + //Return false, check with === or !== - return false; + return "Empty"; } @@ -50,7 +51,8 @@ function dbmgr_extension_main () { $sql = (string) get_parameter ('sql'); - echo "

".__('Extensions'). " » ".__('Database interface')."

"; + print_page_header (__('Database interface'), "", false, false, true); + echo '
'; echo "This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that you can damage your Pandora FMS installation if you don't know exactly what are you doing, this means that you can severily damage your setup using this extension. This extension is intended to be used only by experienced users with a depth knowledgue of Pandora FMS internals."; echo '
'; diff --git a/pandora_console/extensions/dbmanager/dbmanager.css b/pandora_console/extensions/dbmanager/dbmanager.css index cb3adf34c3..81472c088b 100644 --- a/pandora_console/extensions/dbmanager/dbmanager.css +++ b/pandora_console/extensions/dbmanager/dbmanager.css @@ -17,8 +17,7 @@ table.dbmanager td, table.dbmanager th { table.dbmanager th { color: #fff; - text-transform: uppercase; - font-size: 8px; + font-size: 10px; background: #888; } diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index ad449bb5d6..642159770c 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -38,8 +38,7 @@ function mainModuleGroups() { WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE) GROUP BY estado"; - echo "

".__('Extensions'). " » "; - echo __("Combined table of agent group and module group") . "

"; + print_page_header (__("Combined table of agent group and module group")); echo "

" . __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") . "

"; diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 20910fc4c2..52b2c60326 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -36,7 +36,8 @@ function view_logfile ($file_name) { function pandoralogs_extension_main () { global $config; - echo "

".__('Extensions'). " » ".__("System logfile viewer"). "

"; + print_page_header (__("System logfile viewer")); + echo "

This tool is used just to view your Pandora FMS system logfiles directly from console

"; view_logfile ($config["homedir"]."/pandora_console.log"); diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index 1d1f90cb9c..6992fb9a68 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -16,7 +16,7 @@ function pluginreg_extension_main () { global $config; - echo "

".__('Extensions'). " » ".__('Plugin registration')."

"; + print_page_header (__('Plugin registration')); echo "
"; echo __("This extension makes registration of server plugins more easy. Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz). Please refer to documentation on how to obtain and use Pandora FMS Server Plugins.

You can get more plugins in our Public Resource Library"); diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 608e8d6641..d41fe6be3c 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. function users_extension_main () { - echo "

".__('Extensions'). " » ".__("Users connected"). "

"; + print_page_header (__("Users connected")); $sql = "SELECT id_usuario, ip_origen, fecha, accion FROM tsesion WHERE descripcion = 'Logged in' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - 3600) GROUP BY id_usuario, ip_origen, accion"; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 6b00c01a2e..72fb229906 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -16,7 +16,7 @@ function render_info ($table) { global $console_mode; $info = get_db_sql ("SELECT COUNT(*) FROM $table"); - render_row ($info, $table); + render_row ($info,"DB Table $table"); } function render_info_data ($query, $label) { @@ -47,7 +47,7 @@ if (!isset($argc)) $console_mode = 0; if ($console_mode == 1) { - echo "\nPandora FMS PHP diagnostic tool v1.0 (c) Artica ST 2009 \n"; + echo "\nPandora FMS PHP diagnostic tool v3.1 (c) Artica ST 2009-2010 \n"; if ($argc == 1 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) { echo "\nThis command line script gives information about Pandora FMS database. @@ -67,7 +67,9 @@ full path to Pandora FMS 'config.php' file. } else { session_start (); - include "../include/config.php"; + if (file_exists("../include/config.php")) + include "../include/config.php"; + global $config; // Not from console, this is a web session @@ -77,17 +79,17 @@ full path to Pandora FMS 'config.php' file. exit; } - echo "

Pandora FMS Diag tool v3.0.0

"; - echo "
"; - echo ""; - echo ""; - echo ""; + echo "

Pandora FMS Diagnostic tool v$pandora_version

"; + echo "
Table/ItemData items
"; + echo ""; + echo ""; } render_row ($build_version, "Pandora FMS Build"); render_row ($pandora_version, "Pandora FMS Version"); render_row ($config["homedir"], "Homedir"); render_row ($config["homeurl"], "HomeUrl"); +render_row (phpversion(), "PHP Version"); render_info ("tagente"); render_info ("tagent_access"); @@ -98,17 +100,20 @@ render_info ("tagente_modulo"); render_info ("talert_actions"); render_info ("talert_commands"); render_info ("talert_template_modules"); -render_info ("talert_snmp"); render_info ("tevento"); render_info ("tlayout"); render_info ("tlocal_component"); -render_info ("tplanned_downtime"); -render_info ("tplugin"); -render_info ("trecon_task"); render_info ("tserver"); render_info ("treport"); render_info ("ttrap"); render_info ("tusuario"); +render_info ("tsesion"); + + +render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'", "DB Schema Version"); +render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'", "DB Schema Build"); +render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'", "Enterprise installed"); +render_row ( date ("Y/m/d H:i:s",get_db_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")), "PandoraDB Last run"); render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';", "Update Key"); render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'", "Updating code path"); diff --git a/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql index bbd4ab2fd1..63a5d24b5e 100644 --- a/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql +++ b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql @@ -10,6 +10,7 @@ ALTER TABLE `tserver` ADD `lag_time` int(11) NOT NULL default 0; ALTER TABLE `tserver` ADD `lag_modules` int(11) NOT NULL default 0; ALTER TABLE `tserver` ADD `total_modules_running` int(11) NOT NULL default 0; ALTER TABLE `tserver` ADD `my_modules` int(11) NOT NULL default 0; +ALTER TABLE `tserver` ADD `stat_utimestamp` bigint(20) NOT NULL default '0'; ALTER TABLE `tagente_modulo` ADD `custom_string_1` text default ''; ALTER TABLE `tagente_modulo` ADD `custom_string_2` text default ''; @@ -34,6 +35,9 @@ CREATE INDEX idx_template_action USING BTREE ON talert_templates(id_alert_action CREATE INDEX idx_template_module USING BTREE ON talert_template_modules(id_agent_module); CREATE INDEX idx_agentmodule USING BTREE ON tevento(id_agentmodule); +CREATE INDEX idx_utimestamp USING BTREE ON tacess(utimestamp); +CREATE INDEX idx_user USING BTREE ON tsesion (ID_usuario); + DROP INDEX `status_index_2` on tagente_estado; CREATE INDEX idx_status USING BTREE ON tagente_estado (estado); @@ -227,7 +231,7 @@ CREATE TABLE IF NOT EXISTS `tgroup_stat` ( `alerts` int(10) unsigned NOT NULL default '0', `alerts_fired` int(10) unsigned NOT NULL default '0', `agents` int(10) unsigned NOT NULL default '0', - `agents_uknown` int(10) unsigned NOT NULL default '0', + `agents_unknown` int(10) unsigned NOT NULL default '0', `utimestamp` int(20) unsigned NOT NULL default 0, PRIMARY KEY (`id_group`) ) ENGINE=InnoDB diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 706867eed5..e5184b2708 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -130,7 +130,7 @@ require_once ("include/functions_messages.php"); diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 631e6acd08..2f9a17ebf2 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -25,15 +25,12 @@ extensions_call_login_function (); require_once ("include/functions_reporting.php"); -echo '
'; -echo "

" . __('Welcome to Pandora FMS Web Console') . "

"; -echo "

"; -echo __('This is the Web Management System for Pandora FMS. From here you can manage its agents, alerts and incidents. Session is open while activity exists.'); -echo "

"; -echo '
'; +print_page_header (__('Welcome to Pandora FMS Web Console')); +// --------------------------------------------------------------------------- // Site news ! -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// --------------------------------------------------------------------------- + echo '
'; echo '

' . __('Site news') . '

'; $sql = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3"; @@ -53,7 +50,10 @@ if ($news !== false) { } echo '
'; -// Site stats + +// --------------------------------------------------------------------------- +// Site stats (global!) +// --------------------------------------------------------------------------- echo '
'; $data = get_group_stats (); @@ -136,6 +136,7 @@ echo '
".__("Item")."".__("Data value")."
lightning_go '.__('Events').'' + echo 'lightning_go '.__('Events').''; ?>
'; echo "
"; echo '
'; echo "

"; + // Show last activity from this user echo "

" . __('This is your last activity in Pandora FMS console') . "

"; @@ -154,7 +155,7 @@ $table->head[4] = __('Comments'); $sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion FROM tsesion WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800) - AND `id_usuario` = '%s' ORDER BY `fecha` DESC LIMIT 5", $config["id_user"]); + AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]); $sessions = get_db_all_rows_sql ($sql); if ($sessions === false) diff --git a/pandora_console/godmode/agentes/planned_downtime.php b/pandora_console/godmode/agentes/planned_downtime.php index 196adddfac..38ee790d66 100644 --- a/pandora_console/godmode/agentes/planned_downtime.php +++ b/pandora_console/godmode/agentes/planned_downtime.php @@ -117,8 +117,10 @@ if ($create_downtime || $update_downtime) { } } } -echo '

'.__('Agent configuration').' » '; -echo __('Planned Downtime').'

'; + +// Header +print_page_header (__("Planned Downtime"), "images/god1.png", false, "", true, ""); + // Show create / update form if (($first_create != 0) OR ($first_update != 0)){ diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 2081a51685..61cc79a00e 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -28,10 +28,24 @@ if (sizeof ($config['extensions']) == 0) { return; } -echo '

'.__('Extensions').' » '.__('Defined extensions').'

'; +// Header +print_page_header (__('Extensions'). " » ". __('Defined extensions'). " - ".$report["name"], "images/extensions.png", false, "", true, "" ); + +$delete = get_parameter ("delete", ""); +$name = get_parameter ("name", ""); + +if ($delete != ""){ + if (!file_exists($config["homedir"]."/extensions/ext_backup")) + mkdir($config["homedir"]."/extensions/ext_backup"); + $source = $config["homedir"]."/$delete.php"; + rename ($source, $config["homedir"]."/extensions/ext_backup/$name.php"); +} + + $table->width = '95%'; $table->head = array (); $table->head[0] = __('Name'); +$table->head[1] = __('Delete'); $table->data = array (); foreach ($config['extensions'] as $extension) { @@ -42,6 +56,9 @@ foreach ($config['extensions'] as $extension) { $data = array (); $data[0] = ''.$extension['godmode_menu']['name'].''; + + $data[1] = ''; + array_push ($table->data, $data); } diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index ea9bb767eb..72b0c5174c 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -170,11 +170,15 @@ if (give_acl ($config['id_user'], 0, "PM")) { if ($config['activate_gis']) $sub["godmode/setup/gis"]["text"] = __('Map conections GIS'); + $sub["godmode/setup/performance"]["text"] = __('Performance'); $sub["godmode/setup/setup_visuals"]["text"] = __('Visual styles'); $sub["godmode/setup/file_manager"]["text"] = __('File manager'); $sub["godmode/setup/links"]["text"] = __('Links'); $sub["godmode/setup/news"]["text"] = __('Site news'); enterprise_hook ('historydb_submenu'); + + + $sub["extras/pandora_diag"]["text"] = __('Diagnostic info'); $menu["gsetup"]["sub"] = $sub; } diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php new file mode 100644 index 0000000000..860030f646 --- /dev/null +++ b/pandora_console/godmode/setup/performance.php @@ -0,0 +1,97 @@ +width = '90%'; +$table->data = array (); + + +$table->data[1][0] = __('Max. days before delete events'); +$table->data[1][1] = print_input_text ('event_purge', $config["event_purge"], '', 5, 5, true); + +$table->data[2][0] = __('Max. days before delete traps'); +$table->data[2][1] = print_input_text ('trap_purge', $config["trap_purge"], '', 5, 5, true); + +$table->data[3][0] = __('Max. days before delete audit events'); +$table->data[3][1] = print_input_text ('audit_purge', $config["audit_purge"], '', 5, 5, true); + +$table->data[4][0] = __('Max. days before delete string data'); +$table->data[4][1] = print_input_text ('string_purge', $config["string_purge"], '', 5, 5, true); + +$table->data[5][0] = __('Max. days before purge'); +$table->data[5][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); + +$table->data[6][0] = __('Max. days before compact data'); +$table->data[6][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); + +$table->data[7][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); +$table->data[7][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); + +$table->data[8][0] = __('SLA period (seconds)'); +$table->data[8][1] = print_input_text ('sla_period', $config["sla_period"], '', 8, 8, true); + +$table->data[9][0] = __('Default hours for event view'); +$table->data[9][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); + +$table->data[10][0] = __('Compact CSS and JS into header'); +$table->data[10][1] = __('Yes').' '.print_radio_button ('compact_header', 1, '', $config["compact_header"], true).'  '; +$table->data[10][1] .= __('No').' '.print_radio_button ('compact_header', 0, '', $config["compact_header"], true); + +$table->data[11][0] = __('Use realtime statistics'); +$table->data[11][1] = __('Yes').' '.print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; +$table->data[11][1] .= __('No').' '.print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); + +$table->data[12][0] = __('Batch statistics period (secs)'); +$table->data[12][1] = print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true); + +$table->data[13][0] = __('Use agent access graph'). print_help_icon("agent_access", true); +$table->data[13][1] = __('Yes').' '.print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).'  '; +$table->data[13][1] .= __('No').' '.print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true); + +echo '
'; +print_input_hidden ('update_config', 1); +print_table ($table); +echo '
'; +print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"'); +echo '
'; +echo '
'; +?> + + diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 3d43ea7e11..8724864f4b 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -69,24 +69,9 @@ $table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlang $table->data[1][0] = __('Remote config directory'); $table->data[1][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); -$table->data[2][0] = __('SLA period (seconds)'); -$table->data[2][1] = print_input_text ('sla_period', $config["sla_period"], '', 8, 8, true); - -$table->data[3][0] = __('Max. days before compact data'); -$table->data[3][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); - -$table->data[4][0] = __('Max. days before purge'); -$table->data[4][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); - -$table->data[5][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); -$table->data[5][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); - $table->data[6][0] = __('Auto login (hash) password'); $table->data[6][1] = print_input_text ('loginhash_pwd', $config["loginhash_pwd"], '', 15, 15, true); -$table->data[7][0] = __('Default hours for event view'); -$table->data[7][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); - $table->data[8][0] = __('Timestamp or time comparation') . print_help_icon ("time_stamp-comparation", true); $table->data[8][1] = __('Comparation in rollover').' '; $table->data[8][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true); @@ -106,10 +91,6 @@ $table->data[11][0] = __('Enforce https'); $table->data[11][1] = __('Yes').' '.print_radio_button ('https', 1, '', $config["https"], true).'  '; $table->data[11][1] .= __('No').' '.print_radio_button ('https', 0, '', $config["https"], true); -$table->data[12][0] = __('Compact CSS and JS into header'); -$table->data[12][1] = __('Yes').' '.print_radio_button ('compact_header', 1, '', $config["compact_header"], true).'  '; -$table->data[12][1] .= __('No').' '.print_radio_button ('compact_header', 0, '', $config["compact_header"], true); - $table->data[14][0] = __('Attachment store'); $table->data[14][1] = print_input_text ('attachment_store', $config["attachment_store"], '', 50, 255, true); @@ -117,19 +98,12 @@ $table->data[14][1] = print_input_text ('attachment_store', $config["attachment_ $table->data[15][0] = __('IP list with API access') . print_help_tip (__("The list of IPs separate with carriage return."), true); $list_ACL_IPs_for_API = get_parameter('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])); -$table->data[15][1] = print_textarea('list_ACL_IPs_for_API', 10, 15, $list_ACL_IPs_for_API, null, true); +$table->data[15][1] = print_textarea('list_ACL_IPs_for_API', 5, 15, $list_ACL_IPs_for_API, null, true); $table->data[16][0] = __('Enable GIS features in Pandora Console'); $table->data[16][1] = __('Yes').' '.print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'  '; $table->data[16][1] .= __('No').' '.print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); -$table->data[17][0] = __('Use realtime statistics'); -$table->data[17][1] = __('Yes').' '.print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; -$table->data[17][1] .= __('No').' '.print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); - -$table->data[18][0] = __('Batch statistics period (secs)'); -$table->data[18][1] = print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true); - $table->data[19][0] = __('Timezone setup'); $table->data[19][1] = print_input_text ('timezone', $config["timezone"], '', 15, 15, true); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index ee0cc7d47d..ba1e68628c 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -80,9 +80,6 @@ $table->data[9][1] = print_select ($iconsets, 'status_images_set', $config["stat $table->data[10][0] = __('Font path'); $table->data[10][1] = print_input_text ('fontpath', $config["fontpath"], '', 50, 255, true); -$table->data[11][0] = __('Use agent access graph'). print_help_icon("agent_access", true); -$table->data[11][1] = __('Yes').' '.print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).'  '; -$table->data[11][1] .= __('No').' '.print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true); $table->data[12][0] = __('Flash charts'); $table->data[12][1] = __('Yes').' '.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).'  '; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2e194702ff..b0353d90c5 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -168,15 +168,14 @@ function update_config () { update_config_value ('history_db_days', (string) get_parameter ('history_db_days', $config['history_db_days'])); update_config_value ('history_db_step', (string) get_parameter ('history_db_step', $config['history_db_step'])); update_config_value ('history_db_delay', (string) get_parameter ('history_db_delay', $config['history_db_delay'])); - update_config_value ('timezone', (string) get_parameter ('timezone', $config['timezone'])); update_config_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis'])); - update_config_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval'])); - update_config_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats'])); - - + update_config_value ('event_purge', get_parameter ('event_purge', $config['event_purge'])); + update_config_value ('trap_purge', get_parameter ('trap_purge', $config['trap_purge'])); + update_config_value ('string_purge', get_parameter ('string_purge', $config['string_purge'])); + update_config_value ('audit_purge', get_parameter ('audit_purge', $config['audit_purge'])); } /** @@ -280,6 +279,23 @@ function process_config () { update_config_value ('realtimestats', 1); } + if (!isset ($config["event_purge"])){ + update_config_value ('event_purge', 15); + } + + if (!isset ($config["trap_purge"])){ + update_config_value ('trap_purge', 7); + } + + if (!isset ($config["string_purge"])){ + update_config_value ('string_purge', 14); + } + + if (!isset ($config["audit_purge"])){ + update_config_value ('audit_purge', 30); + } + + /* *Parse the ACL IP list for access API that it's save in chunks as *list_ACL_IPs_for_API_, because the value has a limit of 100 diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 0bb773cfee..48e1bf8310 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -308,11 +308,11 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return = // Colored box if ($event["estado"] == 0) { $img = "images/tick_off.png"; - $title = __('Event validate'); + $title = __('Event not validated'); } else { $img = "images/tick.png"; - $title = __('Event not validate'); + $title = __('Event validated (ACK)'); } $data[0] = print_image ($img, true, array ("class" => "image_status", diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 19aec3a0c5..652fb855d0 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -91,7 +91,7 @@ function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max */ function get_group_stats ($id_group = 0) { global $config; - + $data = array (); $data["monitor_checks"] = 0; $data["monitor_not_init"] = 0; @@ -103,17 +103,16 @@ function get_group_stats ($id_group = 0) { $data["monitor_alerts"] = 0; $data["monitor_alerts_fired"] = 0; $data["monitor_alerts_fire_count"] = 0; - $data["total_checks"] = 0; - $data["total_alerts"] = 0; $data["total_agents"] = 0; $data["total_alerts"] = 0; $data["total_checks"] = 0; + $data["agents_unknown"] = 0; $data["monitor_health"] = 100; $data["alert_level"] = 100; $data["module_sanity"] = 100; $data["server_sanity"] = 100; $cur_time = get_system_time (); - + //Check for access credentials using give_acl. More overhead, much safer if (!give_acl ($config["id_user"], $id_group, "AR")) { return $data; @@ -122,102 +121,114 @@ function get_group_stats ($id_group = 0) { if ($id_group == 0) { $id_group = array_keys (get_user_groups ()); } - - - if (isAllGroups($id_group)) { - $filter = ' 1 = 1 '; - $total_agents = get_db_value_sql('SELECT count(id_agente) FROM tagente WHERE disabled = 0'); - $alerts = get_agent_alerts (); - } - else { - $agents = array_keys (get_group_agents ($id_group)); - $total_agents = count ($agents); - - if (empty ($agents)) { - //No agents in this group, means no data - return $data; + + // ------------------------------------------------------------------- + // Server processed stats. NOT realtime (taken from tgroup_stat) + // ------------------------------------------------------------------- + if ($config["realtimestats"] == 0){ + + if (!is_array($id_group)){ + $my_group = $id_group; + $id_group = array(); + $id_group[0] = $my_group; } - $filter = 'tagente_estado.id_agente IN ('.implode (",", $agents).') '; - - $alerts = get_agent_alerts ($agents); - } - - if (empty ($alerts)) - $alerts = array (); - - $disabledQuery = "tagente_estado.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_modulo WHERE disabled = 0) AND "; - - $data["monitor_checks"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE " . $disabledQuery . $filter); - $data["monitor_not_init"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE " . $disabledQuery . $filter."AND utimestamp = 0"); - $data["monitor_unknown"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado, tagente_modulo WHERE " . $disabledQuery . $filter."AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_tipo_modulo NOT IN (21,23,23, 100) AND utimestamp > 0 AND UNIX_TIMESTAMP() - utimestamp >= current_interval * 2"); - - $data["monitor_critical"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE " . $disabledQuery . $filter."AND utimestamp > 0 AND estado = 1 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2"); - - $data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp > 0 AND estado = 2 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2"); - - $data["monitor_ok"] = $data["monitor_checks"] - $data["monitor_not_init"] - $data["monitor_unknown"] - $data["monitor_critical"] - $data["monitor_warning"]; - - $data["monitor_alerts"] = 0; - foreach ($alerts as $alert_type) { - $data["monitor_alerts"] += count ($alert_type); - foreach ($alert_type as $alert) { - if ($alert["times_fired"] > 0) { - $data["monitor_alerts_fired"]++; - $data["monitor_alerts_fire_count"] += $alert["times_fired"]; - } + foreach ($id_group as $group){ + $group_stat = get_db_all_rows_sql ("SELECT * FROM tgroup_stat, tgrupo WHERE tgrupo.id_grupo = tgroup_stat.id_group AND tgroup_stat.id_group = $group ORDER BY nombre"); + $data["monitor_checks"] += $group_stat[0]["modules"]; + $data["monitor_not_init"] += $group_stat[0]["non-init"]; + $data["monitor_unknown"] += $group_stat[0]["unknown"]; + $data["monitor_ok"] += $group_stat[0]["normal"]; + $data["monitor_warning"] += $group_stat[0]["warning"]; + $data["monitor_critical"] += $group_stat[0]["critical"]; + $data["monitor_alerts"] += $group_stat[0]["alerts"]; + $data["monitor_alerts_fired"] += $group_stat[0]["alerts_fired"]; + $data["monitor_alerts_fire_count"] += $group_stat[0]["alerts_fired"]; + $data["total_checks"] += $group_stat[0]["modules"]; + $data["total_alerts"] += $group_stat[0]["alerts"]; + $data["total_agents"] += $group_stat[0]["agents"]; + $data["agents_unknown"] += $group_stat[0]["agents_unknown"]; + $data["utimestamp"] = $group_stat[0]["utimestamp"]; } - } - - $data["total_agents"] = $total_agents; - $data["total_checks"] = $data["monitor_checks"]; - $data["total_ok"] = $data["monitor_ok"]; - //TODO: count SNMP Alerts and Inventory alerts here - $data["total_alerts"] = $data["monitor_alerts"] + $data["monitor_alerts_fired"]; - $data["total_alerts_fired"] = $data["monitor_alerts_fired"]; - $data["total_alerts_fire_count"] = $data["monitor_alerts_fire_count"]; - $data["monitor_bad"] = $data["monitor_critical"] + $data["monitor_unknown"] + $data["monitor_warning"]; - $data["total_bad"] = $data["monitor_bad"]; - $data["total_not_init"] = $data["monitor_not_init"]; - $data["total_down"] = $data["monitor_critical"]; - /* - Monitor health (percentage) - Data health (percentage) - Global health (percentage) - Module sanity (percentage) - Alert level (percentage) - - Server Sanity 0% Uninitialized modules - - */ - if ($data["monitor_bad"] > 0 && $data["monitor_checks"] > 0) { - $data["monitor_health"] = format_numeric (100 - ($data["monitor_bad"] / ($data["monitor_checks"] / 100)), 1); + // ------------------------------------------------------------------- + // Realtime stats, done by PHP Console + // ------------------------------------------------------------------- + } else { + + if (!is_array($id_group)){ + $my_group = $id_group; + $id_group = array(); + $id_group[0] = $my_group; + } + + foreach ($id_group as $group){ + + + $data["agents_unknown"] += get_db_sql ("SELECT COUNT(*) FROM tagente WHERE id_grupo = $group AND disabled = 0 AND ultimo_contacto < NOW() - (intervalo *2)"); + + $data["total_agents"] += get_db_sql ("SELECT COUNT(*) FROM tagente WHERE id_grupo = $group AND disabled = 0"); + + $data["monitor_checks"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0"); + + $data["total_not_init"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,30,100) AND tagente_estado.utimestamp = 0"); + + $data["monitor_ok"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 0"); + + $data["monitor_critical"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 1"); + + $data["monitor_warning"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND estado = 2 "); + + $data["monitor_unknown"] += get_db_sql ("SELECT COUNT(tagente_estado.id_agente_estado) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.id_grupo = $group AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,30,100) AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2))"); + + + $data["monitor_alerts"] += get_db_sql ("SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo"); + + $data["monitor_alerts_fired"] += get_db_sql ("SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo = $group AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND times_fired > 0"); + } + /* + Monitor health (percentage) + Data health (percentage) + Global health (percentage) + Module sanity (percentage) + Alert level (percentage) + + Server Sanity 0% Uninitialized modules + + */ + } + + if ($data["monitor_unknown"] > 0 && $data["monitor_checks"] > 0) { + $data["monitor_health"] = format_numeric (100 - ($data["monitor_unknown"] / ($data["monitor_checks"] / 100)), 1); } else { $data["monitor_health"] = 100; } - - if ($data["total_bad"] > 0 && $data["total_checks"] > 0) { - $data["global_health"] = format_numeric (100 - ($data["total_bad"] / ($data["total_checks"] / 100)), 1); + + if ($data["monitor_not_init"] > 0 && $data["monitor_checks"] > 0) { + $data["module_sanity"] = format_numeric (100 - ($data["monitor_not_init"] / ($data["monitor_checks"] / 100)), 1); + } else { + $data["module_sanity"] = 100; + } + + if ($data["monitor_alerts_fired"] > 0 && $data["alerts"] > 0) { + $data["alert_level"] = format_numeric (100 - ($data["monitor_alerts_fired"] / ($data["alerts"] / 100)), 1); + } else { + $data["alert_level"] = 100; + } + + $data["monitor_bad"] = $data["monitor_critical"] + $data["monitor_warning"]; + + if ($data["monitor_bad"] > 0 && $data["monitor_checks"] > 0) { + $data["global_health"] = format_numeric (100 - ($data["monitor_bad"] / ($data["monitor_checks"] / 100)), 1); } else { $data["global_health"] = 100; } - if ($data["total_not_init"] > 0 && $data["total_checks"] > 0) { - $data["module_sanity"] = format_numeric (100 - ($data["total_not_init"] / ($data["total_checks"] / 100)), 1); - } else { - $data["module_sanity"] = 100; - } - - if ($data["total_alerts_fired"] > 0 && $data["total_alerts"] > 0) { - $data["alert_level"] = format_numeric (100 - ($data["total_alerts_fired"] / ($data["total_alerts"] / 100)), 1); - } else { - $data["alert_level"] = 100; - } - $data["server_sanity"] = format_numeric (100 - $data["module_sanity"], 1); - - return $data; + + return ($data); + } @@ -279,8 +290,9 @@ function event_reporting ($id_group, $period, $date = 0, $return = false) { */ function get_fired_alerts_reporting_table ($alerts_fired) { $agents = array (); - - require_once ('include/functions_alerts.php'); + global $config; + + require_once ($config["homedir"].'/include/functions_alerts.php'); foreach (array_keys ($alerts_fired) as $id_alert) { $alert_module = get_alert_agent_module ($id_alert); diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 9f65d4574c..48ff9e247e 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -69,7 +69,11 @@ function get_server_performance () { // For remote modules: // Get total modules running - $data["total_remote_modules"] = get_db_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_modulo != 1 AND disabled = 0 AND utimestamp > 0"); + if ($config["realtimestats"] == 1){ + $data["total_remote_modules"] = get_db_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_modulo != 1 AND disabled = 0 AND utimestamp > 0"); + } else { + $data["total_remote_modules"] = get_db_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type != 0"); + } $data["avg_interval_remote_modules"] = get_db_sql ("SELECT AVG(module_interval) FROM tagente_modulo, tagente_estado where tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND disabled = 0 AND id_modulo != 1 AND module_interval > 0 AND utimestamp > 0"); @@ -79,8 +83,11 @@ function get_server_performance () { $data["remote_modules_rate"] = $data["total_remote_modules"] / $data["avg_interval_remote_modules"]; // For local modules (ignoring local modules with custom invervals for simplicity). - - $data["total_local_modules"] = get_db_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND id_modulo = 1 AND disabled = 0 AND utimestamp > 0"); + if ($config["realtimestats"] == 1){ + $data["total_local_modules"] = get_db_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND id_modulo = 1 AND disabled = 0 AND utimestamp > 0"); + } else { + $data["total_local_modules"] = get_db_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type = 0"); + } $data["avg_interval_local_modules"] = get_db_sql ("SELECT AVG(tagente.intervalo) FROM tagente WHERE disabled = 0 AND intervalo > 0"); @@ -105,6 +112,9 @@ function get_server_performance () { * @return mixed False in case the server doesn't exist or an array with info. */ function get_server_info ($id_server = -1) { + + global $config; + if (is_array ($id_server)) { $select_id = " WHERE id_server IN (".implode (",", $id_server).")"; } elseif ($id_server > 0) { @@ -113,29 +123,6 @@ function get_server_info ($id_server = -1) { $select_id = ""; } - $modules_info = array (); - $modules_total = array (); - $result = get_db_all_rows_sql ("SELECT DISTINCT(tagente_estado.running_by), - COUNT(tagente_estado.id_agente_modulo) AS modules, id_modulo - FROM tagente_estado, tagente_modulo - WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND tagente_modulo.disabled = 0 AND utimestamp > 0 - GROUP BY running_by"); - if (empty ($result)) { - $result = array (); - } - - foreach ($result as $row) { - $modules_info[$row["running_by"]] = $row["modules"]; - if (!isset ($modules_total[$row["id_modulo"]])) { - $modules_total[$row["id_modulo"]] = $row["modules"]; - } else { - $modules_total[$row["id_modulo"]] += $row["modules"]; - } - } - - $recon_total = get_db_sql ("SELECT COUNT(*) FROM trecon_task"); - $sql = "SELECT * FROM tserver".$select_id . " ORDER BY server_type"; $result = get_db_all_rows_sql ($sql); $time = get_system_time (); @@ -146,6 +133,7 @@ function get_server_info ($id_server = -1) { $return = array (); foreach ($result as $server) { + switch ($server['server_type']) { case 0: $server["img"] = print_image ("images/data.png", true, array ("title" => __('Data server'))); @@ -203,103 +191,109 @@ function get_server_info ($id_server = -1) { $id_modulo = 0; break; } - - if (empty ($modules_info[$server["id_server"]])) { - $server["modules"] = 0; - } else { - $server["modules"] = $modules_info[$server["id_server"]]; - } - $server["module_lag"] = 0; - $server["lag"] = 0; - $server["load"] = 0; - - if (!isset ($modules_total[$id_modulo])) { - $server["modules_total"] = 0; - } else { - $server["modules_total"] = $modules_total[$id_modulo]; - } - - if ($id_modulo > 0 && $server["modules"] > 0) { - //If the server doesn't have modules, it doesn't have lag so nothing to calculate. - // If it's not a module server, don't go here either - // Remote servers LAG Calculation: - if ($id_modulo != 1){ - $result = get_db_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo - WHERE utimestamp > 0 - AND tagente_modulo.disabled = 0 - AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND current_interval > 0 - AND running_by = ".$server["id_server"]." - AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) - AND (UNIX_TIMESTAMP() - utimestamp) > current_interval"); - } else { + if ($config["realtimestats"] == 0){ + // --------------------------------------------------------------- + // Take data from database if not realtime stats + // --------------------------------------------------------------- + + $server["lag"] = get_db_sql ("SELECT lag_time FROM tserver WHERE id_server = ".$server["id_server"]); + $server["modulelag"] = get_db_sql ("SELECT lag_modules FROM tserver WHERE id_server = ".$server["id_server"]); + $server["modules"] = get_db_sql ("SELECT my_modules FROM tserver WHERE id_server = ".$server["id_server"]); + $server["modules_total"] = get_db_sql ("SELECT total_modules_running FROM tserver WHERE id_server = ".$server["id_server"]); - // Local/Dataserver server LAG calculation: - $result = get_db_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo - WHERE utimestamp > 0 - AND tagente_modulo.disabled = 0 - AND tagente_modulo.id_tipo_modulo < 5 - AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND current_interval > 0 - AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) - AND running_by = ".$server["id_server"]." - AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)"); - } - - // Lag over current_interval * 2 is not lag, it's a timed out module - // And we can't check current_interval = 0 (data modules) because they come as they want - - if (!empty ($result["lag"])) { - $server["lag"] = $result["lag"]; - } - if (!empty ($result["module_lag"])) { - $server["module_lag"] = $result["module_lag"]; - } } else { - switch ($server["type"]) { - case "recon": - $server["name"] = ''.$server["name"].''; + + // --------------------------------------------------------------- + // Take data in realtime + // --------------------------------------------------------------- + + + + $server["module_lag"] = 0; + $server["lag"] = 0; + + + if ($server["server_type"] != 3) { + + // --------------------------------------------------------------- + // Data, Plugin, WMI, Network and Others + + $server["modules"] = get_db_sql ("SELECT count(tagente_estado.id_agente_modulo) FROM tagente_estado, tagente_modulo, tagente WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_estado.running_by = ".$server["id_server"]); + + $server["modules_total"] = get_db_sql ("SELECT count(tagente_estado.id_agente_modulo) FROM tserver, tagente_estado, tagente_modulo, tagente WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_estado.running_by = tserver.id_server AND tserver.server_type = ".$server["server_type"]); - //Get recon taks info - $tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]); - if (empty ($tasks)) { - $tasks = array (); + // Remote servers LAG Calculation (server_type != 0) + if ($server["server_type"] != 0){ + $result = get_db_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo + WHERE utimestamp > 0 + AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND current_interval > 0 + AND running_by = ".$server["id_server"]." + AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) + AND (UNIX_TIMESTAMP() - utimestamp) > current_interval"); + } else { + + // Local/Dataserver server LAG calculation: + $result = get_db_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo + WHERE utimestamp > 0 + AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_tipo_modulo < 5 + AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND current_interval > 0 + AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) + AND running_by = ".$server["id_server"]." + AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)"); } + + // Lag over current_interval * 2 is not lag, it's a timed out module + + if (!empty ($result["lag"])) { + $server["lag"] = $result["lag"]; + } + + if (!empty ($result["module_lag"])) { + $server["module_lag"] = $result["module_lag"]; + } + + // --------------------------------------------------------------- + // Recon server only + // --------------------------------------------------------------- + + } elseif ($server["server_type"] == 3) { + + $server["name"] = ''.$server["name"].''; + //Total jobs running on this recon server - $server["modules"] = count ($tasks); - + $server["modules"] = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE id_recon_server = ".$server["id_server"]); + //Total recon jobs (all servers) - $server["modules_total"] = $recon_total; - + $server["modules_total"] = get_db_sql ("SELECT COUNT(status) FROM trecon_task"); + //Lag (take average active time of all active tasks) $server["module_lag"] = 0; - $lags = array (); - foreach ($tasks as $task) { - if ($task["status"] > 0 && $task["status"] <= 100) { - $lags[] = $time - $task["utimestamp"]; - //Module lag is actually the number of jobs that is currently running - $server["module_lag"]++; - } - } - if (count ($lags) > 0) { - $server["lag"] = (int) array_sum ($lags) / count ($lags); - } - break; - default: - break; - } - } + + $server["lag"] = get_db_sql ("SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]); + + $server["module_lag"] = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP() > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]); + + } // recon + } // Take data for realtime mode + $server["lag_txt"] = ($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"]; + if ($server["modules_total"] > 0) { $server["load"] = round ($server["modules"] / $server["modules_total"] * 100); + } else { + $server["load"] = 0; } - + //Push the raw data on the return stack $return[$server["id_server"]] = $server; - } + } // Main foreach + return $return; } - ?> diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 05ba02d4b8..3b28b52762 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1347,4 +1347,58 @@ function get_full_url ($url = false) { return $fullurl.$url; } + + +/** + * Return a standard page header (Pandora FMS 3.1 version) + * + * @param string Title + * @param string Icon path + * @param boolean Return (false will print using a echo) + * @param boolean help (Help ID to print the Help link) + * @param boolean Godmode (false = operation mode). + * @param string Options (HTML code for make tabs or just a brief info string + * @return string Header HTML + */ + +function print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = ""){ + + if (($icon == "") && ($godmode == true)){ + $icon = "images/setup.png"; + } + + if ($godmode == true){ + $type = "nomn"; + $type2 = "menu_tab_frame"; + } + else { + $type = "view"; + $type2 = "menu_tab_frame_view"; + } + + + $buffer = '
'; + + if ($options != ""){ + $buffer .= ''; + } + + $buffer .= '



'; + + if (!$return) + echo $buffer; + + return $buffer; +} + + ?> diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index aa0906c667..925cf859c3 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -311,7 +311,7 @@ table, img { } th { color: #fff; - background-color: #3f4e2f; + background-color: #9eac8b; text-align:center; } tr.datos, tr.datost, tr.datosb , tr.datos_id, diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index efa65b352b..40c8e89130 100644 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -112,20 +112,17 @@ if ($tab != '') { } -if ($inside_main == 1 && $tab != 'alert') { +if ($inside_main == 1 || $tab == 'alert') { echo "

"; echo __('Alerts'); echo "

"; } else { - echo "

"; - echo __('Pandora agents'). " » ".__('Alerts'); - echo print_help_icon ('alert_validation', true); - echo "

"; + print_page_header (__('Alert detail'), "images/bricks.png", false, "alert_validation"); } +// Filter form echo '
'; - if ($print_agent) { $table->width = '90%'; $table->data = array (); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 643de12c6a..3b5328305d 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -70,9 +70,7 @@ if (is_ajax ()) { $group_id = get_parameter ("group_id", 0); $search = get_parameter ("search", ""); -echo "

".__('Pandora agents')." » ".__('Summary'). -print_help_icon ("agent_status", true); -echo "

"; +print_page_header ( __("Agent detail"), "images/bricks.png", false, "agent_status"); if ($group_id > 1) { echo ''; diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index e7ed73eb4d..89ba66747b 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -41,11 +41,6 @@ if (! give_acl ($config["id_user"], $agent["id_grupo"], "AR")) { require_once ("general/noaccess.php"); return; } - -echo "

".__('Pandora agents')." » ".__('Agent general information')."

"; - -// Blank space below title -echo '
 
'; //Floating div echo '
'; diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php deleted file mode 100644 index 28dd5e24c6..0000000000 --- a/pandora_console/operation/agentes/estado_grupo.php +++ /dev/null @@ -1,249 +0,0 @@ -".__('Pandora agents')." » ".__('Group view').""; - -// Update network modules for this group -// Check for Network FLAG change request -// Made it a subquery, much faster on both the database and server side -if (isset ($_GET["update_netgroup"])) { - $group = get_parameter_get ("update_netgroup", 0); - if (give_acl ($config['id_user'], $group, "AW")) { - $sql = sprintf ("UPDATE tagente_modulo SET `flag` = 1 WHERE `id_agente` = ANY(SELECT id_agente FROM tagente WHERE `id_grupo` = %d)",$group); - process_sql ($sql); - } else { - audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to set flag for groups"); - require ("general/noaccess.php"); - exit; - } -} - -// Get group list that user has access -$groups = get_user_groups ($config['id_user']); - -$groups_info = array (); -$total_agents = 0; -$now = get_system_time (); -// Prepare data to show -// For each valid group for this user, take data from agent and modules -foreach ($groups as $id_group => $group_name) { - $sql = sprintf ("SELECT COUNT(id_agente) - FROM tagente - WHERE id_grupo = %d AND disabled = 0", - $id_group); - $agents = get_db_sql ($sql); - if ($agents == 0) - continue; - - $total_agents += $agents; - $group_info = array ('agent' => $agents, - 'normal' => 0, - 'critical' => 0, - 'warning' => 0, - 'alerts' => 0, - 'down' => 0, - 'icon' => get_group_icon ($id_group), - 'id_group' => $id_group, - 'name' => $group_name); - - // SQL Join to get monitor status for agents belong this group - $sql = sprintf ("SELECT tagente_estado.estado, tagente_modulo.module_interval, - tagente_estado.utimestamp, tagente_modulo.id_tipo_modulo - FROM tagente, tagente_estado, tagente_modulo - WHERE tagente.disabled = 0 - AND tagente.id_grupo = %d - AND tagente.id_agente = tagente_estado.id_agente - AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND tagente_estado.utimestamp != 0", - $id_group); - $modules = get_db_all_rows_sql ($sql); - if ($modules === false) - $modules = array (); - foreach ($modules as $module) { - $seconds = $now - $module['utimestamp']; - if ($seconds >= ($module['module_interval'] * 2)) { - if ($module['id_tipo_modulo'] < 21) // Avoiding ASYNC and Keepalive - $group_info['down']++; - } elseif ($module['estado'] == 2) { - $group_info['warning']++; - } elseif ($module['estado'] == 1) { - $group_info['critical']++; - } else { - $group_info['normal']++; - } - } - - if ($config["show_lastalerts"] == 1) { - // How many alerts has been fired recently for this group: - // SQL Join to get alert status for agents belong this group - $sql = sprintf ("SELECT SUM(talert_template_modules.times_fired) - FROM tagente_modulo, talert_template_modules, tagente - WHERE tagente.disabled = 0 - AND tagente.id_grupo = %d - AND tagente.id_agente = tagente_modulo.id_agente - AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo", - $id_group); - $group_info["alerts"] = (int) get_db_sql ($sql); - } - array_push ($groups_info, $group_info); -} - -if ($total_agents == 0) { - echo '
'.__('There are no defined groups').'
'; - if (give_acl ($config['id_user'], 0, "LM") - || give_acl ($config['id_user'], 0, "AW") - || give_acl ($config['id_user'], 0, "PM") - || give_acl ($config['id_user'], 0, "DM") - || give_acl ($config['id_user'], 0, "UM")) { - - echo ' '; - print_submit_button (__('Create group'), 'crt', false, 'class="sub next"'); - echo ''; - } - return; -} - -$group_size = sizeof ($groups_info); -$ancho = ceil (sqrt ($group_size + 1)); -$cells_across = $ancho; -if ($ancho > 5) { //If the cells would cross the line (more than 5) - $over = $ancho - 5; //Calculate how much we are over - $cells_across -= $over; //Take what we're over off cells_across - $ancho += $over; //And add them to ancho (which holds depth) -} -$real_count = 0; - -echo ''; -for ($table = 0; $table < $ancho; $table++) { - if ($real_count >= $group_size) { - continue; - } - echo ''; - - //foreach ($groups_info as $group) { - for ($table_row = 0; $table_row < $cells_across; $table_row++) { - if ($real_count >= $group_size) { - continue; - } - $group_info = $groups_info[$real_count]; - - $group_name = $group_info["name"]; - $icono_grupo = $group_info["icon"]; - $icono_type = ""; - if ($group_info['critical'] > 0) { - $icono_type .= ''; - } - - if ($group_info["normal"] > 0) { - $icono_type .= ''; - } - - if ($group_info["warning"] > 0) { - $icono_type .= ''; - } - - // Show yellow light if there are recent alerts fired for this group - if ($group_info["alerts"] > 0 ) { - $icono_type .= ''; - } - - // Show grey light if there are agent down for this group - if ($group_info["down"] > 0 ) { - $icono_type .= ''; - } - - // Show red flag is group has disabled alert system - if (give_disabled_group ($group_info["id_group"])) { - $icono_type .= ''; - } - - // By default green border - $celda = '"; -} -echo "
'; - - // Grey border if agent down - if ($group_info["down"] > 0) - $celda = ''; - - // Yellow border if agents WARNING - if ($group_info["warning"] > 0) - $celda = ''; - - // Red border if agents CRITICAL - if ($group_info["critical"] > 0) - $celda = ''; - - // Magenta border if agents with alerts - if ($group_info["alerts"] > 0) - $celda = ''; - - // Black if alerts and down modules - if (($group_info["critical"] > 0) && ($group_info["alerts"] > 0)) - $celda = ''; - - $celda .= ''; - - // Add group icon - $celda .= ''; - - // Add float info table - $celda .= ' - - - - - - - - '; - - $celda .= ' - '; - - $celda .= ' - '; - - $celda .= "
'.__('Agents').": ".$group_info["agent"].'
'.__('Modules').'
'.__('Critical').''.format_for_graph ($group_info["critical"] , 1).'
'.__('Warning').''.format_for_graph ($group_info["warning"] , 1).'
'.__('Normal').''.format_for_graph ($group_info["normal"] , 1).'
'.__('Down').''.format_for_graph ($group_info["down"] , 1).'
'.__('Alerts').''.$group_info["alerts"].'
"; - - // Render network exec module button, only when this group is writtable by user - if (give_acl ($config['id_user'], $group_info["id_group"], "AW")) { - $celda .= ' '; - } - - $celda .= '

'.$icono_type.'

'.$group_name.''; - - echo $celda; - $real_count++; - } - echo "
"; - -?> diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 57b27ecde7..4c94e7173e 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -64,6 +64,11 @@ if (!give_acl ($config['id_user'], 0, "AR")) { require_javascript_file ('calendar'); + +// Header +print_page_header (__("Export data"), "images/bricks.png"); + + echo "

".__('Pandora agents')." » ".__('Export data')."

"; $group = get_parameter_post ('group', 1); diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php new file mode 100644 index 0000000000..139c7b9ba2 --- /dev/null +++ b/pandora_console/operation/agentes/group_view.php @@ -0,0 +1,187 @@ +'; + +echo ""; +echo "".__("Group"); +echo "".__("Agents"); +echo "".__("Agent unknown"); +echo "".__("Unknown"); +echo "".__("Not Init"); +echo "".__("Normal"); +echo "".__("Warning"); +echo "".__("Critical"); +echo "".__("Alert fired"); + +// For each valid group for this user, take data from agent and modules +foreach ($groups as $id_group => $group_name) { + if ($id_group < 2) + continue; // Skip group 0 and 1 + + // Get stats for this group + $data = get_group_stats($id_group); + + if ($data["total_agents"] == 0) + continue; // Skip empty groups + + // Calculate entire row color + if ($data["monitor_alerts_fired"] > 0){ + echo ""; + } elseif ($data["monitor_critical"] > 0) { + echo ""; + } elseif ($data["monitor_warning"] > 0) { + echo ""; + } elseif (($data["monitor_unknown"] > 0) || ($data["agents_unknown"] > 0)) { + echo ""; + } elseif ($data["monitor_ok"] > 0) { + echo ""; + } else { + echo ""; + } + + // Group name + echo ""; + echo print_group_icon ($id_group, true); + echo " "; + echo ""; + echo $group_name; + echo ""; + + if (give_acl ($config['id_user'], $group_info["id_group"], "AW")) { + echo ' '; + echo " "; + } + + + // Total agents + echo ""; + echo "  "; + if ($data["total_agents"] > 0) + echo $data["total_agents"]; + + // Agents unknown + if ($data["agents_unknown"] > 0) { + echo ""; + echo $data["agents_unknown"]; + } else { + echo ""; + } + + // Monitors Unknown + if ($data["monitor_unknown"] > 0){ + echo ""; + echo $data["monitor_unknown"]; + } else { + echo ""; + } + + + // Monitors NonInit + if ($data["monitor_non_init"] > 0){ + echo ""; + echo $data["monitor_non_init"]; + } else { + echo ""; + } + + + // Monitors OK + echo ""; + if ($data["monitor_ok"] > 0) + echo $data["monitor_ok"]; + else + echo " "; + + // Monitors Warning + if ($data["monitor_warning"] > 0){ + echo ""; + echo $data["monitor_warning"]; + } else { + echo ""; + } + + // Monitors Critical + if ($data["monitor_critical"] > 0){ + echo ""; + echo $data["monitor_critical"]; + } else { + echo ""; + } + // Alerts fired + if ($data["monitor_alerts_fired"] > 0){ + echo ""; + echo $data["monitor_alerts_fired"]; + } else { + echo ""; + } + + + echo ""; + echo " "; +} + +echo ""; + +?> + diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 7e4f10e33c..053e6c2987 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -42,7 +42,8 @@ $center = (int) get_parameter ('center', 0); /* Main code */ -echo '

'.__('Pandora agents').' » '.__('Network map').' '; +print_page_header (__('Network map')); + if ($pure == 1) { echo ''; print_image ("images/normalscreen.png", false, array ('title' => __('Normal screen'), 'alt' => __('Normal screen'))); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 0a75984cfb..3d604724a6 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -28,7 +28,8 @@ if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], return; } -echo '

'.__('Pandora agents').' » '.__('Full list of monitors').'

'; +print_page_header ("Monitor detail", "images/bricks.png", false); + $ag_freestring = get_parameter ('ag_freestring'); $ag_modulename = (string) get_parameter ('ag_modulename'); diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 4fb969c2db..0a392275c1 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -14,11 +14,11 @@ // GNU General Public License for more details. - // Load global vars require_once ("include/config.php"); require_once ("include/functions_events.php"); require_once ("include/functions_servers.php"); +require_once ("include/functions_reporting.php"); check_login (); @@ -29,7 +29,7 @@ if (! give_acl ($config['id_user'], 0, "AR")) { return; } -require_once ("include/functions_reporting.php"); + //This is an intermediary function to print out a set of cells //Cells is an array with the explanation, value, link and color @@ -45,8 +45,15 @@ function print_cells_temp ($cells) { } } +if ($config["realtimestats"] == 0){ + $updated_time = __('Last update'). " : ". print_timestamp (get_db_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); +} else { + $updated_time = __("Updated at realtime"); +} -echo "

".__('Pandora agents')." » ".__('Tactical view')."

"; + +// Header +print_page_header (__("Tactical view"), "images/bricks.png", false, "", false, $updated_time ); $data = get_group_stats (); @@ -64,23 +71,30 @@ $table->style = array (); $img = "include/fgraph.php?tipo=progress&height=20&width=140&mode=0&percent="; + $table->style[0] = "padding-top:4px; padding-bottom:4px;"; -$table->data[0][0] =''.__('Monitor health').''; +$table->data[0][0] =''.__('Global health').''; $table->style[1] = "padding-top:4px; padding-bottom:4px;"; -$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("width" => '100%', "height" => 20, "title" => $data["monitor_health"].'% '.__('of monitors up'))); +$table->data[1][0] = print_image ($img.$data["global_health"], true, array ("width" => '100%', "height" => 20, "title" => $data["global_health"].'% '.__('of monitors OK'))); $table->style[2] = "padding-top:4px; padding-bottom:4px;"; -$table->data[2][0] = ''.__('Module sanity').''; +$table->data[2][0] =''.__('Monitor health').''; $table->style[3] = "padding-top:4px; padding-bottom:4px;"; -$table->data[3][0] = print_image ($img.$data["module_sanity"], true, array ("width" => '100%', "height" => 20, "title" => $data["module_sanity"].'% '.__('of total modules inited'))); +$table->data[3][0] = print_image ($img.$data["monitor_health"], true, array ("width" => '100%', "height" => 20, "title" => $data["monitor_health"].'% '.__('of monitors up'))); $table->style[4] = "padding-top:4px; padding-bottom:4px;"; -$table->data[4][0] = ''.__('Alert level').''; +$table->data[4][0] = ''.__('Module sanity').''; $table->style[5] = "padding-top:4px; padding-bottom:4px;"; -$table->data[5][0] = print_image ($img.$data["alert_level"], true, array ("width" => '100%', "height" => 20, "title" => $data["alert_level"].'% '.__('of defined alerts not fired'))); +$table->data[5][0] = print_image ($img.$data["module_sanity"], true, array ("width" => '100%', "height" => 20, "title" => $data["module_sanity"].'% '.__('of total modules inited'))); + +$table->style[6] = "padding-top:4px; padding-bottom:4px;"; +$table->data[6][0] = ''.__('Alert level').''; + +$table->style[7] = "padding-top:4px; padding-bottom:4px;"; +$table->data[7][0] = print_image ($img.$data["alert_level"], true, array ("width" => '100%', "height" => 20, "title" => $data["alert_level"].'% '.__('of defined alerts not fired'))); print_table ($table); unset ($table); @@ -131,7 +145,12 @@ $cells[7]["color"] = "#c00"; print_cells_temp ($cells); +// -------------------------------------------------------------------------- +// Server performance +// -------------------------------------------------------------------------- + $server_performance = get_server_performance(); + echo ''.__('Server performance').''; $cells = array (); @@ -160,7 +179,6 @@ $cells[4][1] = format_numeric($server_performance ["total_modules"]); $cells[4]["color"] = "#000"; $cells[4]["href"] = ""; - print_cells_temp ($cells); echo ''.__('Summary').''; @@ -183,7 +201,17 @@ echo '

'; //Left column echo '
'; + +// -------------------------------------------------------------------------- +// Last events information +// -------------------------------------------------------------------------- + +print_events_table ("WHERE estado=0 ", 10, "100%"); + + +// -------------------------------------------------------------------------- // Server information +// -------------------------------------------------------------------------- $serverinfo = get_server_info (); $cells = array (); @@ -248,7 +276,7 @@ if (!empty ($table->data)) { } unset ($table); -print_events_table ("", 10, "100%"); + echo '
'; ?> diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index eaeaf1641e..dfb01d1c2f 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -203,7 +203,7 @@ else { $icon = 'images/bricks.png'; } echo "
"; $tab = get_parameter ("tab", "main"); diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index af4b521955..c66b700f0c 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -212,25 +212,22 @@ $url = "index.php?sec=eventos&sec2=operation/events/events&search=" . $pagination . "&group_rep=" . $group_rep . "&event_view_hr=" . $event_view_hr . "&id_user_ack=" . $id_user_ack; -echo ''; - -echo "

".__('Events')." » ".__('Main event view'). " "; -echo print_help_icon ("eventview", true); -echo " "; - -if ($config["pure"] == 1) { - echo ''; - print_image ("images/normalscreen.png", false, array ("title" => __('Normal screen'))); - echo ''; -} else { +// Header +if ($config["pure"] == 0) + print_page_header (__("Events"), "images/lightning_go.png", false, "eventview", false, ''); +else { // Fullscreen - echo ''; + echo "

".__('Events')." » ".__('Main event view'). " "; + echo print_help_icon ("eventview", true); + echo " "; + + echo ''; print_image ("images/fullscreen.png", false, array ("title" => __('Full screen'))); echo ''; + echo "

"; } -echo "

"; //Link to toggle filter echo ''.__('Event control filter').' '.print_image ("images/down.png", true, array ("title" => __('Toggle filter(s)'))).'

'; diff --git a/pandora_console/operation/extensions.php b/pandora_console/operation/extensions.php index 4db10026d8..2d332f9887 100644 --- a/pandora_console/operation/extensions.php +++ b/pandora_console/operation/extensions.php @@ -26,11 +26,26 @@ if (sizeof ($config['extensions']) == 0) { echo '

'.__('There are no extensions defined').'

'; return; } -echo "

".__('Extensions')." » "; -echo __('Defined extensions')."

"; + +// Header +print_page_header (__('Extensions'). " » ". __('Defined extensions'). " - ".$report["name"], "images/extensions.png", false, "", false, "" ); + +$delete = get_parameter ("delete", ""); +$name = get_parameter ("name", ""); + +if ($delete != ""){ + if (!file_exists($config["homedir"]."/extensions/ext_backup")) + mkdir($config["homedir"]."/extensions/ext_backup"); + $source = $config["homedir"]."/$delete.php"; + rename ($source, $config["homedir"]."/extensions/ext_backup/$name.php"); +} + $table->width = '95%'; $table->head = array (); $table->head[0] = __('Name'); +if (give_acl ($config['id_user'], 0, "PM")){ + $table->head[1] = __('Delete'); +} $table->data = array (); foreach ($config['extensions'] as $extension) { @@ -41,6 +56,11 @@ foreach ($config['extensions'] as $extension) { $data = array (); $data[0] = ''.$extension['operation_menu']['name']; + + if (give_acl ($config['id_user'], 0, "PM")) { + $data[1] = ''; + } + array_push ($table->data, $data); } diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index 7db708dd4b..327650641f 100644 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -171,9 +171,12 @@ if (empty ($result)) { $count = count ($result); } -echo '

'.__('Incident management').' » '.__('Manage incidents').'

-
- +// Header +print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, ""); + +echo ''; + +echo '

'.__('Filter').'

'; $fields = get_incidents_status (); @@ -205,11 +208,11 @@ echo '
'; print_select (get_users_info (), "usuario", $usuario, 'javascript:this.form.submit();', __('All users'), "", false, false, false, "w155"); -echo '
'; +echo '
'; print_select ($groups, "grupo", $grupo, 'javascript:this.form.submit();', '', '',false,false,false,'w155'); -echo '
'; +echo "    "; print_input_text ('texto', $texto, '', 45); echo ' '; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index a1d5ba6989..6aa35bf065 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -40,8 +40,8 @@ if (give_acl ($config['id_user'], 0, "AR")) { $sub["operation/agentes/tactical"]["text"] = __('Tactical view'); $sub["operation/agentes/tactical"]["refr"] = 60; - $sub["operation/agentes/estado_grupo"]["text"] = __('Group view'); - $sub["operation/agentes/estado_grupo"]["refr"] = 60; + $sub["operation/agentes/group_view"]["text"] = __('Group view'); + $sub["operation/agentes/group_view"]["refr"] = 60; $sub["operation/agentes/networkmap"]["text"] = __('Network map'); @@ -115,7 +115,6 @@ if (give_acl ($config['id_user'], 0, "AR")) { // Server view $menu["estado_server"]["text"] = __('Pandora servers'); $menu["estado_server"]["sec2"] = "operation/servers/view_server"; - $menu["estado_server"]["refr"] = 60; $menu["estado_server"]["id"] = "oper-servers"; //End of server view } diff --git a/pandora_console/operation/messages/message.php b/pandora_console/operation/messages/message.php index 3a78889434..3faac4dd3c 100644 --- a/pandora_console/operation/messages/message.php +++ b/pandora_console/operation/messages/message.php @@ -63,7 +63,10 @@ if (isset ($_GET["mark_read"]) || isset ($_GET["mark_unread"])) { } if (isset ($_GET["new_msg"])) { //create message - echo "

".__('Messages')." » ".__('New message').'

'; + +// Header + print_page_header (__('Messages'). " » ".__('New message'), "images/email.png", false, "", false, "" ); + echo ' @@ -94,8 +97,9 @@ if (isset ($_GET["new_msg"])) { //create message echo '
'; } elseif (isset ($_GET["read_message"])) { - echo "

".__('Messages')." » ".__('Read message').'

'; - + + print_page_header (__('Messages'). " » ".__('Read message'), "images/email.png", false, "", false, "" ); + $message_id = (int) get_parameter ("read_message"); $message = get_message ($message_id); @@ -142,11 +146,12 @@ if (isset ($_GET["new_msg"])) { //create message echo '
'; print_submit_button (__('Reply'), "reply_btn", false, 'class="sub next"'); echo '
'; + return; } if (isset ($_GET["read_message"]) || !isset ($_GET["new_msg"])) { if (empty ($config["pure"]) && !is_ajax ()) { - echo "

".__('Messages')." » ".__('Message overview').'

'; + print_page_header (__('Messages'). " » ".__('Message overview'), "images/email.png", false, "", false, "" ); } //Get number of messages diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php index ef491ffe39..af9d5594eb 100644 --- a/pandora_console/operation/reporting/custom_reporting.php +++ b/pandora_console/operation/reporting/custom_reporting.php @@ -23,8 +23,8 @@ require_once ('include/functions_reports.php'); // Load enterprise extensions enterprise_include ('operation/reporting/custom_reporting.php'); -echo "

".__('Reporting')." » "; -echo __('Custom reporting')."

"; +// Header +print_page_header (__('Reporting'). " » ".__('Custom reporting'), "images/reporting.png", false, "", false, "" ); $reports = get_reports (); diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index c2b47ff90e..0d4a302c85 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -90,8 +90,9 @@ if ($view_graph) { exit; } - echo "

".__('Reporting')." » "; - echo __('Combined image render')."

"; + // Header + print_page_header (__('Reporting'). " » ". __('Combined image render'), "images/reporting.png", false, "", false, "" ); + echo ""; echo "
"; print_custom_graph ($id, $height, $width, $period, $stacked); @@ -126,11 +127,14 @@ if ($view_graph) { echo ""; echo ""; echo "
"; - echo ""; + echo ""; + return; } } -echo "

" . __('Reporting') . " » "; -echo __('Custom graph viewer') . "

"; + +// Header +print_page_header (__('Reporting'). " » ".__('Custom graph viewer'), "images/reporting.png", false, "", false, "" ); + $graphs = get_user_custom_graphs (); if (! empty ($graphs)) { diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 4462ccc380..470d44565e 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -46,9 +46,8 @@ if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user $date = (string) get_parameter ('date', date ('Y-m-j')); $time = (string) get_parameter ('time', date ('h:iA')); -echo "

".__('Reporting')." » "; -echo __('Custom reporting')." - "; -echo $report['name']."

"; +// Header +print_page_header (__('Reporting'). " » ". __('Custom reporting'). " - ".$report["name"], "images/reporting.png", false, "", false, "" ); $table->width = '99%'; $table->class = 'databox'; diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 4b3e162c2d..aa01e423de 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -28,13 +28,10 @@ if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], return; } -$modules_server = 0; -$total_modules_network = 0; -$total_modules_data = 0; -echo "

".__('Pandora servers')." » ".__('Configuration detail')."

"; +// Header +print_page_header (__("Pandora servers"), "images/server.png"); -$total_modules = (int) get_db_value ('COUNT(*)', 'tagente_modulo', 'disabled', 0); $servers = get_server_info (); if ($servers === false) { echo "
".__('There are no servers configured into the database')."
"; diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 909af39362..5ad2b4f0a0 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -99,15 +99,16 @@ if (isset ($_POST["updatebt"])) { } } -echo "

" . __('SNMP console'); - if ($config["pure"]) { - echo ' '; + $link = ''; } else { // Fullscreen - echo ' '; + $link = ''; } -echo "

"; + +// Header +print_page_header (__("SNMP console"), "images/computer_error.png", false, "", false, $link); + $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$config['block_size']); $traps = get_db_all_rows_sql ($sql); diff --git a/pandora_console/operation/users/user.php b/pandora_console/operation/users/user.php index abf27ab69e..197ed13150 100644 --- a/pandora_console/operation/users/user.php +++ b/pandora_console/operation/users/user.php @@ -20,7 +20,8 @@ require_once ("include/config.php"); check_login (); -echo '

'.__('Pandora users').' » '.__('Users defined in Pandora').'

'; +// Header +print_page_header (__('Pandora users'), "images/group.png", false, "", false, ""); $table->cellpadding = 4; $table->cellspacing = 4; diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index f9a3b1aa54..44eca0d6f7 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -77,7 +77,8 @@ if (isset ($_GET["modified"]) && !$view_mode) { $user_info = $upd_info; } -echo "

".__('Pandora users')." » ".__('User detail editor')."

"; +// Header +print_page_header (__('User detail editor'), "images/group.png", false, "", false, ""); echo '
'; diff --git a/pandora_console/operation/users/user_statistics.php b/pandora_console/operation/users/user_statistics.php index 227fb3616d..575d13c27b 100644 --- a/pandora_console/operation/users/user_statistics.php +++ b/pandora_console/operation/users/user_statistics.php @@ -22,7 +22,7 @@ require_once ("include/fgraph.php"); check_login (); -echo "

".__('Users defined in Pandora')." » ".__('User activity statistics')."

"; +print_page_header (__('User activity statistics'), "images/group.png", false, "", false, ""); if ($config['flash_charts']) { echo graphic_user_activity (); diff --git a/pandora_console/operation/visual_console/index.php b/pandora_console/operation/visual_console/index.php index 2c99c60852..4a495623a4 100644 --- a/pandora_console/operation/visual_console/index.php +++ b/pandora_console/operation/visual_console/index.php @@ -18,7 +18,8 @@ // Login check check_login (); -echo "

".__('Visual console')." » ".__('Summary')."

"; +// Header +print_page_header (__("Visual console"), "images/monitor.png"); require_once ('include/functions_visual_map.php'); $layouts = get_user_layouts (); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index eeb4c4a664..202b0fe8d0 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -623,6 +623,7 @@ CREATE TABLE IF NOT EXISTS `tserver` ( `lag_modules` int(11) NOT NULL default 0, `total_modules_running` int(11) NOT NULL default 0, `my_modules` int(11) NOT NULL default 0, + `stat_utimestamp` bigint(20) NOT NULL default '0', PRIMARY KEY (`id_server`), KEY `name` (`name`), KEY `keepalive` (`keepalive`), @@ -650,7 +651,9 @@ CREATE TABLE IF NOT EXISTS `tsesion` ( `descripcion` varchar(200) NOT NULL default '', `fecha` datetime NOT NULL default '0000-00-00 00:00:00', `utimestamp` bigint(20) unsigned NOT NULL default '0', - PRIMARY KEY (`ID_sesion`) + PRIMARY KEY (`ID_sesion`), + KEY `idx_utimestamp` (`utimestamp`), + KEY `idx_user` (`ID_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1057,7 +1060,7 @@ CREATE TABLE IF NOT EXISTS `tgroup_stat` ( `alerts` int(10) unsigned NOT NULL default '0', `alerts_fired` int(10) unsigned NOT NULL default '0', `agents` int(10) unsigned NOT NULL default '0', - `agents_uknown` int(10) unsigned NOT NULL default '0', + `agents_unknown` int(10) unsigned NOT NULL default '0', `utimestamp` int(20) unsigned NOT NULL default 0, PRIMARY KEY (`id_group`) ) ENGINE=InnoDB