pandorafms/pandora_console/godmode/agentes/massive_config.php

325 lines
11 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
check_login ();
2008-06-16 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Updated some new config tokens (graph colors), updated group default names and icons, * manage_config_remote.php, godmode/menu.php: Added new config to manage/copy remote config from one agent to other(s). * agent_manager.php: When create a new agent, cannot select group "ALL". * agent_template.php: Fixed a weird bug that creates two tagente_estado records when using a module template. * alert_manager_editor.php: Fixed ACL problem assigning combined alert components. Better management of NOP in combined alerts (Automated NOP when create the first component. Added NAND, NXOR y NOR). * manage_config.php: Solved some bugs copying configuration with new modules (Added support for new module types). Added filter for group and fixed ACL problems. Code cleanup and better layout. * module_manager_editor_prediction.php: ACL checks added. * config_process.php, setup.php: Support to choose color graphs. * functions.php: Fixed typo and removed N/A for alerts with min/max = 0 * functions_db.php: Fixed another typo in give_disabled_group(), and added feature to list_group() combo to render or now group "ALL". * estado_generalagente.php: Added network push button for whole agent. * tactical.php: Some minor layout improvement. * ver_agente.php: Network FLAG change request for whole group, and fixed manual validation on combined alerts. * events.php: Event description don't show with " ' "characters. Fixed. * fgraph.php: graph_event_module() restored (was missing in last commit), added user-defined color support. * stat_win.php: Added support to choose another date for graph. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 20:09:56 +02:00
2008-08-11 Esteban Sanchez <estebans@artica.es> * include/functions_db.php: Added __ as an alias of lang_string(). * include/functions_reporting_pdf.php, include/functions_reporting.php, include/functions.php, include/functions_visual_map.php, index.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_note.php, operation/incidents/incident_search.php, operation/incidents/incident_statistics.php, operation/snmpconsole/snmp_alert.php, operation/snmpconsole/snmp_view.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/visual_console/render_view.php, operation/visual_console/index.php, operation/extensions.php, operation/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/bulbs.php, operation/agentes/status_events.php, operation/agentes/sla_view.php, operation/agentes/exportdata.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, operation/agentes/tactical.php, operation/agentes/networkmap.php, operation/messages/message.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, operation/reporting/custom_reporting.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/menu.php, reporting/fgraph.php, reporting/stat_win.php, ajax.php, general/logoff.php, general/pandora_help.php, general/footer.php, general/noaccess.php, general/logon_failed.php, general/links_menu.php, general/login_page.php, general/logon_ok.php, general/header.php, general/main_menu.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/setup/news.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/profiles/profile_list.php, godmode/admin_access_logs.php, godmode/db/db_info_data.php, godmode/db/db_main.php, godmode/db/db_audit.php, godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.php, godmode/extensions.php, godmode/agentes/agent_template.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/alert_manager.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/agent_disk_conf_editor.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php, godmode/modules/manage_network_components_form.php, godmode/modules/manage_nc_groups_form.php, godmode/modules/manage_network_templates.php, godmode/modules/module_list.php, godmode/modules/manage_network_templates_form.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/graph_builder.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a instead of $lang_label to future use of gettext. Style corrections. * godmode/agentes/planned_downtime.php: Rewritten to use Pandora functions and adopt the UI style. Replaced lang_string with __(). * pandoradb.sql: Fields in tplanned_downtime renamed to fit guidelines. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
if (! give_acl ($config['id_user'], 0, "LM")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.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
echo '<h3>'.__('Configuration Management').'</h3>';
2008-06-16 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Updated some new config tokens (graph colors), updated group default names and icons, * manage_config_remote.php, godmode/menu.php: Added new config to manage/copy remote config from one agent to other(s). * agent_manager.php: When create a new agent, cannot select group "ALL". * agent_template.php: Fixed a weird bug that creates two tagente_estado records when using a module template. * alert_manager_editor.php: Fixed ACL problem assigning combined alert components. Better management of NOP in combined alerts (Automated NOP when create the first component. Added NAND, NXOR y NOR). * manage_config.php: Solved some bugs copying configuration with new modules (Added support for new module types). Added filter for group and fixed ACL problems. Code cleanup and better layout. * module_manager_editor_prediction.php: ACL checks added. * config_process.php, setup.php: Support to choose color graphs. * functions.php: Fixed typo and removed N/A for alerts with min/max = 0 * functions_db.php: Fixed another typo in give_disabled_group(), and added feature to list_group() combo to render or now group "ALL". * estado_generalagente.php: Added network push button for whole agent. * tactical.php: Some minor layout improvement. * ver_agente.php: Network FLAG change request for whole group, and fixed manual validation on combined alerts. * events.php: Event description don't show with " ' "characters. Fixed. * fgraph.php: graph_event_module() restored (was missing in last commit), added user-defined color support. * stat_win.php: Added support to choose another date for graph. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 20:09:56 +02: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', array ());
$do_operation = (bool) get_parameter ('do_operation');
if ($do_operation) {
process_manage_config ($source_id_agent, $destiny_id_agents);
}
$groups = get_user_groups ();
$table->class = 'databox';
$table->width = '95%';
$table->data = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top';
$table->style[2] = 'font-weight: bold';
$table->size = array ();
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
/* Source selection */
$table->id = 'source_table';
$table->data[0][0] = __('Group');
$table->data[0][1] = print_select ($groups, 'source_id_group', $source_id_group,
false, '', '', true);
$table->data[0][2] = __('Agent');
$table->data[0][2] .= ' <span id="source_agent_loading" class="invisible">';
$table->data[0][2] .= print_image ("images/spinner.gif", true);
$table->data[0][2] .= '</span>';
$table->data[0][3] = print_select (get_group_agents ($source_id_group, false, "none"),
'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
echo '<form id="manage_config_form" method="post">';
echo '<fieldset id="fieldset_source">';
echo '<legend><span>'.__('Source');
pandora_help ('manageconfig');
echo '</span></legend>';
print_table ($table);
echo '</fieldset>';
/* Target selection */
$table->id = 'target_table';
$table->data = array ();
$modules = array ();
if ($source_id_agent)
$modules = get_agent_modules ($source_id_agent, 'nombre');
$table->data['operations'][0] = __('Operations');
$table->data['operations'][1] = '<span class="with_modules'.(empty ($modules) ? ' invisible': '').'">';
$table->data['operations'][1] .= print_checkbox ('copy_modules', 1, true, true);
$table->data['operations'][1] .= print_label (__('Copy modules'), 'checkbox-copy_modules', true);
$table->data['operations'][1] .= '</span><br />';
$table->data['operations'][1] .= '<span class="with_alerts'.(empty ($alerts) ? ' invisible': '').'">';
$table->data['operations'][1] .= print_checkbox ('copy_alerts', 1, true, true);
$table->data['operations'][1] .= print_label (__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>';
$table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty ($modules) ? ' invisible': '').'">';
$table->data[1][1] .= print_select ($modules,
'target_modules[]', 0, false, '', '', true, true);
$table->data[1][1] .= '</span>';
$table->data[1][1] .= '<span class="without_modules'.(! empty ($modules) ? ' invisible': '').'">';
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
$table->data[1][1] .= '</span>';
$table->data[2][0] = __('Alerts');
$agent_alerts = array ();
if ($source_id_agent)
$agent_alerts = get_agent_alerts_simple ($source_id_agent);
$alerts = array ();
foreach ($agent_alerts as $alert) {
$name = get_alert_template_name ($alert['id_alert_template']);
$name .= ' (<em>'.$modules[$alert['id_agent_module']].'</em>)';
$alerts[$alert['id']] = $name;
}
$table->data[2][1] = '<span class="with_alerts'.(empty ($alerts) ? ' invisible': '').'">';
$table->data[2][1] .= print_select ($alerts,
'target_alerts[]', 0, false, '', '', true, true);
$table->data[2][1] .= '</span>';
$table->data[2][1] .= '<span class="without_alerts'.(! empty ($modules) ? ' invisible': '').'">';
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
$table->data[2][1] .= '</span>';
echo '<div id="modules_loading" class="loading invisible">';
print_image ("images/spinner.gif");
echo __('Loading').'&hellip;';
echo '</div>';
echo '<fieldset id="fieldset_targets"'.($source_id_agent ? '' : ' class="invisible"').'>';
echo '<legend><span>'.__('Targets').'</span></legend>';
print_table ($table);
echo '</fieldset>';
/* Destiny selection */
$table->id = 'destiny_table';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = print_select ($groups, 'destiny_id_group', $destiny_id_group,
false, '', '', true);
$table->data[1][0] = __('Agent');
$table->data[1][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[1][0] .= print_image ("images/spinner.gif", true);
$table->data[1][0] .= '</span>';
$table->data[1][1] = print_select (get_group_agents ($destiny_id_group, false, "none"),
'destiny_id_agent[]', 0, false, '', '', true, true);
echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>';
echo '<legend><span>'.__('To agent(s)').'</span></legend>';
print_table ($table);
echo '</fieldset>';
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
echo '<div class="action-buttons" style="width: '.$table->width.'">';
print_input_hidden ('do_operation', 1);
print_submit_button (__('Go'), 'go', false, 'class="sub next"');
echo '</div>';
echo '</form>';
echo '<h3 class="error invisible" id="message">&nbsp;</h3>';
2009-02-19 Esteban Sanchez <estebans@artica.es> * include/functions_ui.php: Added require_css_file(), require_javascript_file() and require_jquery_file() to add CSS, javascript and jQuery files to the header easily without changing config object. A path parameter is addded to allow the use on enterprise code. * include/functions_db.php: Added get_db_value_filter(), get_db_all_rows_filter() and process_sql_delete(). Fixed delete_agent() style and use these functions. Added process_page_head() from functions_ui.php and changed a bit the config javascript object part. * include/functions_custom_graphs.php: Get results indexed by id on get_user_custom_graphs(). * include/functions.php: Moved process_page_head to functions_ui.php. * godmode/agentes/manage_delete.php: New interface to perform massive agents deletion. * godmode/menu.php: Added new option to massive agents deletion. * general/main_menu.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor.php, godmode/agentes/planned_downtime.php, godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php, godmode/alerts/configure_alert_compound.php, godmode/alerts/configure_alert_template.php, godmode/reporting/map_builder.php, operation/agentes/networkmap.php, operation/reporting/reporting_viewer.php, operation/visual_console/render_view.php: Use new functions in include CSS and javascript files. * index.php: Bit of style when printing the header so the HTML can be readed easily in a editor. * include/javascript/pandora.js: Added a variable to determine the enterprise directory. * include/styles/pandora.css: Added style for manage_delete.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-19 17:10:04 +01:00
require_jquery_file ('form');
require_jquery_file ('pandora.controls');
?>
<script type="text/javascript">
/* <![CDATA[ */
var module_alerts;
$(document).ready (function () {
$("#source_id_group").pandoraSelectGroup ({
agentSelect: "select#source_id_agent",
loading: "#source_agent_loading"
});
$("#destiny_id_group").pandoraSelectGroup ({
agentSelect: "select#destiny_id_agent",
loading: "#destiny_agent_loading",
callbackPost: function (id, value, option) {
if ($("#source_id_agent").fieldValue ().in_array (id)) {
/* Hide source agent */
$(option).hide ();
}
}
});
$("#source_id_agent").change (function () {
var id_agent = this.value;
if (id_agent == 0) {
return;
}
$("#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",
{"page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1,
"id_agent" : this.value,
2009-03-17 Esteban Sanchez <estebans@artica.es> * godmode/agentes/massive_operations.php: Added to repository. New page to group massive operations in a single page. * godmode/agentes/massive_config.php: Renamed from manage_config.php. * godmode/agentes/massive_delete_agents.php: Renamed from manage_delete.php. * godmode/agentes/massive_delete_modules.php: Added to repository. Interface to delete modules. * godmode/agentes/massive_delete_alerts.php: Added to repository. Interface to delete alerts. * godmode/agentes/agent_manager.php: Fixed table width to make it variable. * godmode/agentes/module_manager.php: Rewritten to use Pandora functions. * include/javascript/jquery.pandora.controls.js: Added pandoraSelectAgentAlert. Renamed pandoraSelectAgent to pandoraSelectAgentModule. Get only needed fields to make it quicker and avoid showing disabled modules. * godmode/alerts/alert_list.php: Adapted to changes in jquery.pandora.controls.js. * godmode/menu.php: Group some pages into new "Massive operation" submenu. * images/copy.png: Replaced with a better icon. * images/delete_agents.png, images/delete_alerts.php, images/delete_modules.php: Added to repository. * include/styles/pandora.css: Set color on input.sub * include/styles/pandora_width.css: Make menu_tab_frame wider. * include/functions_db.php: Removed deprecated dame_nombre_grupomodulo(). Added support to __() to receive multiple parameters so translatable strings can handle now printf format characters. * include/functions_modules.php: Added delete_agent_module(). * operation/agentes/ver_agente.php: Allow fields to be passed to get_agent_modules_json AJAX operation. * reporting/fgraph.php: Replaced sprintf() with __(). Some casts added. Show a sparse chart even if it has no max/min value. * godmode/modules/manage_network_components_form_network.php, operation/agentes/estado_ultimopaquete.php, godmode/modules/manage_network_components_form_wmi.php: Use get_modulegroup_name(). * godmode/agentes/configurar_agente.php, godmode/modules/manage_network_components.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-17 16:15:55 +01:00
"filter" : "disabled = 0",
"fields" : "id_agente_modulo,nombre"
},
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",
2009-02-18 13:29:30 +01:00
{"page" : "godmode/alerts/alert_list",
"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 ();
$("span.with_modules, span.with_alerts, #target_table-operations").hide ();
} else {
if (no_modules) {
$("span.without_modules").show ();
$("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck ();
} 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 ();
}
$("#fieldset_destiny, #target_table-operations").show ();
}
$("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable ();
},
"json"
);
},
"json"
);
});
$("#target_alerts").change (function () {
jQuery.each ($(this).fieldValue (), function () {
if (module_alerts[this] != undefined)
$("#target_modules option[value="+module_alerts[this]+"]")
.attr ("selected", "selected");
});
});
$("#manage_config_form").submit (function () {
$("h3:not([id=message])").remove ();
if ($("#source_id_agent").attr ("value") == 0) {
$("#message").showMessage ("<?php echo __('No source agent to copy') ?>");
return false;
}
2008-06-16 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: Updated some new config tokens (graph colors), updated group default names and icons, * manage_config_remote.php, godmode/menu.php: Added new config to manage/copy remote config from one agent to other(s). * agent_manager.php: When create a new agent, cannot select group "ALL". * agent_template.php: Fixed a weird bug that creates two tagente_estado records when using a module template. * alert_manager_editor.php: Fixed ACL problem assigning combined alert components. Better management of NOP in combined alerts (Automated NOP when create the first component. Added NAND, NXOR y NOR). * manage_config.php: Solved some bugs copying configuration with new modules (Added support for new module types). Added filter for group and fixed ACL problems. Code cleanup and better layout. * module_manager_editor_prediction.php: ACL checks added. * config_process.php, setup.php: Support to choose color graphs. * functions.php: Fixed typo and removed N/A for alerts with min/max = 0 * functions_db.php: Fixed another typo in give_disabled_group(), and added feature to list_group() combo to render or now group "ALL". * estado_generalagente.php: Added network push button for whole agent. * tactical.php: Some minor layout improvement. * ver_agente.php: Network FLAG change request for whole group, and fixed manual validation on combined alerts. * events.php: Event description don't show with " ' "characters. Fixed. * fgraph.php: graph_event_module() restored (was missing in last commit), added user-defined color support. * stat_win.php: Added support to choose another date for graph. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 20:09:56 +02:00
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;
});
});
/* ]]> */
</script>