2006-03-27 05:37:27 +02:00
< ? php
2008-08-22 20:07:32 +02:00
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
2008-04-03 17:43:34 +02:00
// Please see http://pandora.sourceforge.net for full contribution list
2006-07-09 16:20:10 +02:00
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
2008-04-03 17:43:34 +02:00
// as published by the Free Software Foundation for version 2.
2006-07-09 16:20:10 +02:00
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2006-03-27 05:37:27 +02:00
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
check_login ();
2007-04-19 20:50:07 +02:00
2009-01-15 11:21:38 +01:00
require_once ( " include/functions_agents.php " );
2009-01-05 19:41:14 +01:00
$filter = get_parameter_get ( " filter " , " all " );
$offset = ( int ) get_parameter_get ( " offset " , 0 );
$id_group = ( int ) get_parameter ( " ag_group " , 1 ); //1 is the All group (selects all groups)
2007-04-19 20:50:07 +02:00
2009-01-05 19:41:14 +01:00
$sec2 = get_parameter_get ( 'sec2' );
$sec2 = safe_url_extraclean ( $sec2 );
$sec = get_parameter_get ( 'sec' );
$sec = safe_url_extraclean ( $sec );
$url = 'index.php?sec=' . $sec . '&sec2=' . $sec2 . '&refr=' . $config [ " refr " ] . '&filter=' . $filter . '&ag_group=' . $id_group ;
2007-10-03 14:41:29 +02:00
2009-01-15 11:21:38 +01:00
// Force alert execution
$flag_alert = ( bool ) get_parameter ( 'force_execution' );
if ( $flag_alert == 1 && give_acl ( $config [ 'id_user' ], $id_grupo , " AW " )) {
require_once ( " include/functions_alerts.php " );
$id_alert = ( int ) get_parameter ( 'id_alert' );
set_alerts_agent_module_force_execution ( $id_alert );
}
2007-05-28 21:15:44 +02:00
2009-01-05 19:41:14 +01:00
// Show alerts for specific agent
if ( isset ( $_GET [ " id_agente " ])) {
$id_agent = ( int ) get_parameter_get ( " id_agente " , 0 );
$url = $url . '&id_agente=' . $id_agent ;
$id_group = get_group_agents ( $id_agent );
if ( give_acl ( $config [ " id_user " ], $id_group , " AR " ) == 0 ) {
audit_db ( $config [ " id_user " ], $config [ " remote_addr " ], " ACL Violation " , " Trying to access alert view " );
require ( " general/noaccess.php " );
exit ;
2007-05-28 21:15:44 +02:00
}
2007-10-03 14:41:29 +02:00
2009-01-05 19:41:14 +01:00
$alerts_simple = get_agent_alerts_simple ( $id_agent , $filter );
2009-02-11 17:55:04 +01:00
$alerts_combined = get_agent_alerts_compound ( $id_agent , $filter );
2009-01-15 11:21:38 +01:00
$print_agent = false ;
2009-01-05 19:41:14 +01:00
} else {
2009-02-11 17:55:04 +01:00
if ( ! give_acl ( $config [ " id_user " ], $id_group , " AR " )) {
2009-01-05 19:41:14 +01:00
audit_db ( $config [ " id_user " ], $config [ " remote_addr " ], " ACL Violation " , " Trying to access alert view " );
require ( " general/noaccess.php " );
2009-02-11 17:55:04 +01:00
return ;
2009-01-05 19:41:14 +01:00
}
2007-05-28 21:15:44 +02:00
2009-01-05 19:41:14 +01:00
$alerts_simple = array ();
$alerts_combined = array ();
2007-05-28 21:15:44 +02:00
2009-01-05 19:41:14 +01:00
$agents = array_keys ( get_group_agents ( $id_group ));
2008-09-16 20:16:09 +02:00
2009-01-05 19:41:14 +01:00
foreach ( $agents as $id_agent ) {
$simple = get_agent_alerts_simple ( $id_agent , $filter );
2009-02-11 17:55:04 +01:00
$combined = get_agent_alerts_compound ( $id_agent , $filter );
2009-01-05 19:41:14 +01:00
$alerts_simple = array_merge ( $alerts_simple , $simple );
$alerts_combined = array_merge ( $alerts_combined , $combined );
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2008-09-16 20:16:09 +02:00
2009-01-15 11:21:38 +01:00
$print_agent = true ;
2009-01-05 19:41:14 +01:00
}
2007-04-19 20:50:07 +02:00
2009-01-05 19:41:14 +01:00
$tab = get_parameter_get ( " tab " );
if ( $tab != '' ) {
$url = $url . '&tab=' . $tab ;
}
2007-04-19 20:50:07 +02:00
2009-01-16 13:37:47 +01:00
echo " <h2> " . __ ( 'Pandora Agents' ) . " > " . __ ( 'Alerts' ) . '</h2>' ;
2009-01-15 11:21:38 +01:00
if ( get_parameter ( 'alert_validate' )) {
2009-01-15 12:52:49 +01:00
$ids = ( array ) get_parameter_post ( " validate " , array ());
2009-02-11 17:55:04 +01:00
$compound_ids = ( array ) get_parameter_post ( " validate_compound " , array ());
if ( ! empty ( $ids ) || ! empty ( $compound_ids )) {
2009-01-15 12:52:49 +01:00
require_once ( " include/functions_alerts.php " );
2009-02-11 17:55:04 +01:00
$result1 = validate_alert_agent_module ( $ids );
$result2 = validate_alert_compound ( $compound_ids );
$result == $result1 || $result2 ;
2009-01-16 11:55:29 +01:00
2009-01-15 12:52:49 +01:00
print_error_message ( $result , __ ( 'Alert(s) validated' ),
__ ( 'Error processing alert(s)' ));
}
2009-01-05 19:41:14 +01:00
}
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
2009-01-15 11:21:38 +01:00
echo '<form method="post" action="' . $url . '">' ;
2007-06-12 13:57:03 +02:00
2009-01-15 11:21:38 +01:00
if ( $print_agent ) {
$table -> width = '90%' ;
$table -> data = array ();
$table -> style = array ();
2009-01-05 19:41:14 +01:00
2009-01-15 11:21:38 +01:00
$table -> data [ 0 ][ 0 ] = __ ( 'Group' );
$table -> data [ 0 ][ 1 ] = print_select ( get_user_groups (), " ag_group " , $id_group ,
'javascript:this.form.submit();' , '' , '' , true );
2009-01-05 19:41:14 +01:00
2009-01-15 11:21:38 +01:00
$table -> data [ 0 ][ 2 ] = '<a href="' . $url . '&filter=fired"><img src="images/pixel_red.png" width="18" height="18" title="' . __ ( 'Click to filter' ) . '">' . __ ( 'Alert fired' ) . '</a>' ;
$table -> data [ 0 ][ 3 ] = '<a href="' . $url . '&filter=notfired"><img src="images/pixel_green.png" width="18" height="18" title="' . __ ( 'Click to filter' ) . '">' . __ ( 'Alert not fired' ) . '</a>' ;
$table -> data [ 0 ][ 4 ] = '<a href="' . $url . '&filter=disabled"><img src="images/pixel_gray.png" width="18" height="18" title="' . __ ( 'Click to filter' ) . '">' . __ ( 'Alert disabled' ) . '</a>' ;
2008-09-16 20:16:09 +02:00
2009-01-15 11:21:38 +01:00
switch ( $filter ) {
case 'fired' :
$table -> style [ 2 ] = 'font-weight: bold' ;
break ;
case 'notfired' :
$table -> style [ 3 ] = 'font-weight: bold' ;
break ;
case 'disabled' :
$table -> style [ 4 ] = 'font-weight: bold' ;
break ;
}
print_table ( $table );
2009-01-05 19:41:14 +01:00
}
2009-01-15 11:21:38 +01:00
$table -> width = '90%' ;
2009-01-05 19:41:14 +01:00
$table -> class = " databox " ;
$table -> head = array ();
2009-01-08 12:53:14 +01:00
$table -> head [ 0 ] = '' ;
2009-01-15 11:21:38 +01:00
$table -> head [ 1 ] = '' ; //Placeholder for name
$table -> head [ 2 ] = __ ( 'Template' );
$table -> head [ 3 ] = __ ( 'Last fired' );
$table -> head [ 4 ] = __ ( 'Status' );
$table -> head [ 5 ] = __ ( 'Validate' ) . pandora_help ( 'alert_validation' , true );
2009-01-05 19:41:14 +01:00
$table -> title = __ ( 'Single alerts' );
2009-01-15 11:21:38 +01:00
2009-01-05 19:41:14 +01:00
if ( $print_agent == 0 ) {
2009-01-15 11:21:38 +01:00
$table -> head [ 1 ] = __ ( 'Module' );
2009-01-05 19:41:14 +01:00
} else {
2009-01-15 11:21:38 +01:00
$table -> head [ 1 ] = __ ( 'Agent' );
2009-01-05 19:41:14 +01:00
}
2009-01-15 11:21:38 +01:00
$table -> align = array ();
$table -> align [ 4 ] = 'center' ;
$table -> align [ 5 ] = 'center' ;
2009-01-05 19:41:14 +01:00
$table -> data = array ();
2009-01-15 11:21:38 +01:00
$total = 0 ;
$printed = 0 ;
2009-01-05 19:41:14 +01:00
foreach ( $alerts_simple as $alert ) {
2009-01-15 11:21:38 +01:00
$total ++ ;
if ( empty ( $alert ) || $printed >= $config [ " block_size " ] || $total <= $offset ) {
2009-01-05 19:41:14 +01:00
continue ;
2008-09-16 20:16:09 +02:00
}
2009-01-15 11:21:38 +01:00
$printed ++ ;
2009-02-11 17:55:04 +01:00
array_push ( $table -> data , format_alert_row ( $alert , false , $print_agent , $url ));
2009-01-05 19:41:14 +01:00
}
if ( ! empty ( $table -> data )) {
2009-01-15 11:21:38 +01:00
pagination ( $total , $url , $offset );
2009-01-05 19:41:14 +01:00
print_table ( $table );
} else {
echo '<div class="nf">' . __ ( 'No simple alerts found' ) . '</div>' ;
}
2009-02-11 17:55:04 +01:00
$table -> title = __ ( 'Compound alerts' );
2009-01-15 11:21:38 +01:00
$table -> head [ 1 ] = __ ( 'Agent' );
2009-02-11 17:55:04 +01:00
$table -> head [ 2 ] = __ ( 'Name' );
2009-01-05 19:41:14 +01:00
$table -> data = array ();
2009-01-15 11:21:38 +01:00
$combined_total = 0 ;
$combined_printed = 0 ;
2009-01-05 19:41:14 +01:00
foreach ( $alerts_combined as $alert ) {
2009-01-15 11:21:38 +01:00
$combined_total ++ ;
if ( empty ( $alert ) || $combined_printed >= $config [ " block_size " ] || $combined_total <= $offset ) {
2009-01-05 19:41:14 +01:00
continue ;
2008-02-21 16:16:54 +01:00
}
2009-01-15 11:21:38 +01:00
$combined_printed ++ ;
2009-02-11 17:55:04 +01:00
array_push ( $table -> data , format_alert_row ( $alert , true , $print_agent ));
2009-01-05 19:41:14 +01:00
}
if ( ! empty ( $table -> data )) {
2009-01-15 11:21:38 +01:00
pagination ( $total , $url , $offset );
2009-01-05 19:41:14 +01:00
print_table ( $table );
}
2009-01-15 11:21:38 +01:00
if ( $printed > 0 || $combined_total > 0 ) {
echo '<div class="action-buttons" style="width: ' . $table -> width . ';">' ;
2009-01-05 19:41:14 +01:00
print_submit_button ( __ ( 'Validate' ), 'alert_validate' , false , 'class="sub upd"' , false );
echo '</div>' ;
}
2009-01-15 11:21:38 +01:00
2009-01-05 19:41:14 +01:00
echo '</form>' ;
2007-05-21 15:24:17 +02:00
?>
2009-01-15 11:21:38 +01:00
< link rel = " stylesheet " href = " include/styles/cluetip.css " type = " text/css " />
< script type = " text/javascript " src = " include/javascript/jquery.cluetip.js " ></ script >
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
$ ( " a.template_details " ) . cluetip ({
arrows : true ,
attribute : 'href' ,
2009-02-11 17:55:04 +01:00
cluetipClass : 'default'
2009-01-15 11:21:38 +01:00
}) . click ( function () {
return false ;
});
});
</ script >