2006-03-27 05:37:27 +02:00
< ? php
2008-08-22 20:07:32 +02:00
2009-06-08 20:15:58 +02:00
// Pandora FMS - http://pandorafms.com
// ==================================================
2010-05-31 13:41:10 +02:00
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
2009-06-08 20:15:58 +02:00
// Please see http://pandorafms.org for full contribution list
2008-04-17 17:27:25 +02:00
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-08-22 20:07:32 +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.
2006-03-27 05:37:27 +02:00
// Load global vars
2010-03-02 Sancho Lerena <slerena@artica.es>
* include/functions_reporting.php: Solved issue with several undefined
vars.
* include/functions_servers.php: Solved issue with several undefined
vars.
* include/functions_config.php: Added metaconsola witch to readconfig.
* include/config_process.php: Update build.. is YYMMDD !
* include/functions_ui.php: Removed deprecated call to split and replaced
by preg_split.
* index.php: Activated developer mode.
* operation/agentes/estado_monitores.php: Solved small problem with modules
without history, filling missing column in table. Added headers
* godmode/alerts/configure_alert_compound.php,
operation/agentes/status_monitor.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_commands.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php: Removed deprecated call to include
config.php and in some cases, added new header style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2444 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-03-02 15:13:00 +01:00
global $config ;
2008-04-17 17:27:25 +02:00
2008-07-21 14:23:28 +02:00
check_login ();
2006-03-27 05:37:27 +02:00
2016-08-24 15:31:28 +02:00
if ( ! check_acl ( $config [ 'id_user' ], 0 , 'AR' )
2016-09-08 16:06:12 +02:00
&& ! check_acl ( $config [ 'id_user' ], 0 , 'AW' ) &&
! check_acl ( $config [ 'id_user' ], 0 , 'AM' )) {
2016-08-24 15:31:28 +02:00
db_pandora_audit ( 'ACL Violation' ,
'Trying to access Agent Management' );
2009-05-19 15:33:27 +02:00
require ( 'general/noaccess.php' );
return ;
2008-01-10 17:40:00 +01:00
}
2006-03-27 05:37:27 +02:00
2011-11-24 19:19:09 +01:00
require_once ( $config [ 'homedir' ] . '/include/functions_agents.php' );
require_once ( $config [ 'homedir' ] . '/include/functions_modules.php' );
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.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/exportdata.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/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.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/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.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_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.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/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/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.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/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.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/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/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
require_once ( $config [ 'homedir' ] . '/include/functions_users.php' );
2012-11-26 19:38:09 +01:00
enterprise_include_once ( 'include/functions_metaconsole.php' );
2011-11-28 03:11:53 +01:00
$isFunctionPolicies = enterprise_include_once ( 'include/functions_policies.php' );
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.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/exportdata.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/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.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/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.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_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.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/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/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.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/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.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/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/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
2012-11-26 19:38:09 +01:00
if ( ! defined ( 'METACONSOLE' )) {
//Header
2016-10-17 12:30:52 +02:00
ui_print_page_header ( __ ( 'Monitor detail' ),
'images/brick.png' , false );
2013-02-18 14:46:28 +01:00
}
else {
2012-11-27 19:59:31 +01:00
2016-08-24 15:31:28 +02:00
ui_meta_print_header ( __ ( 'Monitor view' ));
2012-11-26 19:38:09 +01:00
}
2008-01-10 17:40:00 +01:00
2017-05-23 16:54:24 +02:00
$ag_freestring = ( string ) get_parameter ( 'ag_freestring' );
2016-10-14 18:51:17 +02:00
$moduletype = ( string ) get_parameter ( 'moduletype' );
2017-02-20 15:32:49 +01:00
$datatype = ( string ) get_parameter ( 'datatype' );
2016-10-14 18:51:17 +02:00
$ag_modulename = ( string ) get_parameter ( 'ag_modulename' );
$refr = ( int ) get_parameter ( 'refr' , 0 );
$offset = ( int ) get_parameter ( 'offset' , 0 );
$status = ( int ) get_parameter ( 'status' , 4 );
$modulegroup = ( int ) get_parameter ( 'modulegroup' , - 1 );
$tag_filter = ( int ) get_parameter ( 'tag_filter' , 0 );
2016-08-24 15:31:28 +02:00
// Sort functionality
2016-10-17 12:30:52 +02:00
$sortField = get_parameter ( 'sort_field' );
$sort = get_parameter ( 'sort' , 'none' );
2016-08-24 15:31:28 +02:00
//When the previous page was a visualmap and show only one module
2016-10-17 12:30:52 +02:00
$id_module = ( int ) get_parameter ( 'id_module' , 0 );
$ag_custom_fields = ( array ) get_parameter ( 'ag_custom_fields' , array ());
2016-11-17 15:30:37 +01:00
$module_option = ( int ) get_parameter ( 'module_option' , 1 );
2016-10-17 12:30:52 +02:00
if ( ! is_metaconsole ()) {
$ag_group = ( int ) get_parameter ( 'ag_group' , 0 );
}
2013-10-14 14:36:41 +02:00
else {
2016-10-17 12:30:52 +02:00
$ag_group = get_parameter ( 'ag_group' , 0 );
2013-10-14 14:36:41 +02:00
$ag_group_metaconsole = $ag_group ;
}
2016-10-17 12:30:52 +02:00
$ag_custom_fields_params = '' ;
2014-04-14 15:18:20 +02:00
if ( ! empty ( $ag_custom_fields )) {
foreach ( $ag_custom_fields as $id => $value ) {
if ( ! empty ( $value ))
2016-10-17 12:30:52 +02:00
$ag_custom_fields_params .=
'&ag_custom_fields[' . $id . ']=' . $value ;
2014-04-14 15:18:20 +02:00
}
}
2013-06-24 15:43:49 +02:00
if ( $id_module ) {
$status = - 1 ;
$ag_modulename = modules_get_agentmodule_name ( $id_module );
2017-02-22 16:43:28 +01:00
$ag_freestring = modules_get_agentmodule_agent_alias ( $id_module );
2013-06-24 15:43:49 +02:00
}
2013-05-20 10:42:02 +02:00
enterprise_hook ( 'open_meta_frame' );
2015-03-11 11:31:46 +01:00
2012-11-29 18:34:51 +01:00
// Get Groups and profiles from user
2016-10-17 12:30:52 +02:00
$user_groups = implode ( ',' , array_keys ( users_get_groups ()));
2013-01-10 17:00:30 +01:00
////////////////////////////////////
// Begin Build SQL sentences
2018-04-09 18:56:05 +02:00
$sql_from = ' FROM ttipo_modulo,tagente LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent, tagente_modulo, tagente_estado,tmodule ' ;
2013-01-10 17:00:30 +01:00
2016-08-24 15:31:28 +02:00
$sql_conditions_base = ' WHERE tagente . id_agente = tagente_modulo . id_agente
2016-10-14 18:51:17 +02:00
AND tagente_estado . id_agente_modulo = tagente_modulo . id_agente_modulo AND tagente_modulo . id_tipo_modulo = ttipo_modulo . id_tipo AND tmodule . id_module = tagente_modulo . id_modulo ' ;
2013-02-18 14:46:28 +01:00
2016-11-16 09:59:48 +01:00
$sql_conditions = ' AND tagente.disabled = 0' ;
2013-02-18 14:46:28 +01:00
2014-07-23 18:59:05 +02:00
if ( is_numeric ( $ag_group )) {
$id_ag_group = 0 ;
}
else {
$id_ag_group = db_get_value ( 'id_grupo' , 'tgrupo' , 'nombre' , $ag_group );
}
2013-11-12 13:38:13 +01:00
2013-01-10 17:00:30 +01:00
// Agent group selector
2016-08-24 15:31:28 +02:00
if ( ! is_metaconsole ()) {
if ( $ag_group > 0 && check_acl ( $config [ 'id_user' ], $ag_group , 'AR' )) {
2018-04-09 18:56:05 +02:00
$sql_conditions_group = sprintf (
' AND (tagente.id_grupo = %d OR tasg.id_group = %d)' ,
$ag_group , $ag_group
);
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $user_groups != '' ) {
2013-01-10 17:00:30 +01:00
// User has explicit permission on group 1 ?
2018-04-09 18:56:05 +02:00
$sql_conditions_group = ' AND (
tagente . id_grupo IN ( '.$user_groups.' )
OR tasg . id_group IN ( '.$user_groups.' )
) ' ;
2013-01-10 17:00:30 +01:00
}
}
else {
2016-09-12 11:54:54 +02:00
if ((( int ) $ag_group !== 0 ) && ( check_acl ( $config [ 'id_user' ], $id_ag_group , 'AR' ))) {
2018-04-09 19:10:19 +02:00
$sql_conditions_group = sprintf (
' AND (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))' ,
2018-04-27 11:07:54 +02:00
$ag_group , $ag_group
2018-04-09 19:10:19 +02:00
);
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $user_groups != '' ) {
2013-01-10 17:00:30 +01:00
// User has explicit permission on group 1 ?
2018-04-09 19:10:19 +02:00
$sql_conditions_group = ' AND (
tagente . id_grupo IN ( '.$user_groups.' )
OR tasg . id_group IN ( '.$user_groups.' )
) ' ;
2013-01-10 17:00:30 +01:00
}
}
2014-07-23 18:59:05 +02:00
2013-01-10 17:00:30 +01:00
// Module group
2016-08-24 15:31:28 +02:00
if ( is_metaconsole ()) {
2013-01-10 17:00:30 +01:00
if ( $modulegroup != '-1' )
2016-09-12 11:54:54 +02:00
$sql_conditions .= sprintf ( ' AND tagente_modulo.id_module_group IN (%s)' , $modulegroup );
2013-01-10 17:00:30 +01:00
}
else if ( $modulegroup > - 1 ) {
2016-08-24 15:31:28 +02:00
$sql_conditions .= sprintf ( ' AND tagente_modulo.id_module_group = \'%d\'' , $modulegroup );
2013-01-10 17:00:30 +01:00
}
// Module name selector
2016-08-24 15:31:28 +02:00
if ( $ag_modulename != '' ) {
$sql_conditions .= sprintf ( ' AND tagente_modulo.nombre = \'%s\'' ,
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
$ag_modulename );
2013-01-10 17:00:30 +01:00
}
2016-11-16 09:59:48 +01:00
if ( $module_option !== 0 ) {
if ( $module_option == 1 ) {
// Only enabled
$sql_conditions .= sprintf ( ' AND tagente_modulo.disabled = 0' );
}
else if ( $module_option == 2 ) {
// Only disabled
$sql_conditions .= sprintf ( ' AND tagente_modulo.disabled = 1' );
}
}
2016-10-14 18:51:17 +02:00
if ( $datatype != '' ) {
$sql_conditions .= sprintf ( ' AND ttipo_modulo.id_tipo =' . $datatype );
}
if ( $moduletype != '' ) {
$sql_conditions .= sprintf ( ' AND tagente_modulo.id_modulo =' . $moduletype );
}
2013-01-10 17:00:30 +01:00
// Freestring selector
2016-08-24 15:31:28 +02:00
if ( $ag_freestring != '' ) {
2017-05-23 16:54:24 +02:00
$sql_conditions .= ' AND (tagente.nombre COLLATE utf8_general_ci LIKE \'%%' . $ag_freestring . ' %% \ '
OR tagente . alias COLLATE utf8_general_ci LIKE \ '%%' . $ag_freestring . ' %% \ '
OR tagente_modulo . nombre COLLATE utf8_general_ci LIKE \ '%%' . $ag_freestring . ' %% \ '
OR tagente_modulo . descripcion COLLATE utf8_general_ci LIKE \ '%%' . $ag_freestring . '%%\')' ;
2013-01-10 17:00:30 +01:00
}
// Status selector
2013-03-26 18:15:49 +01:00
if ( $status == AGENT_MODULE_STATUS_NORMAL ) { //Normal
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado . estado = 0
AND ( utimestamp > 0 OR ( tagente_modulo . id_tipo_modulo IN ( 21 , 22 , 23 , 100 ))) ' ;
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $status == AGENT_MODULE_STATUS_CRITICAL_BAD ) { //Critical
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0' ;
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $status == AGENT_MODULE_STATUS_WARNING ) { //Warning
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0' ;
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $status == AGENT_MODULE_STATUS_NOT_NORMAL ) { //Not normal
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado.estado <> 0' ;
2013-01-10 17:00:30 +01:00
}
2013-07-24 13:06:24 +02:00
elseif ( $status == AGENT_MODULE_STATUS_UNKNOWN ) { //Unknown
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0' ;
2013-01-10 17:00:30 +01:00
}
2013-03-26 18:15:49 +01:00
elseif ( $status == AGENT_MODULE_STATUS_NOT_INIT ) { //Not init
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_estado . utimestamp = 0
AND tagente_modulo . id_tipo_modulo NOT IN ( 21 , 22 , 23 , 100 ) ' ;
2013-01-10 17:00:30 +01:00
}
2014-04-14 15:18:20 +02:00
// Filter by agent custom fields
$sql_conditions_custom_fields = " " ;
if ( ! empty ( $ag_custom_fields )) {
$cf_filter = array ();
foreach ( $ag_custom_fields as $field_id => $value ) {
if ( ! empty ( $value )) {
2016-10-17 12:30:52 +02:00
$cf_filter [] = '(tagent_custom_data.id_field = ' . $field_id .
' AND tagent_custom_data.description LIKE \'%' . $value . '%\')' ;
2014-04-14 15:18:20 +02:00
}
}
if ( ! empty ( $cf_filter )) {
2016-08-24 15:31:28 +02:00
$sql_conditions_custom_fields = ' AND tagente . id_agente IN (
2014-04-14 15:18:20 +02:00
SELECT tagent_custom_data . id_agent
FROM tagent_custom_data
2016-08-24 15:31:28 +02:00
WHERE ' . implode(' AND ', $cf_filter) . ' ) ' ;
2014-04-14 15:18:20 +02:00
}
}
2013-01-10 17:00:30 +01:00
//Filter by tag
if ( $tag_filter !== 0 ) {
2016-08-24 15:31:28 +02:00
if ( is_metaconsole ()) {
$sql_conditions .= ' AND tagente_modulo . id_agente_modulo IN (
2013-03-26 18:15:49 +01:00
SELECT ttag_module . id_agente_modulo
FROM ttag_module
2016-10-17 12:30:52 +02:00
WHERE ttag_module . id_tag IN ( '.$tag_filter.' )) ' ;
2013-01-10 17:00:30 +01:00
}
2014-07-31 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_networkmap.php, include/functions_graph.php,
include/db/postgresql.php, include/db/oracle.php,
include/functions_api.php, extensions/agents_alerts.php,
operation/search_main.php, operation/search_agents.getdata.php,
operation/agentes/status_monitor.php,
operation/agentes/networkmap.topology.php,
operation/agentes/ver_agente.php,
operation/search_modules.getdata.php, operation/search_results.php,
operation/events/events_list.php,
godmode/alerts/alert_list.builder.php,
godmode/alerts/configure_alert_template.php,
godmode/modules/manage_network_components_form.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php: tiny fixes for the improve the
support of postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10368 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-31 16:27:43 +02:00
else {
2016-08-24 15:31:28 +02:00
$sql_conditions .= ' AND tagente_modulo . id_agente_modulo IN (
2013-03-26 18:15:49 +01:00
SELECT ttag_module . id_agente_modulo
FROM ttag_module
2016-08-24 15:31:28 +02:00
WHERE ttag_module . id_tag = ' . $tag_filter . ' ) ' ;
2013-01-10 17:00:30 +01:00
}
}
2016-10-14 18:51:17 +02:00
2015-10-01 16:18:45 +02:00
// Apply the module ACL with tags
$sql_conditions_tags = '' ;
2016-10-17 12:30:52 +02:00
2015-10-01 16:18:45 +02:00
if ( ! users_is_admin ()) {
if ( $ag_group !== 0 ) {
$sql_conditions_tags = tags_get_acl_tags ( $config [ 'id_user' ],
$ag_group , 'AR' , 'module_condition' , 'AND' , 'tagente_modulo' ,
2016-08-24 15:31:28 +02:00
true , array (), false );
2016-10-17 12:30:52 +02:00
} else {
2016-08-24 15:31:28 +02:00
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
$groups = users_get_groups ( $config [ 'id_user' ]);
2015-10-01 16:18:45 +02:00
$sql_conditions_tags = tags_get_acl_tags (
$config [ 'id_user' ], array_keys ( $groups ), 'AR' ,
'module_condition' , 'AND' , 'tagente_modulo' , true , array (),
2016-08-24 15:31:28 +02:00
false );
2015-10-01 16:18:45 +02:00
}
if ( is_numeric ( $sql_conditions_tags )) {
$sql_conditions_tags = ' AND 1 = 0' ;
}
2013-06-07 14:28:20 +02:00
}
2013-01-10 17:00:30 +01:00
// Two modes of filter. All the filters and only ACLs filter
2014-04-14 15:18:20 +02:00
$sql_conditions_all = $sql_conditions_base . $sql_conditions . $sql_conditions_group . $sql_conditions_tags . $sql_conditions_custom_fields ;
$sql_conditions_acl = $sql_conditions_base . $sql_conditions_group . $sql_conditions_tags . $sql_conditions_custom_fields ;
2013-01-10 17:00:30 +01:00
// Get count to paginate
2016-10-17 12:30:52 +02:00
if ( ! defined ( 'METACONSOLE' ))
2018-04-09 18:56:05 +02:00
$count = db_get_sql ( 'SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_from . $sql_conditions_all );
2013-01-10 17:00:30 +01:00
// Get limit_sql depend of the metaconsole or standard mode
2016-08-24 15:31:28 +02:00
if ( is_metaconsole ()) {
2013-01-10 17:00:30 +01:00
// Offset will be used to get the subset of modules
$inferior_limit = $offset ;
2016-08-24 15:31:28 +02:00
$superior_limit = $config [ 'block_size' ] + $offset ;
2013-01-10 17:00:30 +01:00
// Offset reset to get all elements
$offset = 0 ;
2016-08-24 15:31:28 +02:00
if ( ! isset ( $config [ 'meta_num_elements' ]))
$config [ 'meta_num_elements' ] = 100 ;
2013-01-10 17:00:30 +01:00
2016-08-24 15:31:28 +02:00
$limit_sql = $config [ 'meta_num_elements' ];
2013-01-10 17:00:30 +01:00
}
else
2016-08-24 15:31:28 +02:00
$limit_sql = $config [ 'block_size' ];
2013-01-10 17:00:30 +01:00
// End Build SQL sentences
/////////////////////////////////////
2016-10-17 12:30:52 +02:00
// Start Build Search Form
/////////////////////////////////////
2016-08-24 15:31:28 +02:00
$table = new StdClass ();
$table -> width = '100%' ;
$table -> cellspacing = 0 ;
$table -> cellpadding = 0 ;
$table -> class = 'databox filters' ;
2015-07-01 11:27:37 +02:00
$table -> style [ 0 ] = 'font-weight: bold;' ;
$table -> style [ 1 ] = 'font-weight: bold;' ;
$table -> style [ 2 ] = 'font-weight: bold;' ;
$table -> style [ 3 ] = 'font-weight: bold;' ;
$table -> style [ 4 ] = 'font-weight: bold;' ;
2015-03-11 11:31:46 +01:00
$table -> data [ 0 ][ 0 ] = __ ( 'Group' );
2016-10-17 12:30:52 +02:00
$table -> data [ 0 ][ 1 ] = html_print_select_groups ( $config [ 'id_user' ], 'AR' ,
true , 'ag_group' , $ag_group , '' , '' , '0' , true , false ,
2017-05-29 14:31:46 +02:00
false , '' , false , '' , false , false ,
2016-10-17 12:30:52 +02:00
'id_grupo' , false );
2012-11-29 18:34:51 +01:00
$fields = array ();
2015-06-08 13:13:09 +02:00
$fields [ AGENT_MODULE_STATUS_NORMAL ] = __ ( 'Normal' );
2013-03-26 18:15:49 +01:00
$fields [ AGENT_MODULE_STATUS_WARNING ] = __ ( 'Warning' );
$fields [ AGENT_MODULE_STATUS_CRITICAL_BAD ] = __ ( 'Critical' );
2013-07-24 13:06:24 +02:00
$fields [ AGENT_MODULE_STATUS_UNKNOWN ] = __ ( 'Unknown' );
2013-03-26 18:15:49 +01:00
$fields [ AGENT_MODULE_STATUS_NOT_NORMAL ] = __ ( 'Not normal' ); //default
$fields [ AGENT_MODULE_STATUS_NOT_INIT ] = __ ( 'Not init' );
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
$table -> data [ 0 ][ 2 ] = __ ( 'Monitor status' );
2016-08-24 15:31:28 +02:00
$table -> data [ 0 ][ 3 ] = html_print_select ( $fields , 'status' , $status , '' , __ ( 'All' ), - 1 ,
2015-03-11 11:31:46 +01:00
true , false , true , '' , false , 'width: 150px;' );
2012-11-29 18:34:51 +01:00
2016-08-24 15:31:28 +02:00
$rows_select = array ();
2016-10-17 12:30:52 +02:00
$table -> data [ 0 ][ 4 ] = __ ( 'Module group' );
2016-08-24 15:31:28 +02:00
$rows_select [ 0 ] = __ ( 'Not assigned' );
if ( ! is_metaconsole ()) {
$rows = db_get_all_rows_sql ( ' SELECT *
FROM tmodule_group ORDER BY name ' );
2012-11-29 18:34:51 +01:00
$rows = io_safe_output ( $rows );
if ( ! empty ( $rows ))
foreach ( $rows as $module_group )
$rows_select [ $module_group [ 'id_mg' ]] = $module_group [ 'name' ];
}
2016-09-12 11:54:54 +02:00
else {
$rows_select = modules_get_modulegroups ();
}
$table -> data [ 0 ][ 5 ] = html_print_select ( $rows_select , 'modulegroup' , $modulegroup , '' , __ ( 'All' ), - 1 , true , false , true , '' , false , 'width: 120px;' );
2015-03-11 11:31:46 +01:00
2015-04-22 09:51:34 +02:00
$table -> rowspan [ 0 ][ 6 ] = 2 ;
2016-08-24 15:31:28 +02:00
$table -> data [ 0 ][ 6 ] = html_print_submit_button ( __ ( 'Show' ), 'uptbutton' ,
2015-04-22 09:51:34 +02:00
false , 'class="sub search" style="margin-top:0px;"' , true );
2016-08-24 15:31:28 +02:00
$modules = array ();
$modules = modules_get_modules_name ( $sql_from , $sql_conditions_acl , is_metaconsole ());
2016-10-17 12:30:52 +02:00
2015-03-11 11:31:46 +01:00
$table -> data [ 1 ][ 0 ] = __ ( 'Module name' );
2016-08-24 15:31:28 +02:00
$table -> data [ 1 ][ 1 ] = html_print_select ( index_array ( $modules , 'nombre' , 'nombre' ), 'ag_modulename' ,
2015-03-11 11:31:46 +01:00
$ag_modulename , '' , __ ( 'All' ), '' , true , false , true , '' , false , 'width: 150px;' );
2012-11-04 20:10:19 +01:00
2015-06-12 15:50:46 +02:00
$table -> data [ 1 ][ 2 ] = __ ( 'Search' );
2016-10-17 12:30:52 +02:00
$table -> data [ 1 ][ 3 ] = html_print_input_text ( 'ag_freestring' , $ag_freestring , '' , 20 , 30 , true );
2012-11-04 20:10:19 +01:00
2016-08-24 15:31:28 +02:00
if ( ! is_metaconsole ())
2015-03-11 11:31:46 +01:00
$table -> data [ 1 ][ 4 ] = __ ( 'Tags' ) .
2015-03-06 12:28:05 +01:00
ui_print_help_tip ( __ ( 'Only it is show tags in use.' ), true );
else
2015-03-11 11:31:46 +01:00
$table -> data [ 1 ][ 4 ] = __ ( 'Tags' ) .
2015-03-06 12:28:05 +01:00
ui_print_help_tip ( __ ( 'Only it is show tags in use.' ), true );
2013-01-10 17:00:30 +01:00
2016-08-24 15:31:28 +02:00
$tags = array ();
2015-01-15 18:08:58 +01:00
$tags = tags_get_user_tags ();
2016-10-17 12:30:52 +02:00
if ( empty ( $tags )) {
2015-03-11 11:31:46 +01:00
$table -> data [ 1 ][ 5 ] = __ ( 'No tags' );
2016-10-17 12:30:52 +02:00
}
else {
2016-08-24 15:31:28 +02:00
$table -> data [ 1 ][ 5 ] = html_print_select ( $tags , 'tag_filter' ,
2015-03-11 11:31:46 +01:00
$tag_filter , '' , __ ( 'All' ), '' , true , false , true , '' , false , 'width: 150px;' );
2016-10-17 12:30:52 +02:00
}
2015-01-15 15:11:26 +01:00
2016-10-14 18:51:17 +02:00
$network_available = db_get_sql ( " SELECT count(*)
FROM tserver
WHERE server_type = 1 " ); //POSTGRESQL AND ORACLE COMPATIBLE
$wmi_available = db_get_sql ( " SELECT count(*)
FROM tserver
WHERE server_type = 6 " ); //POSTGRESQL AND ORACLE COMPATIBLE
$plugin_available = db_get_sql ( " SELECT count(*)
FROM tserver
WHERE server_type = 4 " ); //POSTGRESQL AND ORACLE COMPATIBLE
$prediction_available = db_get_sql ( " SELECT count(*)
FROM tserver
WHERE server_type = 5 " ); //POSTGRESQL AND ORACLE COMPATIBLE
2017-11-06 18:45:53 +01:00
$wux_available = db_get_sql ( " SELECT count(*)
FROM tserver
WHERE server_type = 17 " ); //POSTGRESQL AND ORACLE COMPATIBLE
2016-10-14 18:51:17 +02:00
// Development mode to use all servers
if ( $develop_bypass ) {
$network_available = 1 ;
$wmi_available = 1 ;
$plugin_available = 1 ;
$prediction_available = 1 ;
}
$typemodules = array ();
$typemodules [ 1 ] = __ ( 'Data server module' );
if ( $network_available )
$typemodules [ 2 ] = __ ( 'Network server module' );
if ( $plugin_available )
$typemodules [ 4 ] = __ ( 'Plugin server module' );
if ( $wmi_available )
$typemodules [ 6 ] = __ ( 'WMI server module' );
if ( $prediction_available )
$typemodules [ 5 ] = __ ( 'Prediction server module' );
if ( enterprise_installed ()) {
$typemodules [ 7 ] = __ ( 'Web server module' );
2017-11-06 18:45:53 +01:00
if ( $wux_available ) {
$typemodules [ 8 ] = __ ( 'Wux server module' );
}
2016-10-14 18:51:17 +02:00
}
$table -> data [ 2 ][ 0 ] = '<span>' . __ ( 'Server type' ) . '</span>' ;
$table -> data [ 2 ][ 1 ] = html_print_select ( $typemodules , 'moduletype' , $moduletype , '' , __ ( 'All' ), '' , true , false , true , '' , false , 'width: 150px;' );
2016-11-17 15:30:37 +01:00
$monitor_options = array ( 0 => __ ( 'All' ), 1 => __ ( 'Only enabled' ), 2 => __ ( 'Only disabled' ));
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 2 ] = '<span>' . __ ( 'Show monitors...' ) . '</span>' ;
2016-10-14 18:51:17 +02:00
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 3 ] = html_print_select ( $monitor_options , 'module_option' , $module_option , '' , '' , '' , true , false , true , '' , false , 'width: 150px;' );
$table -> data [ 2 ][ 4 ] = '<span id="datatypetittle" ' ;
2016-10-14 18:51:17 +02:00
if ( ! $_GET [ 'sort' ]){
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 4 ] .= 'style="display:none"' ;
2016-10-14 18:51:17 +02:00
}
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 4 ] .= '>' . __ ( 'Data type' ) . '</span>' ;
2016-10-14 18:51:17 +02:00
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '<div id="datatypebox">' ;
2016-10-14 18:51:17 +02:00
switch ( $moduletype )
{
case 1 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria IN ( 6 , 7 , 8 , 0 , 1 , 2 , - 1 ) order by descripcion ' );
break ;
case 2 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria between 3 and 5 ' );
break ;
case 4 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria between 0 and 2 ' );
break ;
case 6 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria between 0 and 2 ' );
break ;
case 7 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria = 9 ' );
break ;
case 5 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE categoria = 0 ' );
break ;
2017-11-06 18:45:53 +01:00
case 8 :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo
WHERE nombre = \ 'web_analysis\'' );
break ;
2016-10-14 18:51:17 +02:00
case '' :
$sql = sprintf ( ' SELECT id_tipo , descripcion
FROM ttipo_modulo ' );
break ;
}
$a = db_get_all_rows_sql ( $sql );
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '<select id="datatype" name="datatype" ' ;
2016-10-14 18:51:17 +02:00
if ( ! $_GET [ 'sort' ]){
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= 'style="display:none"' ;
2016-10-14 18:51:17 +02:00
}
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '>' ;
2016-10-14 18:51:17 +02:00
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '<option name="datatype" value="">' . __ ( " All " ) . '</option>' ;
2016-10-14 18:51:17 +02:00
foreach ( $a as $valor ) {
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '<option name="datatype" value="' . $valor [ 'id_tipo' ] . '" ' ;
2016-10-14 18:51:17 +02:00
if ( $valor [ 'id_tipo' ] == $datatype ){
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= 'selected' ;
2016-10-14 18:51:17 +02:00
}
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '>' . $valor [ 'descripcion' ] . '</option>' ;
2016-10-14 18:51:17 +02:00
}
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '</select>' ;
2016-10-14 18:51:17 +02:00
2016-11-16 09:59:48 +01:00
$table -> data [ 2 ][ 5 ] .= '</div>' ;
2016-10-14 18:51:17 +02:00
2015-01-15 15:11:26 +01:00
2014-04-14 15:18:20 +02:00
$table_custom_fields = new stdClass ();
2015-04-10 09:43:44 +02:00
$table_custom_fields -> class = 'filters' ;
$table_custom_fields -> width = '100%' ;
2015-07-01 11:27:37 +02:00
2016-08-24 15:31:28 +02:00
if ( is_metaconsole ()) {
2016-10-17 12:30:52 +02:00
$table_custom_fields -> styleTable = 'margin-left:0px; margin-top:15px;' ;
$table_custom_fields -> cellpadding = '0' ;
$table_custom_fields -> cellspacing = '0' ;
2015-03-06 12:28:05 +01:00
}
2014-04-14 15:18:20 +02:00
$table_custom_fields -> style = array ();
2016-08-24 15:31:28 +02:00
if ( ! is_metaconsole ())
2015-03-06 12:28:05 +01:00
$table_custom_fields -> style [ 0 ] = 'font-weight: bold; width: 150px;' ;
2015-03-11 11:31:46 +01:00
else
$table_custom_fields -> style [ 0 ] = 'font-weight: bold;' ;
2014-04-14 15:18:20 +02:00
$table_custom_fields -> colspan = array ();
$table_custom_fields -> data = array ();
$custom_fields = db_get_all_fields_in_table ( 'tagent_custom_fields' );
if ( $custom_fields === false ) $custom_fields = array ();
foreach ( $custom_fields as $custom_field ) {
$row = array ();
$row [ 0 ] = $custom_field [ 'name' ];
2014-08-26 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/configure_alert_action.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/module_unknow.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/help/clippy/godmode_alerts_alert_actions.php,
include/help/clippy/operation_agentes_ver_agente.php,
include/help/clippy/godmode_alerts_configure_alert_action.php,
include/help/clippy/operation_agentes_status_monitor.php,
include/help/en/help_context_pandora_server_email.php,
include/functions_clippy.php, operation/menu.php,
operation/agentes/status_monitor.php: some changes suggested by
Carla.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10457 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-26 13:22:06 +02:00
2014-06-17 17:11:50 +02:00
$custom_field_value = " " ;
if ( ! empty ( $ag_custom_fields )) {
$custom_field_value = $ag_custom_fields [ $custom_field [ 'id_field' ]];
if ( empty ( $custom_field_value )) {
$custom_field_value = " " ;
}
2014-04-14 15:18:20 +02:00
}
2016-10-17 12:30:52 +02:00
$row [ 1 ] = html_print_input_text ( " ag_custom_fields[ " . $custom_field [ 'id_field' ] . " ] " , $custom_field_value , '' , 100 , 300 , true );
2014-08-26 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/configure_alert_action.php,
include/help/clippy/godmode_agentes_modificar_agente.php,
include/help/clippy/homepage.php,
include/help/clippy/module_unknow.php,
include/help/clippy/godmode_agentes_configurar_agente.php,
include/help/clippy/godmode_alerts_alert_actions.php,
include/help/clippy/operation_agentes_ver_agente.php,
include/help/clippy/godmode_alerts_configure_alert_action.php,
include/help/clippy/operation_agentes_status_monitor.php,
include/help/en/help_context_pandora_server_email.php,
include/functions_clippy.php, operation/menu.php,
operation/agentes/status_monitor.php: some changes suggested by
Carla.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10457 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-08-26 13:22:06 +02:00
2014-04-14 15:18:20 +02:00
$table_custom_fields -> data [] = $row ;
}
2016-10-14 18:51:17 +02:00
2017-10-23 16:43:16 +02:00
$filters = '<form method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor&refr=' . $refr . '&ag_group=' .
2016-11-16 09:59:48 +01:00
$ag_group . '&ag_freestring=' . $ag_freestring . '&module_option=' . $module_option . '&ag_modulename=' . $ag_modulename . '&moduletype=' . $moduletype . '&datatype=' . $datatype . '&status=' . $status . '&sort_field=' .
2016-08-24 15:31:28 +02:00
$sortField . '&sort=' . $sort . '&pure=' . $config [ 'pure' ] . $ag_custom_fields_params . '">' ;
if ( is_metaconsole ()) {
2016-10-14 18:51:17 +02:00
$table -> colspan [ 3 ][ 0 ] = 7 ;
$table -> cellstyle [ 3 ][ 0 ] = 'padding: 10px;' ;
$table -> data [ 3 ][ 0 ] = ui_toggle (
2015-06-08 11:05:19 +02:00
html_print_table ( $table_custom_fields , true ),
__ ( 'Advanced Options' ), '' , true , true );
2015-03-11 11:31:46 +01:00
$filters .= html_print_table ( $table , true );
2016-10-17 12:30:52 +02:00
$filters .= " </form> " ;
2015-03-11 11:31:46 +01:00
ui_toggle ( $filters , __ ( 'Show Options' ));
}
2015-06-08 09:32:01 +02:00
else {
2016-10-14 18:51:17 +02:00
$table -> colspan [ 3 ][ 0 ] = 7 ;
$table -> cellstyle [ 3 ][ 0 ] = 'padding-left: 10px;' ;
$table -> data [ 3 ][ 0 ] = ui_toggle ( html_print_table ( $table_custom_fields ,
true ), __ ( 'Agent custom fields' ), '' , true , true );
2015-03-11 11:31:46 +01:00
$filters .= html_print_table ( $table , true );
2016-08-24 15:31:28 +02:00
$filters .= '</form>' ;
2015-03-11 11:31:46 +01:00
echo $filters ;
}
unset ( $table );
2016-10-17 12:30:52 +02:00
// End Build Search Form
/////////////////////////////////////
2008-10-29 21:03:42 +01:00
2011-12-05 19:22:49 +01:00
// Sort functionality
$selected = 'border: 1px solid black;' ;
$selectAgentNameUp = '' ;
$selectAgentNameDown = '' ;
$selectTypeUp = '' ;
$selectTypeDown = '' ;
$selectModuleNameUp = '' ;
$selectModuleNameDown = '' ;
$selectIntervalUp = '' ;
$selectIntervalDown = '' ;
$selectStatusUp = '' ;
$selectStatusDown = '' ;
$selectDataUp = '' ;
$selectDataDown = '' ;
$selectTimestampUp = '' ;
$selectTimestampDown = '' ;
$order = null ;
switch ( $sortField ) {
2017-07-10 10:04:04 +02:00
case 'agent_alias' :
2011-12-05 19:22:49 +01:00
switch ( $sort ) {
case 'up' :
$selectAgentNameUp = $selected ;
2016-09-27 10:31:42 +02:00
$order = array ( 'field' => 'tagente.alias' ,
2014-03-07 11:54:02 +01:00
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectAgentNameDown = $selected ;
2016-09-27 10:31:42 +02:00
$order = array ( 'field' => 'tagente.alias' ,
2014-03-07 11:54:02 +01:00
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
break ;
case 'type' :
switch ( $sort ) {
case 'up' :
$selectTypeUp = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.id_tipo_modulo' ,
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectTypeDown = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.id_tipo_modulo' ,
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
break ;
2016-10-14 18:51:17 +02:00
case 'moduletype' :
switch ( $sort ) {
case 'up' :
$selectTypeUp = $selected ;
$order = array (
'field' => 'tagente_modulo.id_modulo' ,
'order' => 'ASC' );
break ;
case 'down' :
$selectTypeDown = $selected ;
$order = array (
'field' => 'tagente_modulo.id_modulo' ,
'order' => 'DESC' );
break ;
}
break ;
2011-12-05 19:22:49 +01:00
case 'module_name' :
switch ( $sort ) {
case 'up' :
$selectModuleNameUp = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.nombre' ,
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectModuleNameDown = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.nombre' ,
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
2012-06-20 11:43:14 +02:00
break ;
2011-12-05 19:22:49 +01:00
case 'interval' :
switch ( $sort ) {
case 'up' :
$selectIntervalUp = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.module_interval' ,
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectIntervalDown = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_modulo.module_interval' ,
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
break ;
case 'status' :
switch ( $sort ) {
case 'up' :
$selectStatusUp = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_estado.estado' ,
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectStatusDown = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_estado.estado' ,
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
break ;
case 'timestamp' :
switch ( $sort ) {
case 'up' :
$selectTimestampUp = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_estado.utimestamp' ,
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
case 'down' :
$selectTimestampDown = $selected ;
2014-03-07 11:54:02 +01:00
$order = array (
'field' => 'tagente_estado.utimestamp' ,
'order' => 'DESC' );
2011-12-05 19:22:49 +01:00
break ;
}
2012-06-20 11:43:14 +02:00
break ;
2015-07-29 10:13:18 +02:00
case 'data' :
switch ( $sort ) {
case 'up' :
$selectTimestampUp = $selected ;
$order = array (
'field' => 'tagente_estado.datos' ,
'order' => 'ASC' );
break ;
case 'down' :
$selectTimestampDown = $selected ;
$order = array (
'field' => 'tagente_estado.datos' ,
'order' => 'DESC' );
break ;
}
break ;
2011-12-05 19:22:49 +01:00
default :
$selectAgentNameUp = $selected ;
$selectAgentNameDown = '' ;
$selectTypeUp = '' ;
$selectTypeDown = '' ;
$selectModuleNameUp = '' ;
$selectModuleNameDown = '' ;
$selectIntervalUp = '' ;
$selectIntervalDown = '' ;
$selectStatusUp = '' ;
$selectStatusDown = '' ;
$selectDataUp = '' ;
$selectDataDown = '' ;
$selectTimestampUp = '' ;
$selectTimestampDown = '' ;
2014-03-07 11:54:02 +01:00
$order = array (
2016-09-27 10:31:42 +02:00
'field' => 'tagente.alias' ,
2012-11-04 20:10:19 +01:00
'order' => 'ASC' );
2011-12-05 19:22:49 +01:00
break ;
}
2013-03-26 18:15:49 +01:00
2018-08-02 13:02:33 +02:00
$sql = ' SELECT
( SELECT GROUP_CONCAT ( ttag . name SEPARATOR \ ' , \ ' )
FROM ttag
WHERE ttag . id_tag IN (
SELECT ttag_module . id_tag
FROM ttag_module
WHERE ttag_module . id_agente_modulo = tagente_modulo . id_agente_modulo ))
AS tags ,
tagente_modulo . id_agente_modulo ,
tagente_modulo . id_modulo ,
tagente . intervalo AS agent_interval ,
tagente . alias AS agent_alias ,
tagente . nombre AS agent_name ,
tagente_modulo . nombre AS module_name ,
tagente_modulo . history_data ,
tagente_modulo . flag AS flag ,
tagente . id_grupo AS id_group ,
tagente . id_agente AS id_agent ,
tagente_modulo . id_tipo_modulo AS module_type ,
tagente_modulo . module_interval ,
tagente_modulo . tcp_send ,
tagente_modulo . ip_target ,
tagente_modulo . snmp_community ,
tagente_modulo . snmp_oid ,
tagente_estado . datos ,
tagente_estado . estado ,
tagente_modulo . min_warning ,
tagente_modulo . max_warning ,
tagente_modulo . str_warning ,
tagente_modulo . unit ,
tagente_modulo . min_critical ,
tagente_modulo . max_critical ,
tagente_modulo . str_critical ,
tagente_modulo . extended_info ,
tagente_modulo . critical_inverse ,
tagente_modulo . warning_inverse ,
tagente_modulo . critical_instructions ,
tagente_modulo . warning_instructions ,
tagente_modulo . unknown_instructions ,
tagente_estado . utimestamp AS utimestamp ' .
$sql_from . $sql_conditions_all . '
GROUP BY tagente_modulo . id_agente_modulo
ORDER BY ' . $order[' field '] . " " . $order[' order '] . '
LIMIT ' . $offset . " , " . $limit_sql ;
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
if ( ! defined ( 'METACONSOLE' )) {
2012-11-26 19:38:09 +01:00
$result = db_get_all_rows_sql ( $sql );
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
2012-11-26 19:38:09 +01:00
if ( $result === false ) {
$result = array ();
}
2016-10-17 12:30:52 +02:00
else
ui_pagination ( $count , false , $offset );
2012-11-26 19:38:09 +01:00
}
else {
// For each server defined and not disabled:
2016-08-24 15:31:28 +02:00
$servers = db_get_all_rows_sql ( ' SELECT *
2013-03-26 18:15:49 +01:00
FROM tmetaconsole_setup
2016-08-24 15:31:28 +02:00
WHERE disabled = 0 ' );
2012-11-26 19:38:09 +01:00
if ( $servers === false )
$servers = array ();
2015-02-18 18:29:39 +01:00
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
$result = array ();
2012-11-29 18:34:51 +01:00
$count_modules = 0 ;
2014-09-25 16:55:48 +02:00
foreach ( $servers as $server ) {
2012-11-26 19:38:09 +01:00
// If connection was good then retrieve all data server
2016-10-17 12:30:52 +02:00
if ( metaconsole_connect ( $server ) == NOERR )
2012-11-26 19:38:09 +01:00
$connection = true ;
2016-10-17 12:30:52 +02:00
else
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
$connection = false ;
2012-11-26 19:38:09 +01:00
$result_server = db_get_all_rows_sql ( $sql );
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
if ( ! empty ( $result_server )) {
2012-11-29 18:34:51 +01:00
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
// Create HASH login info
2016-08-24 15:31:28 +02:00
$pwd = $server [ 'auth_token' ];
2012-11-29 18:34:51 +01:00
$auth_serialized = json_decode ( $pwd , true );
if ( is_array ( $auth_serialized )) {
2016-08-24 15:31:28 +02:00
$pwd = $auth_serialized [ 'auth_token' ];
$api_password = $auth_serialized [ 'api_password' ];
$console_user = $auth_serialized [ 'console_user' ];
$console_password = $auth_serialized [ 'console_password' ];
2012-11-29 18:34:51 +01:00
}
2016-08-24 15:31:28 +02:00
$user = $config [ 'id_user' ];
$user_rot13 = str_rot13 ( $config [ 'id_user' ]);
2012-11-29 18:34:51 +01:00
$hashdata = $user . $pwd ;
$hashdata = md5 ( $hashdata );
2016-08-24 15:31:28 +02:00
$url_hash = '&' .
'loginhash=auto&' .
2016-10-17 12:30:52 +02:00
'loginhash_data=' . $hashdata . '&' .
'loginhash_user=' . $user_rot13 ;
2012-11-29 18:34:51 +01:00
foreach ( $result_server as $result_element_key => $result_element_value ) {
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
2016-08-24 15:31:28 +02:00
$result_server [ $result_element_key ][ 'server_id' ] = $server [ 'id' ];
$result_server [ $result_element_key ][ 'server_name' ] = $server [ 'server_name' ];
$result_server [ $result_element_key ][ 'server_url' ] = $server [ 'server_url' ] . '/' ;
2012-11-29 18:34:51 +01:00
$result_server [ $result_element_key ][ 'hashdata' ] = $hashdata ;
2016-08-24 15:31:28 +02:00
$result_server [ $result_element_key ][ 'user' ] = $config [ 'id_user' ];
2018-08-17 14:57:50 +02:00
$result_server [ $result_element_key ][ 'groups_in_server' ] =
agents_get_all_groups_agent (
$result_element_value [ 'id_agent' ],
$result_element_value [ 'id_group' ]
);
2012-11-29 18:34:51 +01:00
$count_modules ++ ;
}
2012-11-26 19:38:09 +01:00
$result = array_merge ( $result , $result_server );
}
2012-11-29 18:34:51 +01:00
metaconsole_restore_db ();
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
}
2012-11-29 18:34:51 +01:00
2016-08-24 15:31:28 +02:00
if ( $count_modules > $config [ 'block_size' ]) {
2012-11-29 18:34:51 +01:00
ui_pagination ( $count_modules , false , $offset );
2015-07-20 10:41:14 +02:00
}
2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
include/functions_visual_map_editor.php,
operation/reporting/reporting_xml.php,
operation/agentes/exportdata.excel.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/alerts_status.php,
operation/agentes/exportdata.csv.php: uploaded the changes of source
code style previous to my next commit for to make the next commit
more easy.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-04 13:21:39 +01:00
2012-11-29 18:34:51 +01:00
// Get number of elements of the pagination
$result = ui_meta_get_subset_array ( $result , $inferior_limit , $superior_limit );
2008-07-17 08:41:39 +02:00
}
2011-04-11 19:05:20 +02:00
if (( $config [ 'dbtype' ] == 'oracle' ) && ( $result !== false )) {
for ( $i = 0 ; $i < count ( $result ); $i ++ ) {
2012-07-25 11:59:03 +02:00
unset ( $result [ $i ][ 'rnum' ]);
2011-04-11 19:05:20 +02:00
}
}
2016-10-14 18:51:17 +02:00
// Start Build List Result
/////////////////////////////////////
if ( ! empty ( $result )) {
$table = new StdClass ();
$table -> cellpadding = 0 ;
$table -> cellspacing = 0 ;
$table -> width = '100%' ;
$table -> class = 'databox data' ;
$table -> head = array ();
$table -> data = array ();
$table -> size = array ();
$table -> align = array ();
if ( $isFunctionPolicies !== ENTERPRISE_NOT_HOOK )
$table -> head [ 0 ] = '<span title=\'' . __ ( 'Policy' ) . '\'>' . __ ( 'P.' ) . '</span>' ;
$table -> head [ 1 ] = __ ( 'Agent' );
2017-10-23 16:43:16 +02:00
$table -> head [ 1 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr=' . $refr . '&datatype=' . $datatype . '&moduletype=' . $moduletype . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=agent_alias&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectAgentNameUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&refr=' . $refr . '&datatype=' . $datatype . '&moduletype=' . $moduletype . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=agent_alias&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectAgentNameDown , 'alt' => 'down' )) . '</a>' ;
2016-10-14 18:51:17 +02:00
$table -> head [ 2 ] = __ ( 'Data Type' );
2017-10-23 16:43:16 +02:00
$table -> head [ 2 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=type&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectTypeUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=type&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectTypeDown , 'alt' => 'down' )) . '</a>' ;
2018-07-26 12:41:09 +02:00
2016-10-14 18:51:17 +02:00
$table -> align [ 2 ] = 'left' ;
$table -> head [ 3 ] = __ ( 'Module name' );
2017-10-23 16:43:16 +02:00
$table -> head [ 3 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectModuleNameUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectModuleNameDown , 'alt' => 'down' )) . '</a>' ;
2018-07-26 12:41:09 +02:00
$table -> head [ 4 ] = __ ( 'Server type' );
2017-10-23 16:43:16 +02:00
$table -> head [ 4 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectModuleNameUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectModuleNameDown , 'alt' => 'down' )) . '</a>' ;
2018-07-26 12:41:09 +02:00
2016-10-14 18:51:17 +02:00
$table -> head [ 5 ] = __ ( 'Interval' );
2017-10-23 16:43:16 +02:00
$table -> head [ 5 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=interval&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectIntervalUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=interval&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectIntervalDown , 'alt' => 'down' )) . '</a>' ;
2016-08-24 15:31:28 +02:00
$table -> align [ 5 ] = 'left' ;
2012-11-29 18:34:51 +01:00
2016-10-14 18:51:17 +02:00
$table -> head [ 6 ] = __ ( 'Status' );
2017-10-23 16:43:16 +02:00
$table -> head [ 6 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=status&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectStatusUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=status&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectStatusDown , 'alt' => 'down' )) . '</a>' ;
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
$table -> align [ 6 ] = 'left' ;
2009-09-14 03:02:44 +02:00
2016-10-17 12:30:52 +02:00
$table -> head [ 7 ] = __ ( 'Graph' );
$table -> align [ 7 ] = 'left' ;
2011-12-05 19:22:49 +01:00
2016-10-17 12:30:52 +02:00
$table -> head [ 8 ] = __ ( 'Warn' );
$table -> align [ 8 ] = 'left' ;
2011-06-27 07:56:55 +02:00
2016-10-14 18:51:17 +02:00
$table -> head [ 9 ] = __ ( 'Data' );
$table -> align [ 9 ] = 'left' ;
if ( is_metaconsole () ) {
2017-10-23 16:43:16 +02:00
$table -> head [ 9 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=data&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectStatusUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=data&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectStatusDown , 'alt' => 'down' )) . '</a>' ;
2016-10-14 18:51:17 +02:00
}
2011-12-05 19:22:49 +01:00
2016-10-14 18:51:17 +02:00
$table -> head [ 10 ] = __ ( 'Timestamp' );
2017-10-23 16:43:16 +02:00
$table -> head [ 10 ] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=timestamp&sort=up">' . html_print_image ( 'images/sort_up.png' , true , array ( 'style' => $selectTimestampUp , 'alt' => 'up' )) . '</a>' .
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype=' . $datatype . '&moduletype=' . $moduletype . '&refr=' . $refr . '&modulegroup=' . $modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=timestamp&sort=down">' . html_print_image ( 'images/sort_down.png' , true , array ( 'style' => $selectTimestampDown , 'alt' => 'down' )) . '</a>' ;
2016-08-24 15:31:28 +02:00
$table -> align [ 10 ] = 'left' ;
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
$id_type_web_content_string = db_get_value ( 'id_tipo' , 'ttipo_modulo' ,
'nombre' , 'web_content_string' );
2012-11-04 20:10:19 +01:00
2016-10-17 12:30:52 +02:00
foreach ( $result as $row ) {
//Avoid unset, null and false value
if ( empty ( $row [ 'server_name' ]))
$row [ 'server_name' ] = " " ;
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
$is_web_content_string = ( bool ) db_get_value_filter ( 'id_agente_modulo' ,
'tagente_modulo' ,
array ( 'id_agente_modulo' => $row [ 'id_agente_modulo' ],
'id_tipo_modulo' => $id_type_web_content_string ));
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
//Fixed the goliat sends the strings from web
//without HTML entities
if ( $is_web_content_string ) {
$row [ 'datos' ] = io_safe_input ( $row [ 'datos' ]);
}
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
//Fixed the data from Selenium Plugin
if ( $row [ 'datos' ] != strip_tags ( $row [ 'datos' ])) {
$row [ 'datos' ] = io_safe_input ( $row [ 'datos' ]);
}
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
$data = array ();
if ( $isFunctionPolicies !== ENTERPRISE_NOT_HOOK ) {
2018-07-26 12:41:09 +02:00
if ( is_metaconsole ()){
$node = metaconsole_get_connection_by_id ( $row [ 'server_id' ]);
if ( metaconsole_load_external_db ( $node ) !== NOERR ) {
// Restore the default connection.
metaconsole_restore_db ();
$errors ++ ;
break ;
}
}
2016-10-17 12:30:52 +02:00
$policyInfo = policies_info_module_policy ( $row [ 'id_agente_modulo' ]);
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
if ( $policyInfo === false )
$data [ 0 ] = '' ;
2010-10-06 14:24:21 +02:00
else {
2016-10-17 12:30:52 +02:00
$linked = policies_is_module_linked ( $row [ 'id_agente_modulo' ]);
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
$adopt = false ;
if ( policies_is_module_adopt ( $row [ 'id_agente_modulo' ])) {
$adopt = true ;
}
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
if ( $linked ) {
if ( $adopt ) {
$img = 'images/policies_brick.png' ;
$title = __ ( '(Adopt) ' ) . $policyInfo [ 'name_policy' ];
}
else {
$img = 'images/policies.png' ;
$title = $policyInfo [ 'name_policy' ];
}
2010-10-14 17:09:29 +02:00
}
else {
2016-10-17 12:30:52 +02:00
if ( $adopt ) {
$img = 'images/policies_not_brick.png' ;
$title = __ ( '(Unlinked) (Adopt) ' ) . $policyInfo [ 'name_policy' ];
}
else {
$img = 'images/unlinkpolicy.png' ;
$title = __ ( '(Unlinked) ' ) . $policyInfo [ 'name_policy' ];
}
2010-10-14 17:09:29 +02:00
}
2018-07-26 12:41:09 +02:00
if ( is_metaconsole ()){
$data [ 0 ] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo [ 'id_policy' ] . '">' .
html_print_image ( $img , true , array ( 'title' => $title )) .
'</a>' ;
}
else {
$data [ 0 ] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo [ 'id_policy' ] . '">' .
html_print_image ( $img , true , array ( 'title' => $title )) .
'</a>' ;
}
}
if ( is_metaconsole ()){
metaconsole_restore_db ();
2010-10-06 14:24:21 +02:00
}
}
2018-07-26 12:41:09 +02:00
2017-02-20 15:32:49 +01:00
$agent_alias = ! empty ( $row [ 'agent_alias' ]) ? $row [ 'agent_alias' ] : $row [ 'agent_name' ];
2018-07-26 12:41:09 +02:00
2016-10-17 12:30:52 +02:00
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
if ( defined ( 'METACONSOLE' )) {
$agent_link = '<a href="' .
$row [ 'server_url' ] . 'index.php?' .
'sec=estado&' .
'sec2=operation/agentes/ver_agente&' .
'id_agente=' . $row [ 'id_agent' ] . '&' .
'loginhash=auto&' .
'loginhash_data=' . $row [ 'hashdata' ] . '&' .
'loginhash_user=' . str_rot13 ( $row [ 'user' ]) . '">' ;
2017-02-20 15:32:49 +01:00
$agent_alias = ui_print_truncate_text ( $agent_alias ,
2016-10-17 12:30:52 +02:00
'agent_small' , false , true , false , '[…]' ,
'font-size:7.5pt;' );
if ( can_user_access_node ()) {
2017-02-20 15:32:49 +01:00
$data [ 1 ] = $agent_link . '<b>' . $agent_alias . '</b></a>' ;
2016-10-17 12:30:52 +02:00
}
else {
2017-02-20 15:32:49 +01:00
$data [ 1 ] = $agent_alias ;
2016-10-17 12:30:52 +02:00
}
2013-05-30 17:48:22 +02:00
}
else {
2016-10-17 12:30:52 +02:00
$data [ 1 ] = '<strong><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $row [ 'id_agent' ] . '">' ;
2017-02-20 15:32:49 +01:00
$data [ 1 ] .= ui_print_truncate_text ( $agent_alias , 'agent_medium' , false , true , false , '[…]' , 'font-size:7.5pt;' );
2016-10-17 12:30:52 +02:00
$data [ 1 ] .= '</a></strong>' ;
2013-05-30 17:48:22 +02:00
}
2017-02-20 15:32:49 +01:00
$data [ 2 ] = html_print_image ( 'images/' . modules_show_icon_type ( $row [ 'module_type' ]), true );
2018-08-17 14:57:50 +02:00
$agent_groups = is_metaconsole ()
? $row [ 'groups_in_server' ]
: agents_get_all_groups_agent ( $row [ 'id_agent' ], $row [ 'id_group' ]);
2018-08-08 11:49:54 +02:00
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $agent_groups , 'AW' )) {
2017-02-20 15:32:49 +01:00
$show_edit_icon = true ;
if ( defined ( 'METACONSOLE' )) {
if ( ! can_user_access_node ()) {
$show_edit_icon = false ;
}
2017-02-16 16:05:21 +01:00
2017-02-20 15:32:49 +01:00
$url_edit_module = $row [ 'server_url' ] . 'index.php?' .
'sec=gagente&' .
'sec2=godmode/agentes/configurar_agente&' .
'id_agente=' . $row [ 'id_agent' ] . '&' .
'tab=module&' .
'id_agent_module=' . $row [ 'id_agente_modulo' ] . '&' .
'edit_module=1' .
'&loginhash=auto&loginhash_data=' . $row [ 'hashdata' ] . '&loginhash_user=' . str_rot13 ( $row [ 'user' ]);
}
else {
$url_edit_module = 'index.php?' .
'sec=gagente&' .
'sec2=godmode/agentes/configurar_agente&' .
'id_agente=' . $row [ 'id_agent' ] . '&' .
'tab=module&' .
'id_agent_module=' . $row [ 'id_agente_modulo' ] . '&' .
'edit_module=1' ;
2014-09-25 16:55:48 +02:00
}
2016-10-17 12:30:52 +02:00
if ( $show_edit_icon ) {
$data [ 2 ] .= '<a href="' . $url_edit_module . '">' .
html_print_image ( 'images/config.png' , true ,
array ( 'alt' => '0' , 'border' => '' , 'title' => __ ( 'Edit' ))) .
'</a>' ;
}
2014-09-25 16:55:48 +02:00
}
2016-10-17 12:30:52 +02:00
$data [ 3 ] = ui_print_truncate_text ( $row [ 'module_name' ], 'agent_small' , false , true , true );
if ( $row [ 'extended_info' ] != '' ) {
$data [ 3 ] .= ui_print_help_tip ( $row [ 'extended_info' ], true , '/images/default_list.png' );
2014-09-25 16:55:48 +02:00
}
2016-10-17 12:30:52 +02:00
if ( $row [ 'tags' ] != '' ) {
$data [ 3 ] .= html_print_image ( '/images/tag_red.png' , true ,
array (
'title' => $row [ 'tags' ],
'style' => 'width: 20px; margin-left: 3px;' ));
2010-08-04 13:08:16 +02:00
}
2016-10-14 18:51:17 +02:00
$data [ 4 ] = servers_show_type ( $row [ 'id_modulo' ]);
$data [ 5 ] = ( $row [ 'module_interval' ] == 0 ) ?
human_time_description_raw ( $row [ 'agent_interval' ])
:
human_time_description_raw ( $row [ 'module_interval' ]);
2012-06-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_reporting.php,
include/functions_groups.php, include/functions_visual_map.php,
include/ajax/reporting.ajax.php, include/functions_config.php,
include/functions_ui.php, include/functions.php,
extensions/agents_modules.php, extensions/module_groups.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php,
operation/integria_incidents/incident.incident.php,
operation/integria_incidents/incident.php: a lot of fixes in
relation with entities and clean source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6537 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-06-13 17:29:00 +02:00
2016-10-14 18:51:17 +02:00
if ( $row [ 'utimestamp' ] == 0 && (( $row [ 'module_type' ] < 21 ||
$row [ 'module_type' ] > 23 ) && $row [ 'module_type' ] != 100 )) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_NO_DATA ,
__ ( 'NOT INIT' ), true );
}
elseif ( $row [ 'estado' ] == 0 ) {
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_OK ,
2016-10-20 10:47:12 +02:00
__ ( 'NORMAL' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_OK ,
__ ( 'NORMAL' ) . ': ' . $row [ 'datos' ], true );
}
2014-09-25 16:55:48 +02:00
}
2016-10-17 12:30:52 +02:00
elseif ( $row [ 'estado' ] == 1 ) {
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_CRITICAL ,
2016-10-20 10:47:12 +02:00
__ ( 'CRITICAL' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_CRITICAL ,
__ ( 'CRITICAL' ) . ': ' . $row [ 'datos' ], true );
}
2016-10-17 12:30:52 +02:00
}
elseif ( $row [ 'estado' ] == 2 ) {
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_WARNING ,
2016-10-20 10:47:12 +02:00
__ ( 'WARNING' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_WARNING ,
__ ( 'WARNING' ) . ': ' . $row [ 'datos' ], true );
}
2016-10-17 12:30:52 +02:00
}
else {
$last_status = modules_get_agentmodule_last_status (
$row [ 'id_agente_modulo' ]);
switch ( $last_status ) {
case 0 :
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
2016-10-20 10:47:12 +02:00
__ ( 'NORMAL' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
__ ( 'NORMAL' ) . ': ' . $row [ 'datos' ], true );
}
2016-10-17 12:30:52 +02:00
break ;
case 1 :
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
2016-10-20 10:47:12 +02:00
__ ( 'CRITICAL' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
__ ( 'CRITICAL' ) . ': ' . $row [ 'datos' ], true );
}
2016-10-17 12:30:52 +02:00
break ;
case 2 :
2016-10-19 09:10:17 +02:00
if ( is_numeric ( $row [ 'datos' ])) {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
2016-10-20 10:47:12 +02:00
__ ( 'WARNING' ) . ': ' . remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ])), true );
2016-10-19 09:10:17 +02:00
}
else {
$data [ 6 ] = ui_print_status_image ( STATUS_MODULE_UNKNOWN ,
__ ( 'UNKNOWN' ) . ' - ' . __ ( 'Last status' ) . " " .
__ ( 'WARNING' ) . ': ' . $row [ 'datos' ], true );
}
2016-10-17 12:30:52 +02:00
break ;
}
2015-03-23 20:05:07 +01:00
}
2016-10-17 12:30:52 +02:00
$data [ 7 ] = " " ;
2015-03-23 20:05:07 +01:00
2016-10-17 12:30:52 +02:00
$acl_graphs = false ;
2012-07-25 11:59:03 +02:00
2016-10-17 12:30:52 +02:00
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
if ( ! is_metaconsole ()) {
$acl_graphs = check_acl ( $config [ 'id_user' ], $row [ 'id_group' ], 'RR' );
}
else {
$acl_graphs = true ;
2015-03-23 20:05:07 +01:00
}
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
if ( $row [ 'history_data' ] == 1 && $acl_graphs ) {
$graph_type = return_graphtype ( $row [ 'module_type' ]);
$url = ui_get_full_url ( 'operation/agentes/stat_win.php' , false , false , false );
$handle = dechex ( crc32 ( $row [ 'id_agente_modulo' ] . $row [ 'module_name' ]));
$win_handle = 'day_' . $handle ;
$graph_params = array (
'type' => $graph_type ,
'period' => SECONDS_1DAY ,
'id' => $row [ 'id_agente_modulo' ],
'label' => base64_encode ( $row [ 'module_name' ]),
'refresh' => SECONDS_10MINUTES
);
if ( is_metaconsole () && isset ( $row [ 'server_id' ])) {
// Set the server id
$graph_params [ 'server' ] = $row [ 'server_id' ];
}
$graph_params_str = http_build_query ( $graph_params );
$link = 'winopeng(\'' . $url . '?' . $graph_params_str . '\',\'' . $win_handle . '\')' ;
2018-05-07 12:53:12 +02:00
$data [ 7 ] = get_module_realtime_link_graph ( $row );
2016-10-26 18:39:41 +02:00
if ( ! is_snapshot_data ( $row [ 'datos' ])){
2018-05-07 12:53:12 +02:00
$data [ 7 ] .= '<a href="javascript:' . $link . '">' . html_print_image ( 'images/chart_curve.png' , true , array ( 'border' => '0' , 'alt' => '' )) . '</a>' ;
2016-10-26 18:39:41 +02:00
}
2016-10-17 12:30:52 +02:00
$data [ 7 ] .= '<a href="javascript: ' .
'show_module_detail_dialog(' .
$row [ 'id_agente_modulo' ] . ', ' .
$row [ 'id_agent' ] . ', \'' .
$row [ 'server_name' ] . '\', 0, ' . SECONDS_1DAY . ', \'' . $row [ 'module_name' ] . '\')">' .
html_print_image ( 'images/binary.png' , true ,
array ( 'border' => '0' , 'alt' => '' )) . '</a>' ;
$data [ 7 ] .= '<span id=\'hidden_name_module_' . $row [ 'id_agente_modulo' ] . ' \ '
style = \ 'display: none;\'>' .
$row [ 'module_name' ] .
'</span>' ;
}
2012-11-29 18:34:51 +01:00
2016-10-17 12:30:52 +02:00
$data [ 8 ] = ui_print_module_warn_value ( $row [ 'max_warning' ],
$row [ 'min_warning' ], $row [ 'str_warning' ], $row [ 'max_critical' ],
$row [ 'min_critical' ], $row [ 'str_critical' ]);
if ( is_numeric ( $row [ 'datos' ]) && ! modules_is_string_type ( $row [ 'module_type' ])) {
if ( $config [ 'render_proc' ] ) {
switch ( $row [ 'module_type' ]) {
case 2 :
case 6 :
case 9 :
case 18 :
case 21 :
case 31 :
if ( $row [ 'datos' ] >= 1 )
$salida = $config [ 'render_proc_ok' ];
else
$salida = $config [ 'render_proc_fail' ];
break ;
default :
2016-11-08 12:39:28 +01:00
switch ( $row [ 'module_type' ]) {
case 15 :
$value = db_get_value ( 'snmp_oid' , 'tagente_modulo' , 'id_agente_modulo' , $row [ 'id_agente_modulo' ]);
if ( $value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0' )
$salida = human_milliseconds_to_string ( $row [ 'datos' ]);
else
$salida = remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ]));
break ;
default :
$salida = remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ]));
break ;
}
2016-10-17 12:30:52 +02:00
break ;
}
}
else {
2016-08-24 15:31:28 +02:00
switch ( $row [ 'module_type' ]) {
2016-11-08 12:39:28 +01:00
case 15 :
$value = db_get_value ( 'snmp_oid' , 'tagente_modulo' , 'id_agente_modulo' , $row [ 'id_agente_modulo' ]);
if ( $value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0' )
$salida = human_milliseconds_to_string ( $row [ 'datos' ]);
2015-05-04 15:44:37 +02:00
else
2016-11-08 12:39:28 +01:00
$salida = remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ]));
2015-05-04 15:44:37 +02:00
break ;
2016-01-18 16:58:24 +01:00
default :
2016-11-08 12:39:28 +01:00
$salida = remove_right_zeros ( number_format ( $row [ 'datos' ], $config [ 'graph_precision' ]));
2015-05-04 15:44:37 +02:00
break ;
}
2016-10-17 12:30:52 +02:00
}
// Show units ONLY in numeric data types
if ( isset ( $row [ 'unit' ])) {
2017-09-14 12:10:41 +02:00
$data_macro = modules_get_unit_macro ( $row [ 'datos' ], $row [ 'unit' ]);
if ( $data_macro ) {
$salida = $data_macro ;
} else {
$salida .= ' ' . '<i>' . io_safe_output ( $row [ 'unit' ]) . '</i>' ;
2018-01-08 10:57:30 +01:00
if ( strlen ( $salida ) > $config [ 'agent_size_text_small' ]) {
$salida = ui_print_truncate_text ( $salida , 'agent_small' , true , true , false , '[…]' , 'font-size:7.5pt;' );
//clean tag <i>
$text_aux = explode ( '<a' , $salida );
$match = preg_replace ( '/(<i>|<\/i>|<i|<\/i|i>|\/i>|<|>)/' , " " , $text_aux [ 0 ]);
$salida = $match . '<a' . $text_aux [ 1 ];
} else {
$salida = ui_print_truncate_text ( $salida , 'agent_small' , true , true , false , '[…]' , 'font-size:7.5pt;' );
}
2017-09-14 12:10:41 +02:00
}
2016-10-17 12:30:52 +02:00
}
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ( $is_web_content_string ) {
$module_value = $row [ 'datos' ];
}
else {
$module_value = io_safe_output ( $row [ 'datos' ]);
}
2018-05-07 19:40:38 +02:00
2016-10-17 12:30:52 +02:00
$is_snapshot = is_snapshot_data ( $module_value );
2018-05-07 19:40:38 +02:00
$is_large_image = is_text_to_black_string ( $module_value );
if (( $config [ 'command_snapshot' ]) && ( $is_snapshot || $is_large_image )) {
2018-03-12 15:17:59 +01:00
$link = ui_get_snapshot_link ( array (
'id_module' => $row [ 'id_agente_modulo' ],
'interval' => $row [ 'current_interval' ],
2018-08-02 13:42:39 +02:00
'module_name' => $row [ 'module_name' ],
'id_node' => $row [ 'server_id' ]
2018-03-12 15:17:59 +01:00
));
2018-08-02 13:02:33 +02:00
$salida = ui_get_snapshot_image ( $link , $is_snapshot ) . ' ' ;
} else {
2016-10-17 12:30:52 +02:00
$sub_string = substr ( io_safe_output ( $row [ 'datos' ]), 0 , 12 );
if ( $module_value == $sub_string ) {
if ( $module_value == 0 && ! $sub_string ) {
$salida = 0 ;
}
else {
2017-09-14 12:10:41 +02:00
$data_macro = modules_get_unit_macro ( $row [ 'datos' ], $row [ 'unit' ]);
if ( $data_macro ) {
$salida = $data_macro ;
} else {
$salida = $row [ 'datos' ];
}
2016-10-17 12:30:52 +02:00
}
2015-05-04 15:44:37 +02:00
}
2016-10-17 12:30:52 +02:00
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ( $is_web_content_string ) {
$sub_string = substr ( $row [ 'datos' ], 0 , 12 );
}
else {
//Fixed the data from Selenium Plugin
if ( $module_value != strip_tags ( $module_value )) {
$module_value = io_safe_input ( $module_value );
$sub_string = substr ( $row [ 'datos' ], 0 , 12 );
}
else {
$sub_string = substr ( io_safe_output ( $row [ 'datos' ]), 0 , 12 );
}
}
if ( $module_value == $sub_string ) {
$salida = $module_value ;
}
else {
$salida = " <span " .
" id='hidden_value_module_ " . $row [ 'id_agente_modulo' ] . " '
style = 'display: none;' > " .
$module_value .
" </span> " .
" <span " .
" id='value_module_ " . $row [ 'id_agente_modulo' ] . " '
title = '" . $module_value . "' " .
" style='white-space: nowrap;'> " .
'<span id="value_module_text_' . $row [ 'id_agente_modulo' ] . '">' .
$sub_string . '</span> ' .
" <a href='javascript: toggle_full_value( " . $row [ 'id_agente_modulo' ] . " )'> " .
html_print_image ( 'images/rosette.png' , true ) . '</a></span>' ;
}
}
}
2015-06-08 09:32:01 +02:00
}
2016-10-17 12:30:52 +02:00
$data [ 9 ] = $salida ;
if ( $row [ 'module_interval' ] > 0 )
$interval = $row [ 'module_interval' ];
2016-08-24 15:31:28 +02:00
else
2016-10-17 12:30:52 +02:00
$interval = $row [ 'agent_interval' ];
2012-07-25 11:59:03 +02:00
2016-10-17 12:30:52 +02:00
if ( $row [ 'estado' ] == 3 ) {
$option = array ( 'html_attr' => 'class="redb"' , 'style' => 'font-size:7pt;' );
2012-04-19 20:48:35 +02:00
}
2016-10-17 12:30:52 +02:00
else {
$option = array ( 'style' => 'font-size:7pt;' );
}
$data [ 10 ] = ui_print_timestamp ( $row [ 'utimestamp' ], true , $option );
array_push ( $table -> data , $data );
2012-04-19 20:48:35 +02:00
}
2008-10-29 21:03:42 +01:00
2011-04-27 15:43:31 +02:00
html_print_table ( $table );
2012-07-25 11:59:03 +02:00
}
2016-10-17 12:30:52 +02:00
else
2015-04-23 17:52:16 +02:00
ui_print_info_message ( array ( 'no_close' => true , 'message' => __ ( 'This group doesn\'t have any monitor' ) ) );
2016-10-17 12:30:52 +02:00
// End Build List Result
/////////////////////////////////////
2013-05-20 10:42:02 +02:00
2016-10-17 12:30:52 +02:00
echo " <div id='monitor_details_window'></div> " ;
2015-01-15 18:08:58 +01:00
//strict user hidden
echo '<div id="strict_hidden" style="display:none;">' ;
html_print_input_text ( 'strict_user_hidden' , $strict_user );
echo '</div>' ;
2013-05-20 10:42:02 +02:00
enterprise_hook ( 'close_meta_frame' );
2013-03-15 13:06:49 +01:00
ui_require_javascript_file ( 'pandora_modules' );
2007-07-28 20:11:48 +02:00
?>
2016-10-17 12:30:52 +02:00
< script type = 'text/javascript' >
2015-01-15 18:08:58 +01:00
$ ( document ) . ready ( function () {
if ( $ ( '#ag_group' ) . val () != 0 ) {
2016-10-17 12:30:52 +02:00
$ ( '#tag_filter' ) . css ( 'display' , 'none' );
$ ( '#tag_td' ) . css ( 'display' , 'none' );
2015-01-15 18:08:58 +01:00
}
2016-10-14 18:51:17 +02:00
});
$ ( '#moduletype' ) . click ( function (){
jQuery . get ( " ajax.php " ,
{
" page " : " general/subselect_data_module " ,
" module " : $ ( '#moduletype' ) . val ()},
function ( data , status ){
$ ( " #datatypetittle " ) . show ();
$ ( " #datatypebox " ) . hide ()
. empty ()
. append ( data )
. show ();
},
" html "
);
return false ;
});
2015-01-15 18:08:58 +01:00
2015-06-08 11:05:19 +02:00
$ ( '#ag_group' ) . change ( function () {
2016-10-17 12:30:52 +02:00
strict_user = $ ( '#text-strict_user_hidden' ) . val ();
2015-06-08 11:05:19 +02:00
2016-10-17 12:30:52 +02:00
if (( $ ( '#ag_group' ) . val () != 0 ) && ( strict_user != 0 )) {
$ ( '#tag_filter' ) . css ( 'display' , 'none' );
$ ( '#tag_td' ) . css ( 'display' , 'none' );
2015-01-15 18:08:58 +01:00
} else {
2016-10-17 12:30:52 +02:00
$ ( '#tag_filter' ) . css ( 'display' , '' );
$ ( '#tag_td' ) . css ( 'display' , '' );
2015-01-15 18:08:58 +01:00
}
});
2015-02-18 18:29:39 +01:00
2016-10-17 12:30:52 +02:00
function toggle_full_value ( id ) {
text = $ ( '#hidden_value_module_' + id ) . html ();
old_text = $ ( " #value_module_text_ " + id ) . html ();
$ ( " #hidden_value_module_ " + id ) . html ( old_text );
$ ( " #value_module_text_ " + id ) . html ( text );
}
2013-03-15 13:06:49 +01:00
// Show the modal window of an module
2015-04-20 10:40:42 +02:00
function show_module_detail_dialog ( module_id , id_agent , server_name , offset , period , module_name ) {
2013-03-15 13:06:49 +01:00
if ( period == - 1 ) {
2015-02-18 18:29:39 +01:00
if ( $ ( " #period " ) . length == 1 ) {
period = $ ( '#period' ) . val ();
}
else {
period = < ? php echo SECONDS_1DAY ; ?> ;
}
2013-03-15 13:06:49 +01:00
}
2016-11-04 16:05:33 +01:00
2016-10-26 18:39:41 +02:00
if ( $ ( 'input[name=selection_mode]:checked' ) . val ()) {
2016-11-04 16:05:33 +01:00
2016-10-26 18:39:41 +02:00
var selection_mode = $ ( 'input[name=selection_mode]:checked' ) . val ();
var date_from = $ ( '#text-date_from' ) . val ();
var time_from = $ ( '#text-time_from' ) . val ();
var date_to = $ ( '#text-date_to' ) . val ();
var time_to = $ ( '#text-time_to' ) . val ();
2016-11-04 16:05:33 +01:00
var extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to ;
2016-10-26 18:39:41 +02:00
}
2015-04-20 10:40:42 +02:00
title = < ? php echo " \" " . __ ( " Module: " ) . " \" " ?> ;
2013-03-15 13:06:49 +01:00
$ . ajax ({
type : " POST " ,
url : " <?php echo ui_get_full_url('ajax.php', false, false, false); ?> " ,
2016-11-04 16:05:33 +01:00
data : " page=include/ajax/module&get_module_detail=1&server_name= " + server_name + " &id_agent= " + id_agent + " &id_module= " + module_id + " &offset= " + offset + " &period= " + period + extra_parameters ,
2013-03-15 13:06:49 +01:00
dataType : " html " ,
2013-03-26 18:15:49 +01:00
success : function ( data ) {
2013-03-15 13:06:49 +01:00
$ ( " #monitor_details_window " ) . hide ()
. empty ()
. append ( data )
. dialog ({
resizable : true ,
draggable : true ,
modal : true ,
2015-04-20 10:40:42 +02:00
title : title + module_name ,
2013-03-15 13:06:49 +01:00
overlay : {
opacity : 0.5 ,
background : " black "
},
width : 620 ,
height : 500
})
. show ();
2013-03-26 18:15:49 +01:00
2015-04-20 10:40:42 +02:00
refresh_pagination_callback ( module_id , id_agent , server_name , module_name );
2013-03-15 13:06:49 +01:00
}
});
}
2015-04-20 10:40:42 +02:00
function refresh_pagination_callback ( module_id , id_agent , server_name , module_name ) {
2014-09-25 16:55:48 +02:00
2014-04-23 09:57:40 +02:00
$ ( " .binary_dialog " ) . click ( function () {
2013-03-15 13:06:49 +01:00
var classes = $ ( this ) . attr ( 'class' );
classes = classes . split ( ' ' );
2014-04-23 09:57:40 +02:00
var offset_class = classes [ 2 ];
2013-03-15 13:06:49 +01:00
offset_class = offset_class . split ( '_' );
var offset = offset_class [ 1 ];
2014-09-25 16:55:48 +02:00
2013-03-15 13:06:49 +01:00
var period = $ ( '#period' ) . val ();
2015-04-20 10:40:42 +02:00
show_module_detail_dialog ( module_id , id_agent , server_name , offset , period , module_name );
2013-03-26 18:15:49 +01:00
2013-03-15 13:06:49 +01:00
return false ;
});
}
2017-02-20 15:32:49 +01:00
</ script >