2010-09-29 12:28:10 +02:00
< ? php
2021-02-12 11:28:13 +01:00
/**
* View for edit agents in Massive Operations
*
* @ category Configuration
* @ package Pandora FMS
* @ subpackage Massive Operations
* @ version 1.0 . 0
* @ license See below
*
* ______ ___ _______ _______ ________
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
* Copyright ( c ) 2005 - 2021 Artica Soluciones Tecnologicas
* Please see http :// pandorafms . org for full contribution list
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
* ============================================================================
*/
// Begin.
2019-01-30 16:18:44 +01:00
check_login ();
if ( ! check_acl ( $config [ 'id_user' ], 0 , 'AW' )) {
db_pandora_audit (
2022-01-20 10:55:23 +01:00
AUDIT_LOG_ACL_VIOLATION ,
2019-01-30 16:18:44 +01:00
'Trying to access massive agent deletion section'
);
include 'general/noaccess.php' ;
return ;
2010-09-29 12:28:10 +02:00
}
2019-01-30 16:18:44 +01:00
require_once 'include/functions_agents.php' ;
require_once 'include/functions_ui.php' ;
require_once 'include/functions_alerts.php' ;
require_once 'include/functions_modules.php' ;
require_once 'include/functions_servers.php' ;
require_once 'include/functions_gis.php' ;
require_once 'include/functions_users.php' ;
2018-09-24 17:32:58 +02:00
enterprise_include_once ( 'include/functions_config_agents.php' );
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
if ( is_ajax ()) {
$get_n_conf_files = ( bool ) get_parameter ( 'get_n_conf_files' );
if ( $get_n_conf_files ) {
$id_agents = get_parameter ( 'id_agents' );
$cont = 0 ;
foreach ( $id_agents as $id_agent ) {
$name = agents_get_name ( $id_agent );
$agent_md5 = md5 ( $name );
if ( file_exists ( $config [ 'remote_config' ] . '/md5/' . $agent_md5 . '.md5' )) {
2022-01-20 10:55:23 +01:00
$cont ++ ;
2019-01-30 16:18:44 +01:00
}
}
echo $cont ;
return ;
}
2010-09-29 12:28:10 +02:00
}
2014-03-25 13:39:26 +01:00
$update_agents = get_parameter ( 'update_agents' , 0 );
$recursion = get_parameter ( 'recursion' );
2010-09-29 12:28:10 +02:00
if ( $update_agents ) {
2019-01-30 16:18:44 +01:00
$values = [];
if ( get_parameter ( 'group' , '' ) != - 1 ) {
$values [ 'id_grupo' ] = get_parameter ( 'group' );
}
2019-10-10 13:37:01 +02:00
if ( ! ( get_parameter ( 'interval_select' ) == - 1 && empty ( get_parameter ( 'interval_text' )))) {
if ( get_parameter ( 'interval' , 0 ) != 0 ) {
$values [ 'intervalo' ] = get_parameter ( 'interval' );
}
2019-01-30 16:18:44 +01:00
}
2018-09-24 17:32:58 +02:00
2019-02-12 14:52:18 +01:00
if ( get_parameter ( 'id_os' , '' ) != - 1 ) {
$values [ 'id_os' ] = get_parameter ( 'id_os' );
}
2018-09-24 17:32:58 +02:00
2019-01-30 16:18:44 +01:00
if ( get_parameter ( 'id_parent' , '' ) != '' ) {
$values [ 'id_parent' ] = get_parameter ( 'id_agent_parent' , 0 );
}
if ( get_parameter ( 'server_name' , '' ) != - 1 ) {
$values [ 'server_name' ] = get_parameter ( 'server_name' );
}
if ( get_parameter ( 'description' , '' ) != '' ) {
$values [ 'comentarios' ] = get_parameter ( 'description' );
}
if ( get_parameter ( 'mode' , '' ) != - 1 ) {
$values [ 'modo' ] = get_parameter ( 'mode' );
}
if ( get_parameter ( 'disabled' , '' ) != - 1 ) {
$values [ 'disabled' ] = get_parameter ( 'disabled' );
}
if ( get_parameter ( 'icon_path' , '' ) != '' ) {
$values [ 'icon_path' ] = get_parameter ( 'icon_path' );
}
if ( get_parameter ( 'update_gis_data' , - 1 ) != - 1 ) {
$values [ 'update_gis_data' ] = get_parameter ( 'update_gis_data' );
}
if ( get_parameter ( 'custom_id' , '' ) != '' ) {
$values [ 'custom_id' ] = get_parameter ( 'custom_id' );
}
if ( get_parameter ( 'cascade_protection' , - 1 ) != - 1 ) {
$values [ 'cascade_protection' ] = get_parameter ( 'cascade_protection' );
}
if ( get_parameter ( 'cascade_protection_module' , - 1 ) != - 1 ) {
$values [ 'cascade_protection_module' ] = get_parameter ( 'cascade_protection_module' );
}
if ( get_parameter ( 'delete_conf' , 0 ) != 0 ) {
$values [ 'delete_conf' ] = get_parameter ( 'delete_conf' );
}
if ( get_parameter ( 'quiet_select' , - 1 ) != - 1 ) {
$values [ 'quiet' ] = get_parameter ( 'quiet_select' );
}
2019-11-26 16:44:53 +01:00
if ( get_parameter ( 'safe_mode_change' , - 1 ) == 1 && get_parameter ( 'safe_mode_module' , '' ) != '' ) {
// Get the module name.
$values [ 'safe_mode_module' ] = get_parameter ( 'safe_mode_module' );
} else if ( get_parameter ( 'safe_mode_change' , - 1 ) == 0 ) {
// Disabled Safe Operation Mode.
$values [ 'safe_mode_module' ] = '0' ;
}
2019-01-30 16:18:44 +01:00
$fields = db_get_all_fields_in_table ( 'tagent_custom_fields' );
if ( $fields === false ) {
$fields = [];
}
$id_agents = get_parameter ( 'id_agents' , false );
if ( ! $id_agents ) {
ui_print_error_message ( __ ( 'No agents selected' ));
$id_agents = [];
} else {
if ( empty ( $values ) && empty ( $fields )) {
ui_print_error_message ( __ ( 'No values changed' ));
$id_agents = [];
}
}
2019-11-26 16:44:53 +01:00
// Get the id_agente_modulo to update the 'safe_operation_mode' field.
if ( isset ( $values [ 'safe_mode_module' ]) && ( $values [ 'safe_mode_module' ] != '0' )) {
foreach ( $id_agents as $id_agent ) {
$id_module_safe [ $id_agent ] = db_get_value_filter (
'id_agente_modulo' ,
'tagente_modulo' ,
[
'id_agente' => $id_agent ,
'nombre' => $values [ 'safe_mode_module' ],
]
);
}
}
2019-01-30 16:18:44 +01:00
// CONF FILE DELETION
if ( isset ( $values [ 'delete_conf' ])) {
unset ( $values [ 'delete_conf' ]);
$n_deleted = 0 ;
foreach ( $id_agents as $id_agent ) {
$agent_md5 = md5 ( agents_get_name ( $id_agent ));
@ unlink (
$config [ 'remote_config' ] . '/md5/' . $agent_md5 . '.md5'
);
$result = @ unlink (
$config [ 'remote_config' ] . '/conf/' . $agent_md5 . '.conf'
);
$n_deleted += ( int ) $result ;
}
if ( $n_deleted > 0 ) {
2022-01-20 10:55:23 +01:00
db_pandora_audit ( AUDIT_LOG_MASSIVE_MANAGEMENT , 'Delete conf file ' . $id_agent );
2019-01-30 16:18:44 +01:00
} else {
2022-01-20 10:55:23 +01:00
db_pandora_audit ( AUDIT_LOG_MASSIVE_MANAGEMENT , 'Try to delete conf file ' . $id_agent );
2019-01-30 16:18:44 +01:00
}
ui_print_result_message (
$n_deleted > 0 ,
__ ( 'Configuration files deleted successfully' ) . '(' . $n_deleted . ')' ,
__ ( 'Configuration files cannot be deleted' )
);
}
if ( empty ( $values ) && empty ( $fields )) {
$id_agents = [];
}
$n_edited = 0 ;
$result = false ;
foreach ( $id_agents as $id_agent ) {
2019-07-15 11:46:35 +02:00
$old_interval_value = db_get_value_filter ( 'intervalo' , 'tagente' , [ 'id_agente' => $id_agent ]);
2019-01-30 16:18:44 +01:00
if ( ! empty ( $values )) {
$group_old = false ;
$disabled_old = false ;
if ( $values [ 'id_grupo' ] || isset ( $values [ 'disabled' ])) {
$values_old = db_get_row_filter ( 'tagente' , [ 'id_agente' => $id_agent ], [ 'id_grupo' , 'disabled' ]);
if ( $values_old [ 'id_grupo' ]) {
$group_old = $values_old [ 'id_grupo' ];
}
if ( isset ( $values [ 'disabled' ])) {
$disabled_old = $values_old [ 'disabled' ];
}
}
2019-11-26 16:44:53 +01:00
// Get the id_agent_module for this agent to update the 'safe_operation_mode' field.
if ( isset ( $values [ 'safe_mode_module' ]) && ( $values [ 'safe_mode_module' ] != '0' )) {
$values [ 'safe_mode_module' ] = $id_module_safe [ $id_agent ];
}
2019-01-30 16:18:44 +01:00
$result = db_process_sql_update (
'tagente' ,
$values ,
[ 'id_agente' => $id_agent ]
);
if ( $result && $config [ 'metaconsole_agent_cache' ] == 1 ) {
$server_name [ 'server_name' ] = db_get_sql ( 'SELECT server_name FROM tagente WHERE id_agente =' . $id_agent );
// Force an update of the agent cache.
$result_metaconsole = agent_update_from_cache ( $id_agent , $values , $server_name );
}
2019-07-15 11:46:35 +02:00
// Update the configuration files.
2019-10-07 19:02:19 +02:00
if ( $result && ( $old_interval_value != $values [ 'intervalo' ]) && ! empty ( $values [ 'intervalo' ])) {
2019-07-15 11:46:35 +02:00
enterprise_hook (
'config_agents_update_config_token' ,
[
$id_agent ,
'interval' ,
$values [ 'intervalo' ],
]
);
}
2019-01-30 16:18:44 +01:00
if ( $disabled_old !== false && $disabled_old != $values [ 'disabled' ]) {
enterprise_hook (
'config_agents_update_config_token' ,
[
$id_agent ,
'standby' ,
$values [ 'disabled' ],
]
);
2019-02-12 14:52:18 +01:00
// Validate alerts for disabled agents.
if ( $values [ 'disabled' ] == 1 ) {
alerts_validate_alert_agent ( $id_agent );
}
2019-01-30 16:18:44 +01:00
}
if ( $group_old || $result ) {
if ( $group_old && $group_old != null ) {
$tpolicy_group_old = db_get_all_rows_sql (
' SELECT id_policy FROM tpolicy_groups
WHERE id_group = ' . $group_old
);
} else {
$tpolicy_group_old = db_get_all_rows_sql ( 'SELECT id_policy FROM tpolicy_groups' );
}
if ( $tpolicy_group_old ) {
foreach ( $tpolicy_group_old as $key => $value ) {
$tpolicy_agents_old = db_get_sql (
' SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value[' id_policy '].' AND id_agent = ' . $id_agent
);
if ( $tpolicy_agents_old ) {
$result2 = db_process_sql_update (
'tpolicy_agents' ,
[ 'pending_delete' => 1 ],
[
'id_agent' => $id_agent ,
'id_policy' => $value [ 'id_policy' ],
]
);
}
}
}
if ( $values [ 'id_grupo' ] && $values [ 'id_grupo' ] != null ) {
$tpolicy_group_new = db_get_all_rows_sql (
' SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$values[' id_grupo ' ]
);
} else {
$tpolicy_group_new = db_get_all_rows_sql ( 'SELECT id_policy FROM tpolicy_groups' );
}
if ( $tpolicy_group_new ) {
foreach ( $tpolicy_group_new as $key => $value ) {
$tpolicy_agents_new = db_get_sql (
' SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value[' id_policy '].' AND id_agent = ' . $id_agent
);
if ( ! $tpolicy_agents_new ) {
db_process_sql_insert (
'tpolicy_agents' ,
[
'id_policy' => $value [ 'id_policy' ],
'id_agent' => $id_agent ,
]
);
} else {
$result3 = db_process_sql_update (
'tpolicy_agents' ,
[ 'pending_delete' => 0 ],
[
'id_agent' => $id_agent ,
'id_policy' => $value [ 'id_policy' ],
]
);
}
}
}
}
}
$info = [];
// Update Custom Fields
foreach ( $fields as $field ) {
$info [ $field [ 'id_field' ]] = $field [ 'name' ];
2021-02-12 11:28:13 +01:00
$value = get_parameter ( 'customvalue_' . $field [ 'id_field' ]);
if ( empty ( $value ) === false ) {
2019-01-30 16:18:44 +01:00
$key = $field [ 'id_field' ];
2021-02-12 11:28:13 +01:00
$old_value = db_get_all_rows_filter (
'tagent_custom_data' ,
[
'id_agent' => $id_agent ,
'id_field' => $key ,
]
);
2019-01-30 16:18:44 +01:00
if ( $old_value === false ) {
// Create custom field if not exist
$result = db_process_sql_insert (
'tagent_custom_data' ,
[
'id_field' => $key ,
'id_agent' => $id_agent ,
'description' => $value ,
]
);
} else {
2021-02-12 11:28:13 +01:00
if ( $old_value [ 0 ][ 'description' ] !== $value ) {
$result = db_process_sql_update (
'tagent_custom_data' ,
[ 'description' => $value ],
[
'id_field' => $key ,
'id_agent' => $id_agent ,
]
);
}
2019-01-30 16:18:44 +01:00
}
}
}
$n_edited += ( int ) $result ;
}
if ( $result !== false ) {
2022-01-20 10:55:23 +01:00
db_pandora_audit ( AUDIT_LOG_MASSIVE_MANAGEMENT , 'Update agent ' . $id_agent , false , false , json_encode ( $info ));
2019-01-30 16:18:44 +01:00
} else {
if ( isset ( $id_agent )) {
2022-01-20 10:55:23 +01:00
db_pandora_audit ( AUDIT_LOG_MASSIVE_MANAGEMENT , 'Try to update agent ' . $id_agent , false , false , json_encode ( $info ));
2019-01-30 16:18:44 +01:00
}
}
ui_print_result_message (
$result !== false ,
2021-02-12 11:28:13 +01:00
__ ( 'Agents updated successfully (%d)' , $n_edited ),
2019-01-30 16:18:44 +01:00
__ ( 'Agents cannot be updated (maybe there was no field to update)' )
);
2010-09-29 12:28:10 +02:00
}
2019-01-30 16:18:44 +01:00
2010-09-29 12:28:10 +02:00
$id_group = 0 ;
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/functions_users.php
include/functions_html.php
include/functions_menu.php
include/functions_messages.php
include/functions_modules.php
include/functions_reporting.php
include/functions_groups.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/functions_visual_map.php
include/functions_profile.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/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
include/functions_reports.php
index.php
extensions/insert_data.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/module_groups.php
operation/incidents/incident_detail.php
operation/search_modules.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/estado_agente.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/group_view.php
operation/search_agents.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/integria_incidents/incident_detail.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/search_users.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
ajax.php
general/ui/agents_list.php
godmode/groups/configure_group.php
godmode/groups/group_list.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_purge.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/module_manager_editor_network.php
godmode/agentes/module_manager_editor_wmi.php
godmode/agentes/module_manager_editor_plugin.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.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/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/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/setup/setup_auth.php
godmode/users/user_list.php
godmode/users/configure_user.php
godmode/users/configure_profile.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_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/reporting/visual_console_builder.wizard.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.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.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Functions in
functions_profile.php, functions_agents.php, functions_users.php,
functions_massive_policies.php, functions_audit.php, functions_backup.php,
functions_collection.php, functions_skins.php, functions_enterprise.php,
functions_groups.php, functions_local_components.php, functions_metaconsole.php,
functions_policies.php, functions_reporting.php, functions_reporting_csv.php,
functions_reporting_pdf2.php, functions_services.php have their own prefixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4333 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-05-10 20:51:09 +02:00
$groups = users_get_groups ();
2010-09-29 12:28:10 +02:00
2015-10-06 13:52:45 +02:00
$table = new StdClass ();
2010-09-29 12:28:10 +02:00
$table -> id = 'delete_table' ;
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;' ;
2010-09-29 12:28:10 +02:00
$table -> style [ 2 ] = 'font-weight: bold' ;
2019-01-30 16:18:44 +01:00
$table -> size = [];
2010-09-29 12:28:10 +02:00
$table -> size [ 0 ] = '15%' ;
2011-08-22 07:42:55 +02:00
$table -> size [ 1 ] = '35%' ;
$table -> size [ 2 ] = '15%' ;
$table -> size [ 3 ] = '35%' ;
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$table -> data = [];
2010-09-29 12:28:10 +02: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 ,
'id_group' ,
$id_group ,
false ,
'' ,
'' ,
true
);
2011-08-22 07:42:55 +02:00
$table -> data [ 0 ][ 2 ] = __ ( 'Group recursion' );
2019-01-30 16:18:44 +01:00
$table -> data [ 0 ][ 3 ] = html_print_checkbox (
'recursion2' ,
1 ,
$recursion ,
true ,
false
);
2010-09-29 12:28:10 +02:00
2014-03-24 12:41:54 +01:00
2019-01-30 16:18:44 +01:00
$status_list = [];
2015-06-08 13:13:09 +02:00
$status_list [ AGENT_STATUS_NORMAL ] = __ ( 'Normal' );
2014-03-24 12:41:54 +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-24 12:41:54 +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' ,
'selected' ,
'' ,
__ ( 'All' ),
AGENT_STATUS_ALL ,
true
);
2017-02-01 17:31:39 +01:00
$table -> data [ 1 ][ 2 ] = __ ( 'Show agents' );
2019-01-30 16:18:44 +01:00
$table -> data [ 1 ][ 3 ] = html_print_select (
[
0 => 'Only enabled' ,
1 => 'Only disabled' ,
],
'disabled' ,
2 ,
'' ,
__ ( 'All' ),
2 ,
true ,
'' ,
'' ,
'' ,
'' ,
'width:30%;'
);
2014-03-24 12:41:54 +01:00
$table -> data [ 2 ][ 0 ] = __ ( 'Agents' );
$table -> data [ 2 ][ 0 ] .= '<span id="agent_loading" class="invisible">' ;
$table -> data [ 2 ][ 0 ] .= html_print_image ( 'images/spinner.png' , true );
$table -> data [ 2 ][ 0 ] .= '</span>' ;
2019-01-30 16:18:44 +01:00
$enabled_agents = agents_get_group_agents ( array_keys ( users_get_groups ( $config [ 'id_user' ], 'AW' , false )), [ 'disabled' => 0 ], 'none' );
$all_agents = ( agents_get_group_agents ( array_keys ( users_get_groups ( $config [ 'id_user' ], 'AW' , false )), [ 'disabled' => 1 ], 'none' ) + $enabled_agents );
$table -> data [ 2 ][ 1 ] = html_print_select (
$all_agents ,
'id_agents[]' ,
0 ,
false ,
'' ,
'' ,
true ,
true
);
2010-09-29 12:28:10 +02:00
2011-11-11 09:35:21 +01:00
echo '<form method="post" id="form_agent" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_agents">' ;
2019-01-30 16:18:44 +01:00
html_print_table ( $table );
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$nombre_agente = '' ;
$direccion_agente = '' ;
2010-09-29 12:28:10 +02:00
$id_agente = 0 ;
$id_parent = 0 ;
$cascade_protection = 0 ;
$group = 0 ;
$interval = '' ;
$id_os = 0 ;
$server_name = 0 ;
2019-01-30 16:18:44 +01:00
$description = '' ;
2010-09-29 12:28:10 +02:00
2021-04-06 08:55:06 +02:00
echo '<div id="form_agents" style="display:none">' ;
2010-09-29 12:28:10 +02:00
2015-10-06 13:52:45 +02:00
$table = new StdClass ();
2015-06-15 15:50:28 +02:00
$table -> width = '100%' ;
2019-01-30 16:18:44 +01:00
$table -> class = 'databox filters' ;
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$table -> head = [];
$table -> style = [];
2010-09-29 12:28:10 +02:00
$table -> style [ 0 ] = 'font-weight: bold; width: 150px;' ;
2015-10-06 13:52:45 +02:00
$table -> size [ 0 ] = '15%' ;
$table -> size [ 1 ] = '35%' ;
$table -> size [ 2 ] = '15%' ;
$table -> size [ 3 ] = '35%' ;
2019-01-30 16:18:44 +01:00
$table -> data = [];
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$groups = users_get_groups ( $config [ 'id_user' ], 'AW' , false );
$agents = agents_get_group_agents ( array_keys ( $groups ));
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$modules = db_get_all_rows_sql (
' SELECT id_agente_modulo as id_module , nombre as name FROM tagente_modulo
WHERE id_agente = ' . $id_parent
);
if ( $modules === false ) {
$modules = [];
}
2017-01-25 13:59:14 +01:00
2019-01-30 16:18:44 +01:00
$modules_values = [];
2017-01-25 13:59:14 +01:00
$modules_values [ 0 ] = __ ( 'Any' );
foreach ( $modules as $m ) {
2019-01-30 16:18:44 +01:00
$modules_values [ $m [ 'id_module' ]] = $m [ 'name' ];
2017-01-25 13:59:14 +01:00
}
2010-10-07 10:13:36 +02:00
$table -> data [ 0 ][ 0 ] = __ ( 'Parent' );
2019-01-30 16:18:44 +01:00
$params = [];
2012-09-13 19:47:21 +02:00
$params [ 'return' ] = true ;
$params [ 'show_helptip' ] = true ;
$params [ 'input_name' ] = 'id_parent' ;
2016-10-13 09:55:53 +02:00
$params [ 'print_hidden_input_idagent' ] = true ;
$params [ 'hidden_input_idagent_name' ] = 'id_agent_parent' ;
$params [ 'hidden_input_idagent_value' ] = $id_parent ;
2019-01-30 16:18:44 +01:00
$params [ 'value' ] = db_get_value ( 'alias' , 'tagente' , 'id_agente' , $id_parent );
2017-08-30 15:52:28 +02:00
$params [ 'selectbox_id' ] = 'cascade_protection_module' ;
$params [ 'javascript_is_function_select' ] = true ;
2012-09-13 19:47:21 +02:00
$table -> data [ 0 ][ 1 ] = ui_print_agent_autocomplete_input ( $params );
2010-09-29 12:28:10 +02:00
2019-04-24 13:53:18 +02:00
$table -> data [ 0 ][ 1 ] .= '<b>' . __ ( 'Cascade protection' ) . '</b>' . html_print_select (
2019-01-30 16:18:44 +01:00
[
1 => __ ( 'Yes' ),
0 => __ ( 'No' ),
],
'cascade_protection' ,
- 1 ,
'' ,
__ ( 'No change' ),
- 1 ,
true
);
$table -> data [ 0 ][ 1 ] .= ' ' . __ ( 'Module' ) . ' ' . html_print_select ( $modules , 'cascade_protection_module' , $cascade_protection_module , '' , '' , 0 , true );
2017-01-25 13:59:14 +01:00
2010-10-07 10:13:36 +02:00
$table -> data [ 1 ][ 0 ] = __ ( 'Group' );
2020-10-08 16:41:26 +02:00
$table -> data [ 1 ][ 1 ] = '<div class="w290px inline">' ;
$table -> data [ 1 ][ 1 ] .= html_print_select_groups (
false ,
'AR' ,
false ,
'group' ,
$group ,
'' ,
__ ( 'No change' ),
- 1 ,
true ,
false ,
true ,
'' ,
false ,
'width: 150px;'
);
$table -> data [ 1 ][ 1 ] .= '</div>' ;
2010-09-29 12:28:10 +02:00
2010-10-07 10:13:36 +02:00
$table -> data [ 2 ][ 0 ] = __ ( 'Interval' );
2010-09-29 12:28:10 +02:00
2019-10-10 13:37:01 +02:00
$table -> data [ 2 ][ 1 ] = html_print_extended_select_for_time ( 'interval' , 0 , '' , __ ( 'No change' ), '0' , 10 , true , 'width: 150px' , false );
2010-09-29 12:28:10 +02:00
2010-10-07 10:13:36 +02:00
$table -> data [ 3 ][ 0 ] = __ ( 'OS' );
2019-01-30 16:18:44 +01:00
$table -> data [ 3 ][ 1 ] = html_print_select_from_sql (
'SELECT id_os, name FROM tconfig_os' ,
'id_os' ,
$id_os ,
'' ,
__ ( 'No change' ),
- 1 ,
true ,
false ,
true ,
false ,
'width: 105px;'
);
2010-10-07 10:13:36 +02:00
$table -> data [ 3 ][ 1 ] .= ' <span id="os_preview">' ;
2019-01-30 16:18:44 +01:00
$table -> data [ 3 ][ 1 ] .= ui_print_os_icon ( $id_os , false , true );
2010-10-07 10:13:36 +02:00
$table -> data [ 3 ][ 1 ] .= '</span>' ;
2010-09-29 12:28:10 +02:00
// Network server
$none = '' ;
2019-01-30 16:18:44 +01:00
if ( $server_name == '' && $id_agente ) {
$none = __ ( 'None' );
}
2010-10-07 10:13:36 +02:00
$table -> data [ 4 ][ 0 ] = __ ( 'Server' );
2019-01-30 16:18:44 +01:00
$table -> data [ 4 ][ 1 ] = html_print_select (
servers_get_names (),
'server_name' ,
$server_name ,
'' ,
__ ( 'No change' ),
- 1 ,
true ,
false ,
true ,
'' ,
false ,
'width: 150px;'
);
2010-09-29 12:28:10 +02:00
// Description
2010-10-07 10:13:36 +02:00
$table -> data [ 5 ][ 0 ] = __ ( 'Description' );
2019-01-30 16:18:44 +01:00
$table -> data [ 5 ][ 1 ] = html_print_input_text ( 'description' , $description , '' , 45 , 255 , true );
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
html_print_table ( $table );
2010-09-29 12:28:10 +02:00
unset ( $table );
$custom_id = '' ;
$mode = - 1 ;
$disabled = - 1 ;
$new_agent = true ;
$icon_path = '' ;
$update_gis_data = - 1 ;
$cascade_protection = - 1 ;
2017-01-25 13:59:14 +01:00
$cascade_protection_module = - 1 ;
2012-08-22 16:09:05 +02:00
$quiet_select = - 1 ;
2010-09-29 12:28:10 +02:00
2015-10-06 13:52:45 +02:00
$table = new StdClass ();
2015-06-15 15:50:28 +02:00
$table -> width = '100%' ;
2019-01-30 16:18:44 +01:00
$table -> class = 'databox filters' ;
2010-09-29 12:28:10 +02:00
2015-10-06 13:52:45 +02:00
$table -> size [ 0 ] = '15%' ;
$table -> size [ 1 ] = '35%' ;
$table -> size [ 2 ] = '15%' ;
$table -> size [ 3 ] = '35%' ;
2019-01-30 16:18:44 +01:00
$table -> head = [];
$table -> style = [];
2010-09-29 12:28:10 +02:00
$table -> style [ 0 ] = 'font-weight: bold; width: 150px;' ;
2019-01-30 16:18:44 +01:00
$table -> data = [];
2010-09-29 12:28:10 +02:00
// Custom ID
$table -> data [ 0 ][ 0 ] = __ ( 'Custom ID' );
2019-01-30 16:18:44 +01:00
$table -> data [ 0 ][ 1 ] = html_print_input_text ( 'custom_id' , $custom_id , '' , 16 , 255 , true );
2010-09-29 12:28:10 +02:00
// Learn mode / Normal mode
2019-04-24 13:53:18 +02:00
$table -> data [ 1 ][ 0 ] = __ ( 'Module definition' );
2021-03-11 15:40:23 +01:00
$table -> data [ 1 ][ 1 ] = __ ( 'No change' ) . ' ' . html_print_radio_button_extended ( 'mode' , - 1 , '' , $mode , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 1 ][ 1 ] .= __ ( 'Learning mode' ) . ' ' . html_print_radio_button_extended ( 'mode' , 1 , '' , $mode , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 1 ][ 1 ] .= __ ( 'Normal mode' ) . ' ' . html_print_radio_button_extended ( 'mode' , 0 , '' , $mode , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 1 ][ 1 ] .= __ ( 'Autodisable mode' ) . ' ' . html_print_radio_button_extended ( 'mode' , 2 , '' , $mode , false , '' , 'class="mrgn_right_40px"' , true );
2010-09-29 12:28:10 +02:00
// Status (Disabled / Enabled)
$table -> data [ 2 ][ 0 ] = __ ( 'Status' );
2021-03-11 15:40:23 +01:00
$table -> data [ 2 ][ 1 ] = __ ( 'No change' ) . ' ' . html_print_radio_button_extended ( 'disabled' , - 1 , '' , $disabled , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 2 ][ 1 ] .= __ ( 'Disabled' ) . ' ' . ui_print_help_tip ( __ ( 'If the remote configuration is enabled, it will also go into standby mode when disabling it.' ), true ) . ' ' . html_print_radio_button_extended ( 'disabled' , 1 , '' , $disabled , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 2 ][ 1 ] .= __ ( 'Active' ) . ' ' . html_print_radio_button_extended ( 'disabled' , 0 , '' , $disabled , false , '' , 'class="mrgn_right_40px"' , true );
2010-09-29 12:28:10 +02:00
// Remote configuration
$table -> data [ 3 ][ 0 ] = __ ( 'Remote configuration' );
// Delete remote configuration
2021-03-11 15:40:23 +01:00
$table -> data [ 3 ][ 1 ] = '<div id="delete_configurations" class="invisible">' . __ ( 'Delete available remote configurations' ) . ' (' ;
2010-09-29 12:28:10 +02:00
$table -> data [ 3 ][ 1 ] .= '<span id="n_configurations"></span>' ;
2021-03-11 15:40:23 +01:00
$table -> data [ 3 ][ 1 ] .= ') ' . html_print_checkbox_extended ( 'delete_conf' , 1 , 0 , false , '' , 'class="mrgn_right_40px"' , true ) . '</div>' ;
2010-09-29 12:28:10 +02:00
2021-03-11 15:40:23 +01:00
$table -> data [ 3 ][ 1 ] .= '<div id="not_available_configurations" class="invisible"><em>' . __ ( 'Not available' ) . '</em></div>' ;
2012-08-22 16:09:05 +02:00
2011-04-27 15:43:31 +02:00
$listIcons = gis_get_array_list_icons ();
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$arraySelectIcon = [];
foreach ( $listIcons as $index => $value ) {
$arraySelectIcon [ $index ] = $index ;
}
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$path = 'images/gis_map/icons/' ;
// TODO set better method the path
2012-08-22 16:09:05 +02:00
if ( $icon_path == '' ) {
2019-01-30 16:18:44 +01:00
$display_icons = 'none' ;
// Hack to show no icon. Use any given image to fix not found image errors
$path_without = 'images/spinner.png' ;
$path_default = 'images/spinner.png' ;
$path_ok = 'images/spinner.png' ;
$path_bad = 'images/spinner.png' ;
$path_warning = 'images/spinner.png' ;
} else {
$display_icons = '' ;
$path_without = $path . $icon_path . '.default.png' ;
$path_default = $path . $icon_path . '.default.png' ;
$path_ok = $path . $icon_path . '.ok.png' ;
$path_bad = $path . $icon_path . '.bad.png' ;
$path_warning = $path . $icon_path . '.warning.png' ;
2011-07-20 16:55:57 +02:00
}
2010-09-29 12:28:10 +02:00
$table -> data [ 4 ][ 0 ] = __ ( 'Agent icon' );
2019-01-30 16:18:44 +01:00
$table -> data [ 4 ][ 1 ] = html_print_select ( $arraySelectIcon , 'icon_path' , $icon_path , 'changeIcons();' , __ ( 'No change' ), '' , true ) . ' ' . __ ( 'Without status' ) . ': ' . html_print_image ( $path_without , true , [ 'id' => 'icon_without_status' , 'style' => 'display:' . $display_icons . ';' ]) . ' ' . __ ( 'Default' ) . ': ' . html_print_image ( $path_default , true , [ 'id' => 'icon_default' , 'style' => 'display:' . $display_icons . ';' ]) . ' ' . __ ( 'Ok' ) . ': ' . html_print_image ( $path_ok , true , [ 'id' => 'icon_ok' , 'style' => 'display:' . $display_icons . ';' ]) . ' ' . __ ( 'Bad' ) . ': ' . html_print_image ( $path_bad , true , [ 'id' => 'icon_bad' , 'style' => 'display:' . $display_icons . ';' ]) . ' ' . __ ( 'Warning' ) . ': ' . html_print_image ( $path_warning , true , [ 'id' => 'icon_warning' , 'style' => 'display:' . $display_icons . ';' ]);
2010-09-29 12:28:10 +02:00
if ( $config [ 'activate_gis' ]) {
2019-01-30 16:18:44 +01:00
$table -> data [ 5 ][ 0 ] = __ ( 'Ignore new GIS data:' );
2021-03-11 15:40:23 +01:00
$table -> data [ 5 ][ 1 ] = __ ( 'No change' ) . ' ' . html_print_radio_button_extended ( 'update_gis_data' , - 1 , '' , $update_gis_data , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 5 ][ 1 ] .= __ ( 'Yes' ) . ' ' . html_print_radio_button_extended ( 'update_gis_data' , 0 , '' , $update_gis_data , false , '' , 'class="mrgn_right_40px"' , true );
$table -> data [ 5 ][ 1 ] .= __ ( 'No' ) . ' ' . html_print_radio_button_extended ( 'update_gis_data' , 1 , '' , $update_gis_data , false , '' , 'class="mrgn_right_40px"' , true );
2010-09-29 12:28:10 +02:00
}
2012-08-22 16:09:05 +02:00
$table -> data [ 6 ][ 0 ] = __ ( 'Quiet' );
$table -> data [ 6 ][ 0 ] .= ui_print_help_tip ( __ ( 'The agent still runs but the alerts and events will be stop' ), true );
2019-01-30 16:18:44 +01:00
$table -> data [ 6 ][ 1 ] = html_print_select (
[
- 1 => __ ( 'No change' ),
1 => __ ( 'Yes' ),
0 => __ ( 'No' ),
],
'quiet_select' ,
$quiet_select ,
'' ,
'' ,
0 ,
true
);
2019-11-26 16:44:53 +01:00
$table -> data [ 7 ][ 0 ] = __ ( 'Safe operation mode' ) . ': ' . ui_print_help_tip (
__ (
' This mode allow % s to disable all modules
of this agent while the selected module is on CRITICAL status ' ,
get_product_name ()
),
true
);
$table -> data [ 7 ][ 1 ] .= html_print_select (
[
1 => __ ( 'Enabled' ),
0 => __ ( 'Disabled' ),
],
'safe_mode_change' ,
- 1 ,
'' ,
__ ( 'No change' ),
- 1 ,
true
) . ' ' ;
$table -> data [ 7 ][ 1 ] .= __ ( 'Module' ) . ' ' . html_print_select ( '' , 'safe_mode_module' , '' , '' , __ ( 'Any' ), - 1 , true ) . '</div>' ;
2019-01-30 16:18:44 +01:00
ui_toggle ( html_print_table ( $table , true ), __ ( 'Advanced options' ));
2010-09-29 12:28:10 +02:00
unset ( $table );
2015-10-06 13:52:45 +02:00
$table = new StdClass ();
2015-06-15 15:50:28 +02:00
$table -> width = '100%' ;
2019-01-30 16:18:44 +01:00
$table -> class = 'databox filters' ;
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
$table -> head = [];
$table -> style = [];
2010-09-29 12:28:10 +02:00
$table -> style [ 0 ] = 'font-weight: bold; width: 150px;' ;
2019-01-30 16:18:44 +01:00
$table -> data = [];
2015-10-06 13:52:45 +02:00
$table -> size [ 0 ] = '15%' ;
$table -> size [ 1 ] = '35%' ;
$table -> size [ 2 ] = '15%' ;
$table -> size [ 3 ] = '35%' ;
2010-09-29 12:28:10 +02:00
* 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
$fields = db_get_all_fields_in_table ( 'tagent_custom_fields' );
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
if ( $fields === false ) {
$fields = [];
}
2010-09-29 12:28:10 +02:00
foreach ( $fields as $field ) {
2019-01-30 16:18:44 +01:00
$data [ 0 ] = '<b>' . $field [ 'name' ] . '</b>' ;
2019-03-07 13:37:36 +01:00
$combo = [];
$combo = $field [ 'combo_values' ];
$combo = explode ( ',' , $combo );
$combo_values = [];
foreach ( $combo as $value ) {
$combo_values [ $value ] = $value ;
}
2019-01-30 16:18:44 +01:00
$custom_value = db_get_value_filter ( 'description' , 'tagent_custom_data' , [ 'id_field' => $field [ 'id_field' ], 'id_agent' => $id_agente ]);
if ( $custom_value === false ) {
$custom_value = '' ;
}
if ( $field [ 'is_password_type' ]) {
$data [ 1 ] = html_print_input_text_extended (
'customvalue_' . $field [ 'id_field' ],
$custom_value ,
'customvalue_' . $field [ 'id_field' ],
'' ,
30 ,
100 ,
$view_mode ,
'' ,
'' ,
true ,
true
);
} else {
2021-03-11 15:40:23 +01:00
$data [ 1 ] = html_print_textarea ( 'customvalue_' . $field [ 'id_field' ], 2 , 65 , $custom_value , 'class="mrgn_right_30px"' , true );
2019-01-30 16:18:44 +01:00
}
2019-03-07 13:37:36 +01:00
if ( $field [ 'combo_values' ] !== '' ) {
2021-04-06 18:51:14 +02:00
$data [ 1 ] = html_print_input (
[
'type' => 'select_search' ,
'fields' => $combo_values ,
'name' => 'customvalue_' . $field [ 'id_field' ],
'selected' => $custom_value ,
'nothing' => __ ( 'No change' ),
'nothing_value' => '' ,
'return' => true ,
'sort' => false ,
]
2019-03-07 13:37:36 +01:00
);
};
2019-01-30 16:18:44 +01:00
array_push ( $table -> data , $data );
2010-09-29 12:28:10 +02:00
}
2010-10-29 Miguel de Dios <miguel.dedios@artica.es>
* extensions/dbmanager.php, godmode/agentes/module_manager_editor.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: now in the source code pick
more info in the audit for actions.
Pending tasks: #3089687
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3480 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-10-29 14:35:34 +02:00
if ( ! empty ( $fields )) {
2019-01-30 16:18:44 +01:00
ui_toggle ( html_print_table ( $table , true ), __ ( 'Custom fields' ));
2010-09-29 12:28:10 +02:00
}
echo '<h3 class="error invisible" id="message"> </h3>' ;
2019-01-30 16:18:44 +01:00
html_print_input_hidden ( 'id_agente' , $id_agente );
2010-09-29 12:28:10 +02:00
2021-06-07 13:38:07 +02:00
attachActionButton ( 'update_agents' , 'update' , $table -> width );
2021-02-12 11:28:13 +01:00
2021-06-07 13:38:07 +02:00
// Shown and hide div.
2010-09-29 12:28:10 +02:00
echo '</div></form>' ;
2019-01-30 16:18:44 +01:00
ui_require_jquery_file ( 'form' );
2010-09-29 12:28:10 +02:00
2019-01-30 16:18:44 +01:00
ui_require_jquery_file ( 'pandora.controls' );
ui_require_jquery_file ( 'ajaxqueue' );
ui_require_jquery_file ( 'bgiframe' );
2010-09-29 12:28:10 +02:00
?>
< script type = " text/javascript " >
/* <![CDATA[ */
2014-12-02 16:38:07 +01:00
2015-02-04 11:18:34 +01:00
var limit_parameters_massive = < ? php echo $config [ 'limit_parameters_massive' ]; ?> ;
2010-09-29 12:28:10 +02:00
//Use this function for change 3 icons when change the selectbox
$ ( document ) . ready ( function () {
2019-01-30 16:18:44 +01:00
var checked = $ ( " #cascade_protection " ) . val ();
$ ( " #cascade_protection_module " ) . attr ( " disabled " , 'disabled' );
$ ( " #cascade_protection " ) . change ( function () {
var checked = $ ( " #cascade_protection " ) . val ();
if ( checked == 1 ) {
$ ( " #cascade_protection_module " ) . removeAttr ( " disabled " );
}
else {
$ ( " #cascade_protection_module " ) . val ( 0 );
$ ( " #cascade_protection_module " ) . attr ( " disabled " , 'disabled' );
}
});
2019-11-26 16:44:53 +01:00
// Enable Safe Operation Mode if 'Enabled' is selected.
$ ( " #safe_mode_module " ) . attr ( " disabled " , " disabled " );
$ ( " #safe_mode_change " ) . on ( 'change' , function () {
if ( $ ( " #safe_mode_change " ) . val () == 1 ) {
$ ( " #safe_mode_module " ) . removeAttr ( " disabled " );
refreshSafeModules ();
}
else {
$ ( " #safe_mode_module " ) . attr ( " disabled " , " disabled " );
$ ( '#safe_mode_module' ) . empty ();
$ ( " #safe_mode_module " ) . append ( $ ( " <option></option> " ) . attr ( " value " , 'Any' ) . html ( 'Any' ));
}
});
// Fill modules in Safe Operation Mode.
function refreshSafeModules (){
var idAgents = Array ();
jQuery . each ( $ ( " #id_agents option:selected " ), function ( i , val ) {
idAgents . push ( $ ( val ) . val ());
});
var params = {
" page " : " operation/agentes/ver_agente " ,
" get_agent_modules_json_for_multiple_agents " : 1 ,
" id_agent " : idAgents ,
" selection_mode " : " common "
};
jQuery . post ( " ajax.php " ,
params ,
function ( data , status ) {
$ ( '#safe_mode_module' ) . empty ();
if ( $ . type ( data ) === " object " ){
jQuery . each ( data , function ( id , value ) {
option = $ ( " <option></option> " ) . attr ( " value " , value ) . html ( value );
$ ( " #safe_mode_module " ) . append ( option );
});
} else {
option = $ ( " <option></option> " ) . attr ( " value " , 'None' ) . html ( 'None' );
$ ( " #safe_mode_module " ) . append ( option );
}
},
" json "
);
}
2019-01-30 16:18:44 +01:00
$ ( " #form_agent " ) . submit ( function () {
var get_parameters_count = window . location . href . slice (
window . location . href . indexOf ( '?' ) + 1 ) . split ( '&' ) . length ;
var post_parameters_count = $ ( " #form_agent " ) . 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 ;
}
});
var disabled ;
$ ( " #disabled " ) . click ( function () {
disabled = this . value ;
$ ( " #id_group " ) . trigger ( " change " );
});
2019-11-26 16:44:53 +01:00
$ ( '#id_agents' ) . on ( 'change' , function () {
2019-01-30 16:18:44 +01:00
var idAgents = Array ();
jQuery . each ( $ ( " #id_agents option:selected " ), function ( i , val ) {
idAgents . push ( $ ( val ) . val ());
});
jQuery . post ( " ajax.php " ,
{ " page " : " godmode/massive/massive_edit_agents " ,
" get_n_conf_files " : 1 ,
" id_agents[] " : idAgents
},
function ( data , status ) {
if ( data == 0 ) {
$ ( " #delete_configurations " ) . attr ( " style " , " display: none " );
$ ( " #not_available_configurations " ) . attr ( " style " , " " );
}
else {
$ ( " #n_configurations " ) . text ( data );
$ ( " #not_available_configurations " ) . attr ( " style " , " display: none " );
$ ( " #delete_configurations " ) . attr ( " style " , " " );
}
},
" json "
);
$ ( " #form_agents " ) . attr ( " style " , " " );
2019-11-26 16:44:53 +01:00
if ( $ ( " #safe_mode_change " ) . val () == 1 ) {
refreshSafeModules ();
}
2019-01-30 16:18:44 +01:00
});
$ ( " #id_group " ) . change ( function () {
$ ( " #form_agents " ) . attr ( " style " , " display: none " );
});
$ ( " select#id_os " ) . pandoraSelectOS ();
var recursion ;
$ ( " #checkbox-recursion2 " ) . click ( function () {
recursion = this . checked ? 1 : 0 ;
$ ( " #id_group " ) . trigger ( " change " );
});
$ ( " #id_group " ) . pandoraSelectGroupAgent ({
status_agents : function () {
return $ ( " #status_agents " ) . val ();
},
agentSelect : " select#id_agents " ,
privilege : " AW " ,
recursion : function () {
return recursion ;
},
disabled : function () {
return disabled ;
}
});
$ ( " #status_agents " ) . change ( function () {
$ ( " #id_group " ) . trigger ( " change " );
});
disabled = 2 ;
2017-02-01 17:31:39 +01:00
$ ( " #id_group " ) . trigger ( " change " );
2019-01-30 16:18:44 +01:00
2010-09-29 12:28:10 +02:00
});
2012-04-04 14:58:46 +02:00
function changeIcons () {
2019-01-30 16:18:44 +01:00
var icon = $ ( " #icon_path :selected " ) . val ();
$ ( " #icon_without_status " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_default " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_ok " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_bad " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_warning " ) . attr ( " src " , " images/spinner.png " );
if ( icon . length == 0 ) {
$ ( " #icon_without_status " ) . attr ( " style " , " display:none; " );
$ ( " #icon_default " ) . attr ( " style " , " display:none; " );
$ ( " #icon_ok " ) . attr ( " style " , " display:none; " );
$ ( " #icon_bad " ) . attr ( " style " , " display:none; " );
$ ( " #icon_warning " ) . attr ( " style " , " display:none; " );
}
else {
$ ( " #icon_without_status " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .default.png " );
$ ( " #icon_default " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .default.png " );
$ ( " #icon_ok " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .ok.png " );
$ ( " #icon_bad " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .bad.png " );
$ ( " #icon_warning " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .warning.png " );
$ ( " #icon_without_status " ) . attr ( " style " , " " );
$ ( " #icon_default " ) . attr ( " style " , " " );
$ ( " #icon_ok " ) . attr ( " style " , " " );
$ ( " #icon_bad " ) . attr ( " style " , " " );
$ ( " #icon_warning " ) . attr ( " style " , " " );
}
2012-04-04 14:58:46 +02:00
}
2010-09-29 12:28:10 +02:00
</ script >