2010-08-09 11:14:46 +02:00
< ? php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// 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.
function mainAgentsModules () {
global $config ;
// Load global vars
require_once ( " include/config.php " );
require_once ( " include/functions_reporting.php " );
check_login ();
// ACL Check
if ( ! give_acl ( $config [ 'id_user' ], 0 , " AR " )) {
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/admin_access_logs.php: added hooks to enterprise code, and added
new filter with more options.
* include/functions_db.php: erase the deprecated function "audit_db", and
added in function "pandora_audit" two new parameters $user_id, $ip for
pass this values when it are differents to the default values. Finally
replaced the depecrated "audit_db" for "pandora_audit".
* include/functions_events.php, include/functions_filemanager.php,
include/ajax/reporting.ajax.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/alert_list.ajax.php, include/help/es/modu_group_list.php,
include/functions_incidents.php, index.php, extensions/agents_modules.php,
extensions/insert_data.php, extensions/system_info.php,
extensions/dbmanager.php, extensions/update_manager/settings.php,
extensions/pandora_logs.php, extensions/plugin_registration.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/incidents/incident_statistics.php, operation/extensions.php,
operation/visual_console/render_view.php,
operation/agentes/status_monitor.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php, operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/custom_fields.php, operation/agentes/estado_agente.php,
operation/agentes/networkmap.topology.php,
operation/agentes/networkmap.groups.php, operation/agentes/sla_view.php,
operation/agentes/gis_view.php, operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/graphs.php,
operation/agentes/agent_fields.php, operation/agentes/tactical.php,
operation/agentes/group_view.php, operation/agentes/networkmap.php,
operation/servers/view_server.php,operation/servers/view_server_detail.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/render_view.php, operation/events/event_statistics.php,
operation/events/sound_events.php, operation/events/events_validate.php,
operation/events/events_list.php, operation/events/events_marquee.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
mobile/operation/agents/view_agents.php, mobile/index.php,
godmode/groups/modu_group_list.php, godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php, godmode/groups/group_list.php,
godmode/extensions.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/agentes/fields_manager.php, godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php,
godmode/agentes/configure_field.php, godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_export.php, godmode/servers/recon_script.php,
godmode/servers/manage_export_form.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_commands.php, godmode/snmpconsole/snmp_alert.php,
godmode/snmpconsole/snmp_filters.php, godmode/setup/file_manager.php,
godmode/setup/os.list.php, godmode/setup/news.php,
godmode/setup/gis_step_2.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/setup/os.php,
godmode/setup/performance.php, godmode/setup/setup_auth.php,
godmode/setup/gis.php, godmode/setup/os.builder.php,
godmode/setup/setup_visuals.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/users/configure_profile.php,
godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_delete_agents.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.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_components_form_common.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_templates_form.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.list_items.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/map_builder_wizard.php,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/graph_builder.php,
godmode/reporting/visual_console_builder.preview.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/graphs.php, godmode/reporting/graph_builder.preview.php:
Replaced the depecrated "audit_db" for "pandora_audit".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-10-27 12:47:07 +02:00
pandora_audit ( " ACL Violation " ,
2010-08-09 11:14:46 +02:00
" Trying to access Agent view (Grouped) " );
require ( " general/noaccess.php " );
exit ;
}
// 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 );
2010-12-23 15:10:41 +01:00
}
else {
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/admin_access_logs.php: added hooks to enterprise code, and added
new filter with more options.
* include/functions_db.php: erase the deprecated function "audit_db", and
added in function "pandora_audit" two new parameters $user_id, $ip for
pass this values when it are differents to the default values. Finally
replaced the depecrated "audit_db" for "pandora_audit".
* include/functions_events.php, include/functions_filemanager.php,
include/ajax/reporting.ajax.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/alert_list.ajax.php, include/help/es/modu_group_list.php,
include/functions_incidents.php, index.php, extensions/agents_modules.php,
extensions/insert_data.php, extensions/system_info.php,
extensions/dbmanager.php, extensions/update_manager/settings.php,
extensions/pandora_logs.php, extensions/plugin_registration.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/incidents/incident_statistics.php, operation/extensions.php,
operation/visual_console/render_view.php,
operation/agentes/status_monitor.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php, operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/custom_fields.php, operation/agentes/estado_agente.php,
operation/agentes/networkmap.topology.php,
operation/agentes/networkmap.groups.php, operation/agentes/sla_view.php,
operation/agentes/gis_view.php, operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/graphs.php,
operation/agentes/agent_fields.php, operation/agentes/tactical.php,
operation/agentes/group_view.php, operation/agentes/networkmap.php,
operation/servers/view_server.php,operation/servers/view_server_detail.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/render_view.php, operation/events/event_statistics.php,
operation/events/sound_events.php, operation/events/events_validate.php,
operation/events/events_list.php, operation/events/events_marquee.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
mobile/operation/agents/view_agents.php, mobile/index.php,
godmode/groups/modu_group_list.php, godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php, godmode/groups/group_list.php,
godmode/extensions.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/agentes/fields_manager.php, godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php,
godmode/agentes/configure_field.php, godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_export.php, godmode/servers/recon_script.php,
godmode/servers/manage_export_form.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_commands.php, godmode/snmpconsole/snmp_alert.php,
godmode/snmpconsole/snmp_filters.php, godmode/setup/file_manager.php,
godmode/setup/os.list.php, godmode/setup/news.php,
godmode/setup/gis_step_2.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/setup/os.php,
godmode/setup/performance.php, godmode/setup/setup_auth.php,
godmode/setup/gis.php, godmode/setup/os.builder.php,
godmode/setup/setup_visuals.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/users/configure_profile.php,
godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_delete_agents.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.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_components_form_common.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_templates_form.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.list_items.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/map_builder_wizard.php,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/graph_builder.php,
godmode/reporting/visual_console_builder.preview.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/graphs.php, godmode/reporting/graph_builder.preview.php:
Replaced the depecrated "audit_db" for "pandora_audit".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-10-27 12:47:07 +02:00
pandora_audit ( " ACL Violation " , " Trying to set flag for groups " );
2010-08-09 11:14:46 +02:00
require ( " general/noaccess.php " );
exit ;
}
}
2010-12-23 15:10:41 +01:00
if ( $config [ " realtimestats " ] == 0 ) {
2010-08-24 17:40:19 +02:00
$updated_info = __ ( 'Last update' ) . " : " . print_timestamp ( get_db_sql ( " SELECT min(utimestamp) FROM tgroup_stat " ), true );
2010-12-23 15:10:41 +01:00
}
else {
2010-08-24 17:40:19 +02:00
$updated_info = __ ( " Updated at realtime " );
2010-08-09 11:14:46 +02:00
}
2010-08-17 12:44:59 +02:00
2010-08-24 17:40:19 +02:00
$updated_time = print_image ( " images/information.png " , true , array ( " title " => $updated_info , " style " => 'margin: 5px 3px 0px 10px' )) . $updated_info ;
$modulegroup = get_parameter ( 'modulegroup' , 0 );
$refr = get_parameter ( 'refr' , 30 ); // By default 30 seconds
2010-08-17 12:44:59 +02:00
$group_id = get_parameter ( 'group_id' , 0 );
2010-08-09 11:14:46 +02:00
$offset = get_parameter ( 'offset' , 0 );
$hor_offset = get_parameter ( 'hor_offset' , 0 );
2010-08-12 17:29:28 +02:00
$block = 20 ;
2010-08-09 11:14:46 +02:00
2010-08-24 17:40:19 +02:00
$groups = get_user_groups ();
$filter_module_groups = '<form method="post" action="' . get_url_refresh ( array ( 'offset' => 0 , 'hor_offset' => 0 )) . '">' ;
$filter_module_groups .= '<b>' . __ ( 'Module group' ) . '</b>' ;
$filter_module_groups .= print_select_from_sql ( " SELECT * FROM tmodule_group ORDER BY name " ,
'modulegroup' , $modulegroup , 'this.form.submit()' , __ ( 'All' ), 0 , true , false , true , false , 'width: 100px; margin-right: 10px; margin-top: 5px;' );
$filter_module_groups .= '</form>' ;
$filter_groups = '<form method="post" action="' . get_url_refresh ( array ( 'offset' => 0 , 'hor_offset' => 0 )) . '">' ;
$filter_groups .= '<b>' . __ ( 'Group' ) . '</b>' ;
$filter_groups .= print_select_groups ( false , " AR " , true , 'group_id' , $group_id , 'this.form.submit()' , '' , '' , true , false , true , '' , false , 'width: 100px; margin-right: 10px;; margin-top: 5px;' );
$filter_groups .= '</form>' ;
$comborefr = '<form method="post" action="' . get_url_refresh ( array ( 'offset' => 0 , 'hor_offset' => 0 )) . '">' ;
$comborefr .= '<b>' . __ ( 'Refresh' ) . '</b>' ;
$comborefr .= print_select ( array ( '30' => '30 ' . __ ( 'seconds' ), '60' => '1 ' . __ ( 'minute' ), '120' => '2 ' . __ ( 'minutes' ), '300' => '5 ' . __ ( 'minutes' ), '600' => '10 ' . __ ( 'minutes' )) , 'refr' , $config [ 'refr' ], $script = 'this.form.submit()' , '' , 0 , true , false , false , '' , false , 'width: 100px; margin-right: 10px; margin-top: 5px;' );
$comborefr .= " </form> " ;
if ( $config [ " pure " ] == 0 ) {
2010-11-11 Raúl Mateos <raulofpandora@gmail.com>
* general/error_install.php, general/error_perms.php, general/header.php,
general/logon_menu.php, general/logon_ok.php, include/functions_menu.php,
include/functions_ui.php, extensions/agents_modules.php,
operation/menu.php, godmode/menu.php, operation/estado_agente.php,
operation/agentes/estado_agente.php, operation/agentes/status_monitor.php,
operation/agentes/estado_monitores.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php, pandoradb_data.sql: Closed
some HTML tags, autoclose others, added alt to images, and changed some
& to "&" to help validation for XHTML 1.0 Transitional. Tested and
not error found, but needs more tests...
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3572 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-11-11 12:16:09 +01:00
$fullscreen = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&pure=1&offset=' . $offset . '&group_id=' . $group_id . '&modulegroup=' . $modulegroup . '">'
2010-08-24 17:40:19 +02:00
. print_image ( " images/fullscreen.png " , true , array ( " title " => __ ( 'Full screen mode' )))
. " </a> " ;
2010-12-23 15:10:41 +01:00
}
else {
2010-11-11 Raúl Mateos <raulofpandora@gmail.com>
* general/error_install.php, general/error_perms.php, general/header.php,
general/logon_menu.php, general/logon_ok.php, include/functions_menu.php,
include/functions_ui.php, extensions/agents_modules.php,
operation/menu.php, godmode/menu.php, operation/estado_agente.php,
operation/agentes/estado_agente.php, operation/agentes/status_monitor.php,
operation/agentes/estado_monitores.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php, pandoradb_data.sql: Closed
some HTML tags, autoclose others, added alt to images, and changed some
& to "&" to help validation for XHTML 1.0 Transitional. Tested and
not error found, but needs more tests...
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3572 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-11-11 12:16:09 +01:00
$fullscreen = '<a href="index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&refr=0&offset=' . $offset . '&group_id=' . $group_id . '&modulegroup=' . $modulegroup . '">'
2010-08-24 17:40:19 +02:00
. print_image ( " images/normalscreen.png " , true , array ( " title " => __ ( 'Back to normal mode' )))
. " </a> " ;
$config [ 'refr' ] = $refr ;
}
$onheader = array ( 'updated_time' => $updated_time , 'fullscreen' => $fullscreen ,
'combo_module_groups' => $filter_module_groups ,
'combo_groups' => $filter_groups );
if ( $config [ 'pure' ] == 1 ) {
$onheader [ 'combo_refr' ] = $comborefr ;
}
2010-08-09 11:14:46 +02:00
// Header
2010-08-24 17:40:19 +02:00
print_page_header ( __ ( " Agents/Modules " ), " images/bricks.png " , false , " " , false , $onheader );
2010-08-09 11:14:46 +02:00
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
2010-08-17 12:44:59 +02:00
$agents = '' ;
if ( $group_id > 0 ) {
$agents = get_group_agents ( $group_id );
$agents = array_keys ( $agents );
}
2010-08-24 17:40:19 +02:00
$filter_module_groups = false ;
2010-08-17 12:44:59 +02:00
2010-08-24 17:40:19 +02:00
if ( $modulegroup > 0 ) {
$filter_module_groups [ 'id_module_group' ] = $modulegroup ;
}
$all_modules = get_agent_modules ( $agents , false , $filter_module_groups , true , false );
2010-08-09 11:14:46 +02:00
$modules_by_name = array ();
$name = '' ;
$cont = 0 ;
foreach ( $all_modules as $key => $module ) {
2010-12-23 15:10:41 +01:00
if ( $module == $name ) {
2010-08-09 11:14:46 +02:00
$modules_by_name [ $cont - 1 ][ 'id' ][] = $key ;
}
2010-12-23 15:10:41 +01:00
else {
2010-08-09 11:14:46 +02:00
$name = $module ;
$modules_by_name [ $cont ][ 'name' ] = $name ;
$modules_by_name [ $cont ][ 'id' ][] = $key ;
$cont ++ ;
}
}
2010-08-24 17:40:19 +02:00
if ( $config [ " pure " ] == 1 ) {
$block = count ( $modules_by_name );
}
2010-08-09 11:14:46 +02:00
2010-08-17 12:44:59 +02:00
$filter_groups = array ( 'offset' => ( int ) $offset ,
'limit' => ( int ) $config [ 'block_size' ]);
if ( $group_id > 0 ) {
$filter_groups [ 'id_grupo' ] = $group_id ;
}
2010-08-24 17:40:19 +02:00
2010-08-17 12:44:59 +02:00
$agents = get_agents ( $filter_groups );
$nagents = count ( $agents );
2010-08-24 17:40:19 +02:00
if ( $all_modules == false || $agents == false ) {
2010-08-17 12:44:59 +02:00
echo " <div class='nf'> " . __ ( 'There are no agents with modules' ) . " </div> " ;
return ;
}
2010-08-12 17:29:28 +02:00
echo '<table cellpadding="1" cellspacing="4" cellspacing="0" border="0" style="background-color: #EEE;">' ;
2010-08-09 11:14:46 +02:00
2010-08-17 19:58:39 +02:00
echo " <th width='140px' style='background-color: #799E48;'> " . __ ( " Agents " ) . " / " . __ ( " Modules " ) . " </th> " ;
2010-08-12 17:29:28 +02:00
2010-08-09 11:14:46 +02:00
if ( $hor_offset > 0 ) {
$new_hor_offset = $hor_offset - $block ;
2010-08-24 17:40:19 +02:00
echo " <th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan=' " . ( $nagents + 1 ) . " '><a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset= " . $new_hor_offset . " &offset= " . $offset . " &group_id= " . $group_id . " &modulegroup= " . $modulegroup . " '> " . print_image ( " images/darrowleft.png " , true , array ( 'title' => __ ( 'Previous modules' ))) . " </a> </th> " ;
2010-08-09 11:14:46 +02:00
}
2010-08-12 17:29:28 +02:00
$nmodules = 0 ;
2010-08-09 11:14:46 +02:00
foreach ( $modules_by_name as $module ) {
$nmodules ++ ;
if ( $nmodules <= $hor_offset || $nmodules > ( $hor_offset + $block )) {
continue ;
}
2010-08-24 17:40:19 +02:00
2010-08-17 12:44:59 +02:00
$file_name = string2image ( printTruncateText ( $module [ 'name' ], 15 , false , true , false , '...' ), 115 , 13 , 3 , 270 , '#9EAC8B' , 'FFF' , 4 , 0 );
2010-08-24 17:40:19 +02:00
echo '<th width="22px">' . print_image ( $file_name , true , array ( 'title' => $module [ 'name' ])) . " </th> " ;
2010-08-09 11:14:46 +02:00
}
2010-08-12 17:29:28 +02:00
2010-08-09 11:14:46 +02:00
if (( $hor_offset + $block ) < $nmodules ) {
$new_hor_offset = $hor_offset + $block ;
2010-08-24 17:40:19 +02:00
echo " <th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan=' " . ( $nagents + 1 ) . " '><a href='index.php?sec=extensions&sec2=extensions/agents_modules&hor_offset= " . $new_hor_offset . " &offset= " . $offset . " &group_id= " . $group_id . " &modulegroup= " . $modulegroup . " '> " . print_image ( " images/darrowright.png " , true , array ( 'title' => __ ( 'More modules' ))) . " </a> </th> " ;
2010-08-09 11:14:46 +02:00
}
2010-08-17 12:44:59 +02:00
$filter_agents = false ;
if ( $group_id > 0 ) {
$filter_agents = array ( 'id_grupo' => $group_id );
}
2010-08-09 11:14:46 +02:00
// Prepare pagination
2010-08-17 12:44:59 +02:00
pagination (( int ) count ( get_agents ( $filter_agents )));
2010-08-09 11:14:46 +02:00
echo " <br> " ;
foreach ( $agents as $agent ) {
// Get stats for this group
2010-08-12 18:07:03 +02:00
$agent_status = get_agent_status ( $agent [ 'id_agente' ]);
switch ( $agent_status ) {
case 4 : // Alert fired status
$rowcolor = '#ffa300' ;
$textcolor = '#000' ;
break ;
case 1 : // Critical status
$rowcolor = '#bc0000' ;
$textcolor = '#FFF' ;
break ;
case 2 : // Warning status
$rowcolor = '#f2ef00' ;
$textcolor = '#000' ;
break ;
case 0 : // Normal status
$rowcolor = '#8ae234' ;
$textcolor = '#000' ;
break ;
case 3 :
case - 1 :
default : // Unknown status
$rowcolor = '#babdb6' ;
$textcolor = '#000' ;
break ;
2010-08-09 11:14:46 +02:00
}
2010-08-12 17:29:28 +02:00
echo " <tr style='height: 35px;'> " ;
2010-08-09 11:14:46 +02:00
2011-01-14 13:33:31 +01:00
$file_name = string2image ( printTruncateText ( $agent [ 'nombre' ], 19 , false , true , false , '...' ), 140 , 15 , 3 , 0 , $rowcolor , $textcolor , 4 , 0 );
2010-08-24 17:40:19 +02:00
echo " <td style='background-color: " . $rowcolor . " ;'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente= " . $agent [ 'id_agente' ] . " '> " . print_image ( $file_name , true , array ( 'title' => $agent [ 'nombre' ])) . " </a></td> " ;
2010-08-09 11:14:46 +02:00
$agent_modules = get_agent_modules ( $agent [ 'id_agente' ]);
$nmodules = 0 ;
foreach ( $modules_by_name as $module ) {
$nmodules ++ ;
if ( $nmodules <= $hor_offset || $nmodules > ( $hor_offset + $block )) {
continue ;
}
$match = false ;
foreach ( $module [ 'id' ] as $module_id ){
if ( ! $match && array_key_exists ( $module_id , $agent_modules )) {
$status = get_agentmodule_status ( $module_id );
2010-08-12 17:29:28 +02:00
echo " <td style='text-align: center; background-color: #DDD;'> " ;
2010-08-24 17:40:19 +02:00
$win_handle = dechex ( crc32 ( $module_id . $module [ " name " ]));
$graph_type = return_graphtype ( get_agentmodule_type ( $module_id ));
$link = " winopeng('operation/agentes/stat_win.php?type= $graph_type &period=86400&id= " . $module_id . " &label= " . $module [ " name " ] . " &refresh=600','day_ " . $win_handle . " ') " ;
echo '<a href="javascript:' . $link . '">' ;
2010-08-09 11:14:46 +02:00
switch ( $status ){
case 0 :
2010-08-12 17:29:28 +02:00
print_status_image ( 'module_ok.png' , $module [ 'name' ] . " in " . $agent [ 'nombre' ] . " : " . __ ( 'NORMAL' ), false , array ( 'width' => '20px' , 'height' => '20px' ));
2010-08-09 11:14:46 +02:00
break ;
case 1 :
2010-08-12 17:29:28 +02:00
print_status_image ( 'module_critical.png' , $module [ 'name' ] . " in " . $agent [ 'nombre' ] . " : " . __ ( 'CRITICAL' ), false , array ( 'width' => '20px' , 'height' => '20px' ));
2010-08-09 11:14:46 +02:00
break ;
case 2 :
2010-08-12 17:29:28 +02:00
print_status_image ( 'module_warning.png' , $module [ 'name' ] . " in " . $agent [ 'nombre' ] . " : " . __ ( 'WARNING' ), false , array ( 'width' => '20px' , 'height' => '20px' ));
2010-08-09 11:14:46 +02:00
break ;
case 3 :
2010-08-12 17:29:28 +02:00
print_status_image ( 'module_unknown.png' , $module [ 'name' ] . " in " . $agent [ 'nombre' ] . " : " . __ ( 'UNKNOWN' ), false , array ( 'width' => '20px' , 'height' => '20px' ));
2010-08-09 11:14:46 +02:00
break ;
case 4 :
2010-08-12 17:29:28 +02:00
print_status_image ( 'module_alertsfired.png' , $module [ 'name' ] . " in " . $agent [ 'nombre' ] . " : " . __ ( 'ALERTS FIRED' ), false , array ( 'width' => '20px' , 'height' => '20px' ));
2010-08-09 11:14:46 +02:00
break ;
}
2010-08-24 17:40:19 +02:00
echo '</a>' ;
2010-08-09 11:14:46 +02:00
echo " </td> " ;
$match = true ;
}
}
2010-08-24 17:40:19 +02:00
2010-08-09 11:14:46 +02:00
if ( ! $match ) {
2010-08-12 17:29:28 +02:00
echo " <td style='background-color: #DDD;'></td> " ;
2010-08-09 11:14:46 +02:00
}
}
echo " </tr> " ;
}
echo " </table> " ;
2010-08-09 12:24:30 +02:00
2010-08-12 17:29:28 +02:00
echo " <br><br><p> " . __ ( " The colours meaning: " ) .
2010-08-09 12:24:30 +02:00
" <ul style='float: left;'> " .
' < li style = " clear: both; " >
2010-08-12 17:29:28 +02:00
< div style = " float: left; background: #ffa300; height: 14px; width: 26px;margin-right: 5px; margin-bottom: 5px; " >& nbsp ; </ div > ' .
2010-08-17 19:58:39 +02:00
__ ( " Orange cell when the module has fired alerts " ) .
2010-08-09 12:24:30 +02:00
'</li>' .
' < li style = " clear: both; " >
2010-08-12 17:29:28 +02:00
< div style = " float: left; background: #cc0000; height: 14px; width: 26px;margin-right: 5px; margin-bottom: 5px; " >& nbsp ; </ div > ' .
2010-08-17 19:58:39 +02:00
__ ( " Red cell when the module has a critical status " ) .
2010-08-09 12:24:30 +02:00
'</li>' .
' < li style = " clear: both; " >
2010-08-12 17:29:28 +02:00
< div style = " float: left; background: #fce94f; height: 14px; width: 26px;margin-right: 5px; margin-bottom: 5px; " >& nbsp ; </ div > ' .
2010-08-17 19:58:39 +02:00
__ ( " Yellow cell when the module has a warning status " ) .
2010-08-09 12:24:30 +02:00
'</li>' .
' < li style = " clear: both; " >
2010-08-17 19:58:39 +02:00
< div style = " float: left; background: #8ae234; height: 14px; width: 26px;margin-right: 5px; margin-bottom: 5px; " >& nbsp ; </ div > ' .
__ ( " Green cell when the module has a normal status " ) .
2010-08-09 12:24:30 +02:00
'</li>' .
' < li style = " clear: both; " >
2010-08-17 19:58:39 +02:00
< div style = " float: left; background: #babdb6; height: 14px; width: 26px;margin-right: 5px; margin-bottom: 5px; " >& nbsp ; </ div > ' .
__ ( " Grey cell when the module has an unknown status " ) .
2010-08-09 12:24:30 +02:00
'</li>' .
" </ul> " .
" </p> " ;
2010-08-09 11:14:46 +02:00
}
2010-08-24 13:17:04 +02:00
add_operation_menu_option ( __ ( " Agents/Modules view " ), 'estado' , 'agents_modules/icon_menu.png' );
2010-08-09 11:14:46 +02:00
add_extension_main_function ( 'mainAgentsModules' );
?>