2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
2006-07-19 20:29:12 +02:00
|
|
|
|
2009-06-08 20:21:21 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2010-07-23 12:04:12 +02:00
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-06-08 20:21:21 +02:00
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2006-06-29 21:31:53 +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-06-29 21:31:53 +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-07-19 20:29:12 +02:00
|
|
|
// Load global vars
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
|
|
|
|
|
|
|
if (! check_acl($config['id_user'], 0, 'AW')) {
|
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to access Agent Config Management Admin section'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_agents.php';
|
|
|
|
require_once 'include/functions_alerts.php';
|
|
|
|
require_once 'include/functions_modules.php';
|
|
|
|
require_once 'include/functions_users.php';
|
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$source_id_group = (int) get_parameter('source_id_group');
|
|
|
|
$source_id_agent = (int) get_parameter('source_id_agent');
|
|
|
|
$destiny_id_group = (int) get_parameter('destiny_id_group');
|
|
|
|
$destiny_id_agents = (array) get_parameter('destiny_id_agent', []);
|
|
|
|
$source_recursion = get_parameter('source_recursion');
|
|
|
|
$destiny_recursion = get_parameter('destiny_recursion');
|
2008-10-14 17:07:53 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$do_operation = (bool) get_parameter('do_operation');
|
2008-10-14 17:07:53 +02:00
|
|
|
|
2015-02-04 11:18:34 +01:00
|
|
|
|
|
|
|
|
2009-02-16 13:18:42 +01:00
|
|
|
if ($do_operation) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$result = agents_process_manage_config(
|
|
|
|
$source_id_agent,
|
|
|
|
$destiny_id_agents
|
|
|
|
);
|
|
|
|
|
|
|
|
$info = [
|
|
|
|
'Source agent' => $source_id_agent,
|
|
|
|
'Destinity agent' => implode(',', $destiny_id_agents),
|
|
|
|
];
|
|
|
|
if ($result) {
|
|
|
|
db_pandora_audit(
|
|
|
|
'Massive management',
|
|
|
|
'Copy modules',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
json_encode($info)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
db_pandora_audit(
|
|
|
|
'Massive management',
|
|
|
|
'Fail to try copy modules',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
json_encode($info)
|
|
|
|
);
|
|
|
|
}
|
2008-10-14 17:07:53 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$groups = users_get_groups();
|
2009-02-16 13:18:42 +01:00
|
|
|
|
2015-06-15 15:50:28 +02:00
|
|
|
$table->class = 'databox filters';
|
|
|
|
$table->width = '100%';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data = [];
|
|
|
|
$table->style = [];
|
2015-06-15 15:50:28 +02:00
|
|
|
$table->style[0] = 'font-weight: bold;';
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->style[2] = 'font-weight: bold';
|
2014-03-25 13:39:26 +01:00
|
|
|
$table->style[4] = 'font-weight: bold';
|
|
|
|
$table->style[6] = 'font-weight: bold';
|
2009-02-16 13:18:42 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Source selection
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->id = 'source_table';
|
|
|
|
$table->data[0][0] = __('Group');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][1] = html_print_select_groups(
|
|
|
|
false,
|
|
|
|
'AW',
|
|
|
|
true,
|
|
|
|
'source_id_group',
|
|
|
|
$source_id_group,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
true
|
|
|
|
);
|
2011-08-25 09:06:33 +02:00
|
|
|
$table->data[0][2] = __('Group recursion');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][3] = html_print_checkbox('source_recursion', 1, $source_recursion, true, false);
|
|
|
|
$status_list = [];
|
2015-06-08 13:13:09 +02:00
|
|
|
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
|
2014-03-25 13:39:26 +01:00
|
|
|
$status_list[AGENT_STATUS_WARNING] = __('Warning');
|
|
|
|
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
|
|
|
|
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
2015-06-08 13:13:09 +02:00
|
|
|
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
|
2014-03-25 13:39:26 +01:00
|
|
|
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
|
|
|
|
$table->data[0][4] = __('Status');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][5] = html_print_select(
|
|
|
|
$status_list,
|
|
|
|
'status_agents_source',
|
|
|
|
'selected',
|
|
|
|
'',
|
|
|
|
__('All'),
|
|
|
|
AGENT_STATUS_ALL,
|
|
|
|
true
|
|
|
|
);
|
2014-03-25 13:39:26 +01:00
|
|
|
$table->data[0][6] = __('Agent');
|
|
|
|
$table->data[0][6] .= ' <span id="source_agent_loading" class="invisible">';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][6] .= html_print_image('images/spinner.png', true);
|
2014-03-25 13:39:26 +01:00
|
|
|
$table->data[0][6] .= '</span>';
|
2014-06-06 12:59:24 +02:00
|
|
|
// $table->data[0][7] = html_print_select (agents_get_group_agents ($source_id_group, false, "none"),
|
2019-01-30 16:18:44 +01:00
|
|
|
// 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
|
|
|
|
$agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
|
|
|
|
$table->data[0][7] = html_print_select($agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
|
|
|
|
|
|
|
|
echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive_operations&'.'option=copy_modules" '.'id="manage_config_form" '.'method="post">';
|
2009-02-16 13:18:42 +01:00
|
|
|
|
|
|
|
echo '<fieldset id="fieldset_source">';
|
2015-02-04 11:18:34 +01:00
|
|
|
echo '<legend>';
|
2019-05-24 14:26:28 +02:00
|
|
|
echo '<span>'.__('Source');
|
2015-02-04 11:18:34 +01:00
|
|
|
echo '</legend>';
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_table($table);
|
2009-02-16 13:18:42 +01:00
|
|
|
echo '</fieldset>';
|
2008-10-14 17:07:53 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Target selection
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->id = 'target_table';
|
2015-06-15 15:50:28 +02:00
|
|
|
$table->class = 'databox filters';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data = [];
|
2008-10-14 17:07:53 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$modules = [];
|
|
|
|
if ($source_id_agent) {
|
|
|
|
$modules = agents_get_modules($source_id_agent, 'nombre');
|
|
|
|
}
|
2009-02-16 13:18:42 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$agent_alerts = [];
|
|
|
|
if ($source_id_agent) {
|
|
|
|
$agent_alerts = agents_get_alerts_simple($source_id_agent);
|
|
|
|
}
|
|
|
|
|
|
|
|
$alerts = [];
|
2014-06-16 19:22:56 +02:00
|
|
|
foreach ($agent_alerts as $alert) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$name = alerts_get_alert_template_name($alert['id_alert_template']);
|
|
|
|
$name .= ' (<em>'.$modules[$alert['id_agent_module']].'</em>)';
|
|
|
|
$alerts[$alert['id']] = $name;
|
2014-06-16 19:22:56 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:11:27 +02:00
|
|
|
$tags = tags_get_user_tags();
|
|
|
|
$table->data['tags'][0] = __('Tags');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data['tags'][1] = html_print_select(
|
|
|
|
$tags,
|
|
|
|
'tags[]',
|
|
|
|
$tags_name,
|
|
|
|
false,
|
|
|
|
__('Any'),
|
|
|
|
-1,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
2017-05-17 11:11:27 +02:00
|
|
|
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data['operations'][0] = __('Operations');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data['operations'][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
|
|
|
|
$table->data['operations'][1] .= html_print_checkbox('copy_modules', 1, true, true);
|
|
|
|
$table->data['operations'][1] .= html_print_label(__('Copy modules'), 'checkbox-copy_modules', true);
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data['operations'][1] .= '</span><br />';
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data['operations'][1] .= '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
|
|
|
|
$table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, true);
|
|
|
|
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data['operations'][1] .= '</span>';
|
|
|
|
|
2019-06-20 09:31:36 +02:00
|
|
|
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
|
|
|
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
|
|
|
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[1][0] = __('Modules');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
|
|
|
|
$table->data[1][1] .= html_print_select(
|
|
|
|
$modules,
|
|
|
|
'target_modules[]',
|
|
|
|
0,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[1][1] .= '</span>';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[1][1] .= '<span class="without_modules'.(! empty($modules) ? ' invisible' : '').'">';
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
|
|
|
|
$table->data[1][1] .= '</span>';
|
|
|
|
|
|
|
|
$table->data[2][0] = __('Alerts');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][1] = '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
|
|
|
|
$table->data[2][1] .= html_print_select(
|
|
|
|
$alerts,
|
|
|
|
'target_alerts[]',
|
|
|
|
0,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[2][1] .= '</span>';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][1] .= '<span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'">';
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
|
|
|
|
$table->data[2][1] .= '</span>';
|
|
|
|
|
|
|
|
echo '<div id="modules_loading" class="loading invisible">';
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_image('images/spinner.png');
|
2009-02-16 13:18:42 +01:00
|
|
|
echo __('Loading').'…';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '<fieldset id="fieldset_targets"'.($source_id_agent ? '' : ' class="invisible"').'>';
|
|
|
|
echo '<legend><span>'.__('Targets').'</span></legend>';
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_table($table);
|
2009-02-16 13:18:42 +01:00
|
|
|
echo '</fieldset>';
|
|
|
|
|
2014-03-25 13:39:26 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// Destiny selection
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->id = 'destiny_table';
|
2015-06-15 15:50:28 +02:00
|
|
|
$table->class = 'databox filters';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data = [];
|
2011-08-25 09:06:33 +02:00
|
|
|
$table->size[0] = '20%';
|
|
|
|
$table->size[1] = '30%';
|
|
|
|
$table->size[2] = '20%';
|
|
|
|
$table->size[3] = '30%';
|
2015-02-04 11:18:34 +01:00
|
|
|
|
2009-02-16 13:18:42 +01:00
|
|
|
$table->data[0][0] = __('Group');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][1] = html_print_select_groups(
|
|
|
|
false,
|
|
|
|
'AW',
|
|
|
|
true,
|
|
|
|
'destiny_id_group',
|
|
|
|
$destiny_id_group,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
true
|
|
|
|
);
|
2011-08-25 09:06:33 +02:00
|
|
|
$table->data[0][2] = __('Group recursion');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[0][3] = html_print_checkbox(
|
|
|
|
'destiny_recursion',
|
|
|
|
1,
|
|
|
|
$destiny_recursion,
|
|
|
|
true,
|
|
|
|
false
|
|
|
|
);
|
|
|
|
|
|
|
|
$status_list = [];
|
2015-06-08 13:13:09 +02:00
|
|
|
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
|
2014-03-25 13:39:26 +01:00
|
|
|
$status_list[AGENT_STATUS_WARNING] = __('Warning');
|
|
|
|
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
|
|
|
|
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
2015-06-08 13:13:09 +02:00
|
|
|
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
|
2014-03-25 13:39:26 +01:00
|
|
|
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
|
|
|
|
$table->data[1][0] = __('Status');
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[1][1] = html_print_select(
|
|
|
|
$status_list,
|
|
|
|
'status_agents_destiny',
|
|
|
|
'selected',
|
|
|
|
'',
|
|
|
|
__('All'),
|
|
|
|
AGENT_STATUS_ALL,
|
|
|
|
true
|
|
|
|
);
|
2015-02-04 11:18:34 +01:00
|
|
|
|
2019-07-10 16:37:24 +02:00
|
|
|
$table->data['form_agents_filter'][0] = __('Filter Agents');
|
|
|
|
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
|
|
|
|
|
2014-03-25 13:39:26 +01:00
|
|
|
$table->data[2][0] = __('Agent');
|
|
|
|
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][0] .= html_print_image('images/spinner.png', true);
|
2014-03-25 13:39:26 +01:00
|
|
|
$table->data[2][0] .= '</span>';
|
2014-06-16 19:22:56 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$agents = [];
|
2014-06-16 19:22:56 +02:00
|
|
|
if ($source_id_agent) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
|
|
|
|
unset($agents[$source_id_agent]);
|
2014-06-16 19:22:56 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->data[2][1] = html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true);
|
2009-02-16 13:18:42 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>';
|
|
|
|
echo '<legend><span>'.__('To agent(s)').'</span></legend>';
|
|
|
|
html_print_table($table);
|
2009-02-16 13:18:42 +01:00
|
|
|
echo '</fieldset>';
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
2015-02-04 11:18:34 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
html_print_input_hidden('do_operation', 1);
|
|
|
|
html_print_submit_button(__('Copy'), 'go', false, 'class="sub wand"');
|
2009-02-16 13:18:42 +01:00
|
|
|
echo '</div>';
|
|
|
|
echo '</form>';
|
|
|
|
|
2014-03-25 13:39:26 +01:00
|
|
|
|
|
|
|
|
2009-02-24 17:31:02 +01:00
|
|
|
echo '<h3 class="error invisible" id="message"> </h3>';
|
2009-02-16 13:18:42 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_require_jquery_file('form');
|
|
|
|
ui_require_jquery_file('pandora.controls');
|
2009-02-16 13:18:42 +01:00
|
|
|
?>
|
2019-06-20 09:31:36 +02:00
|
|
|
|
|
|
|
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
2009-02-16 13:18:42 +01:00
|
|
|
<script type="text/javascript">
|
2009-02-24 17:31:02 +01:00
|
|
|
/* <![CDATA[ */
|
2009-03-17 10:22:02 +01:00
|
|
|
var module_alerts;
|
2015-02-04 11:18:34 +01:00
|
|
|
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
|
|
|
|
|
|
|
|
2009-02-16 13:18:42 +01:00
|
|
|
$(document).ready (function () {
|
2019-01-30 16:18:44 +01:00
|
|
|
var source_recursion;
|
|
|
|
$("#checkbox-source_recursion").click(function () {
|
|
|
|
source_recursion = this.checked ? 1 : 0;
|
|
|
|
$("#source_id_group").trigger("change");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#source_id_group").pandoraSelectGroupAgent ({
|
|
|
|
agentSelect: "select#source_id_agent",
|
|
|
|
privilege: "AW",
|
|
|
|
recursion: function() {
|
|
|
|
return source_recursion
|
|
|
|
},
|
|
|
|
status_agents: function () {
|
|
|
|
return $("#status_agents_source").val();
|
|
|
|
},
|
|
|
|
loading: "#source_agent_loading"
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#status_agents_source").change(function() {
|
|
|
|
$("#source_id_group").trigger("change");
|
|
|
|
});
|
|
|
|
|
|
|
|
var destiny_recursion;
|
|
|
|
$("#checkbox-destiny_recursion").click(function () {
|
|
|
|
destiny_recursion = this.checked ? 1 : 0;
|
|
|
|
$("#destiny_id_group").trigger("change");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#destiny_id_group").pandoraSelectGroupAgent ({
|
|
|
|
agentSelect: "select#destiny_id_agent",
|
|
|
|
privilege: "AW",
|
|
|
|
recursion: function() {return destiny_recursion},
|
|
|
|
status_agents: function () {
|
|
|
|
return $("#status_agents_destiny").val();
|
|
|
|
},
|
|
|
|
loading: "#destiny_agent_loading",
|
|
|
|
callbackPost: function (id, value, option) {
|
|
|
|
/* Hide source agent */
|
|
|
|
var selected_agent = $("#source_id_agent").val();
|
|
|
|
$("#destiny_id_agent option[value='" + selected_agent + "']").remove();
|
2019-07-10 16:37:24 +02:00
|
|
|
},
|
|
|
|
callbackAfter:function() {
|
|
|
|
//Filter agents. Call the function when the select is fully loaded.
|
|
|
|
var textNoData = "<?php echo __('None'); ?>";
|
|
|
|
filterByText($('#destiny_id_agent'), $("#text-filter_agents"), textNoData);
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#tags").change(function() {
|
|
|
|
$("#source_id_agent").trigger("change");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#status_agents_destiny").change(function() {
|
|
|
|
$("#destiny_id_group").trigger("change");
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#source_id_agent").change (function () {
|
|
|
|
var id_agent = $("#source_id_agent").val();
|
|
|
|
if (id_agent == 0) {
|
|
|
|
$("#submit-go").attr("disabled", "disabled");
|
|
|
|
|
|
|
|
$("span.without_modules, span.without_alerts").hide();
|
|
|
|
$("span.without_modules").hide();
|
|
|
|
$("span.with_modules").hide();
|
|
|
|
$("span.without_alerts").hide();
|
|
|
|
$("span.with_alerts").hide();
|
|
|
|
$("#fieldset_destiny, #target_table-operations").hide();
|
|
|
|
$("#fieldset_targets").hide();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var params = {
|
|
|
|
"page" : "operation/agentes/ver_agente",
|
|
|
|
"get_agent_modules_json" : 1,
|
|
|
|
"get_id_and_name" : 1,
|
|
|
|
"disabled" : 0,
|
|
|
|
"id_agent" : id_agent
|
|
|
|
};
|
|
|
|
|
|
|
|
var tags_to_search = $('#tags').val();
|
|
|
|
if (tags_to_search != null) {
|
|
|
|
if (tags_to_search[0] != -1) {
|
|
|
|
params['tags'] = tags_to_search;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#submit-go").attr("disabled", false);
|
|
|
|
|
|
|
|
$("#modules_loading").show ();
|
|
|
|
$("#target_modules option, #target_alerts option").remove ();
|
|
|
|
$("#target_modules, #target_alerts").disable ();
|
|
|
|
$("#destiny_id_agent option").show ();
|
|
|
|
$("#destiny_id_agent option[value="+id_agent+"]").hide ();
|
|
|
|
var no_modules;
|
|
|
|
var no_alerts;
|
|
|
|
/* Get modules */
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
params,
|
|
|
|
function (data, status) {
|
|
|
|
if (data.length == 0) {
|
|
|
|
no_modules = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
option = $("<option></option>")
|
|
|
|
.attr ("value", val["id_agente_modulo"])
|
|
|
|
.append (val["nombre"]);
|
|
|
|
$("#target_modules").append (option);
|
|
|
|
});
|
|
|
|
|
|
|
|
no_modules = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get alerts */
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "include/ajax/alert_list.ajax",
|
|
|
|
"get_agent_alerts_simple" : 1,
|
|
|
|
"id_agent" : id_agent
|
|
|
|
},
|
|
|
|
function (data, status) {
|
|
|
|
module_alerts = Array ();
|
|
|
|
if (! data) {
|
|
|
|
no_alerts = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
jQuery.each (data, function (i, val) {
|
|
|
|
module_name = $("<em></em>").append (val["module_name"]);
|
|
|
|
option = $("<option></option>")
|
|
|
|
.attr ("value", val["id"])
|
|
|
|
.append (val["template"]["name"])
|
|
|
|
.append (" (")
|
|
|
|
.append (module_name)
|
|
|
|
.append (")");
|
|
|
|
$("#target_alerts").append (option);
|
|
|
|
module_alerts[val["id"]] = val["id_agent_module"];
|
|
|
|
});
|
|
|
|
no_alerts = false;
|
|
|
|
}
|
|
|
|
$("#modules_loading").hide ();
|
|
|
|
|
|
|
|
if (no_modules && no_alerts) {
|
|
|
|
/* Nothing to export from selected agent */
|
|
|
|
$("#fieldset_destiny").hide ();
|
|
|
|
|
|
|
|
$("span.without_modules, span.without_alerts").show ();
|
2019-07-10 16:37:24 +02:00
|
|
|
$("span.with_modules, span.with_alerts, #target_table-operations, #target_table-form_modules_filter").hide ();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (no_modules) {
|
|
|
|
$("span.without_modules").show ();
|
|
|
|
$("span.with_modules").hide ();
|
|
|
|
$("#checkbox-copy_modules").uncheck ();
|
2019-07-10 16:37:24 +02:00
|
|
|
$("#target_table-form_modules_filter").hide ();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("span.without_modules").hide ();
|
|
|
|
$("span.with_modules").show ();
|
|
|
|
$("#checkbox-copy_modules").check ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (no_alerts) {
|
|
|
|
$("span.without_alerts").show ();
|
|
|
|
$("span.with_alerts").hide ();
|
|
|
|
$("#checkbox-copy_alerts").uncheck ();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("span.without_alerts").hide ();
|
|
|
|
$("span.with_alerts").show ();
|
|
|
|
$("#checkbox-copy_alerts").check ();
|
|
|
|
}
|
2019-07-10 16:37:24 +02:00
|
|
|
$("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
$("#fieldset_targets").show ();
|
|
|
|
$("#target_modules, #target_alerts").enable ();
|
2019-06-20 09:31:36 +02:00
|
|
|
//Filter modules. Call the function when the select is fully loaded.
|
|
|
|
var textNoData = "<?php echo __('None'); ?>";
|
|
|
|
filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
|
2019-01-30 16:18:44 +01:00
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
// Refresh selectable agents to delete the selected one
|
|
|
|
$("#destiny_id_group").trigger("change");
|
|
|
|
},
|
|
|
|
"json"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#target_alerts").change (function () {
|
|
|
|
jQuery.each ($(this).fieldValue (), function () {
|
|
|
|
if (module_alerts[this] != undefined)
|
|
|
|
$("#target_modules option[value="+module_alerts[this]+"]")
|
|
|
|
.prop("selected", true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#manage_config_form").submit (function () {
|
|
|
|
var get_parameters_count = window.location.href.slice(
|
|
|
|
window.location.href.indexOf('?') + 1).split('&').length;
|
|
|
|
var post_parameters_count = $("#manage_config_form").serializeArray().length;
|
|
|
|
|
|
|
|
var count_parameters =
|
|
|
|
get_parameters_count + post_parameters_count;
|
|
|
|
|
|
|
|
if (count_parameters > limit_parameters_massive) {
|
|
|
|
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("h3:not([id=message])").remove ();
|
|
|
|
|
|
|
|
if ($("#source_id_agent").attr ("value") == 0) {
|
|
|
|
$("#message").showMessage ("<?php echo __('No source agent to copy'); ?>");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_modules = $("#checkbox-copy_modules");
|
|
|
|
copy_alerts = $("#checkbox-copy_alerts");
|
|
|
|
|
|
|
|
if (! $(copy_modules).attr ("checked") && ! $(copy_alerts).attr ("checked")) {
|
|
|
|
$("#message").showMessage ("<?php echo __('No operation selected'); ?>");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($(copy_modules).attr ("checked") && $("#target_modules").fieldValue ().length == 0) {
|
|
|
|
$("#message").showMessage ("<?php echo __('No modules have been selected'); ?>");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($("#destiny_id_agent").fieldValue ().length == 0) {
|
|
|
|
$("#message").showMessage ("<?php echo __('No destiny agent(s) to copy'); ?>");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#message").hide ();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
2009-02-16 13:18:42 +01:00
|
|
|
});
|
2009-02-24 17:31:02 +01:00
|
|
|
/* ]]> */
|
2013-02-28 12:43:10 +01:00
|
|
|
</script>
|