mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
add cps for agent, module, policies and bulk opertaion
This commit is contained in:
parent
7dc60b65a2
commit
76cd718262
@ -515,9 +515,20 @@ $table->data[4][3] = html_print_input_text ('url_description',
|
||||
$url_description, '', 45, 255, true);
|
||||
|
||||
$table->data[5][2] = __('Quiet');
|
||||
$table->data[5][3] = ui_print_help_tip(
|
||||
__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true);
|
||||
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_array[0] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Cascade protection services');
|
||||
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
@ -84,6 +84,7 @@ $direccion_agente = io_safe_input($direccion_agente);
|
||||
$intervalo = SECONDS_5MINUTES;
|
||||
$ff_interval = 0;
|
||||
$quiet_module = 0;
|
||||
$cps_module = 0;
|
||||
$id_server = "";
|
||||
$max_alerts = 0;
|
||||
$modo = 1;
|
||||
@ -148,6 +149,7 @@ $tab_description = '';
|
||||
$url_description = '';
|
||||
$quiet = 0;
|
||||
$macros = '';
|
||||
$cps = 0;
|
||||
|
||||
$create_agent = (bool)get_parameter('create_agent');
|
||||
$module_macros = array ();
|
||||
@ -187,6 +189,7 @@ if ($create_agent) {
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
@ -216,8 +219,10 @@ if ($create_agent) {
|
||||
}
|
||||
|
||||
if(!$exists_alias){
|
||||
$id_agente = db_process_sql_insert ('tagente',
|
||||
array ('nombre' => $nombre_agente,
|
||||
$id_agente = db_process_sql_insert (
|
||||
'tagente',
|
||||
array (
|
||||
'nombre' => $nombre_agente,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
@ -235,7 +240,10 @@ if ($create_agent) {
|
||||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet));
|
||||
'quiet' => $quiet,
|
||||
'cps' => $cps
|
||||
)
|
||||
);
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
}
|
||||
else{
|
||||
@ -282,7 +290,8 @@ if ($create_agent) {
|
||||
"Icon path":"' . $icon_path .'",
|
||||
"Update GIS data":"' . $update_gis_data .'",
|
||||
"Url description":"' . $url_description .'",
|
||||
"Quiet":"' . (int)$quiet.'"}';
|
||||
"Quiet":"' . (int)$quiet.'",
|
||||
"Cps":"' . (int)$cps.'"}';
|
||||
|
||||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit("Agent management",
|
||||
@ -743,6 +752,7 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$old_interval = db_get_value('intervalo', 'tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
@ -803,7 +813,8 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
$direccion_agente = agents_delete_address($id_agente, $delete_ip);
|
||||
}
|
||||
|
||||
$values = array ('disabled' => $disabled,
|
||||
$values = array (
|
||||
'disabled' => $disabled,
|
||||
'id_parent' => $id_parent,
|
||||
'id_os' => $id_os,
|
||||
'modo' => $modo,
|
||||
@ -822,7 +833,9 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
'url_address' => $url_description,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet,
|
||||
'safe_mode_module' => $safe_mode_module);
|
||||
'cps' => $cps,
|
||||
'safe_mode_module' => $safe_mode_module
|
||||
);
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
$values['update_module_count'] = 1; // Force an update of the agent cache.
|
||||
@ -834,7 +847,6 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
|
||||
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
|
||||
|
||||
|
||||
if ($result == false && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent'));
|
||||
@ -897,7 +909,8 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
"Icon Path":"' . $icon_path . '",
|
||||
"Update GIS data":"' .$update_gis_data .'",
|
||||
"Url description":"' . $url_description .'",
|
||||
"Quiet":"' . (int)$quiet.'"}';
|
||||
"Quiet":"' . (int)$quiet.'",
|
||||
"Cps":"' . (int)$cps.'"}';
|
||||
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
ui_print_success_message (__('Successfully updated'));
|
||||
@ -951,6 +964,7 @@ if ($id_agente) {
|
||||
$update_gis_data = $agent["update_gis_data"];
|
||||
$url_description = $agent["url_address"];
|
||||
$quiet = $agent["quiet"];
|
||||
$cps = $agent["cps"];
|
||||
$safe_mode_module = $agent["safe_mode_module"];
|
||||
$safe_mode = ($safe_mode_module) ? 1 : 0;
|
||||
}
|
||||
@ -1001,6 +1015,7 @@ if ($update_module || $create_module) {
|
||||
$interval = (int) get_parameter ('module_interval', $intervalo);
|
||||
$ff_interval = (int) get_parameter ('module_ff_interval');
|
||||
$quiet_module = (int) get_parameter ('quiet_module');
|
||||
$cps_module = (int) get_parameter ('cps_module');
|
||||
$id_plugin = (int) get_parameter ('id_plugin');
|
||||
$id_export = (int) get_parameter ('id_export');
|
||||
$disabled = (bool) get_parameter ('disabled');
|
||||
@ -1318,6 +1333,7 @@ if ($update_module) {
|
||||
'unit' => io_safe_output($unit),
|
||||
'macros' => $macros,
|
||||
'quiet' => $quiet_module,
|
||||
'cps' => $cps_module,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
@ -1500,6 +1516,7 @@ if ($create_module) {
|
||||
'unit' => io_safe_output($unit),
|
||||
'macros' => $macros,
|
||||
'quiet' => $quiet_module,
|
||||
'cps' => $cps_module,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
|
@ -162,6 +162,7 @@ if ($id_agent_module) {
|
||||
}
|
||||
$ff_interval = $module['module_ff_interval'];
|
||||
$quiet_module = $module['quiet'];
|
||||
$cps_module = $module['cps'];
|
||||
$unit = $module['unit'];
|
||||
$tcp_port = $module['tcp_port'];
|
||||
$tcp_send = $module['tcp_send'];
|
||||
@ -302,6 +303,7 @@ else {
|
||||
$max = '';
|
||||
$interval = '';
|
||||
$quiet_module = 0;
|
||||
$cps_module = 0;
|
||||
$unit = '';
|
||||
$prediction_module = '';
|
||||
$custom_integer_1 = 0;
|
||||
|
@ -566,11 +566,20 @@ if ($__code_from == 'modules') {
|
||||
}
|
||||
|
||||
$table_advanced->data[7][0] = __('Quiet');
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(
|
||||
__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->colspan[7][1] = 7;
|
||||
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1,
|
||||
$quiet_module, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps_module] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_array[0] = __('Enabled');
|
||||
}
|
||||
$table_advanced->data[7][2] = __('Cascade Protection Services');
|
||||
$table_advanced->data[7][2] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table_advanced->colspan[7][3] = 5;
|
||||
$table_advanced->data[7][3] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, "", $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[8][0] = __('Critical instructions') .
|
||||
ui_print_help_tip(__("Instructions when the status is critical"), true);
|
||||
|
@ -82,6 +82,8 @@ if ($update_agents) {
|
||||
$values['delete_conf'] = get_parameter('delete_conf');
|
||||
if (get_parameter('quiet_select', -1) != -1)
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
if (get_parameter('cps_select', -2) != -2)
|
||||
$values['cps'] = get_parameter('cps_select');
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
@ -392,6 +394,7 @@ $update_gis_data = -1;
|
||||
$cascade_protection = -1;
|
||||
$cascade_protection_module = -1;
|
||||
$quiet_select = -1;
|
||||
$cps_select = -2;
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
@ -479,6 +482,19 @@ $table->data[6][1] = html_print_select(array(-1 => __('No change'),
|
||||
1 => __('Yes'), 0 => __('No')),
|
||||
"quiet_select", $quiet_select, "", '', 0, true);
|
||||
|
||||
$cps_array[-2] = __('No change');
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps_select] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_array[0] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data[7][0] = __('Cascade Protection Service');
|
||||
$table->data[7][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data[7][1] = html_print_select($cps_array, "cps_select", $cps_select, "", '', 0, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
||||
|
@ -635,18 +635,31 @@ $table->data['edit11'][0] .= ui_print_help_tip(__('The module still store data b
|
||||
$table->data['edit11'][1] = html_print_select(array(-1 => __('No change'),
|
||||
1 => __('Yes'), 0 => __('No')),
|
||||
"quiet_select", -1, "", '', 0, true);
|
||||
$table->data['edit11'][2] = __('Timeout');
|
||||
$table->data['edit11'][3] = html_print_input_text(
|
||||
|
||||
$cps_array[-2] = __('No change');
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps_select] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_array[0] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data['edit11'][2] = __('Cascade Protection Service');
|
||||
$table->data['edit11'][2] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data['edit11'][3] .= html_print_select($cps_array, "cps_select", -1, "", '', 0, true);
|
||||
|
||||
$table->data['edit16'][0] = __('Timeout');
|
||||
$table->data['edit16'][1] .= html_print_input_text(
|
||||
'max_timeout', '', '', 5, 10, true) . ' ' .
|
||||
ui_print_help_tip (
|
||||
__('Seconds that agent will wait for the execution of the module.'), true);
|
||||
|
||||
$table->data['edit16'][0] = __('Retries');
|
||||
$table->data['edit16'][1] = html_print_input_text ('max_retries', '', '', 5, 10, true) . ' ' .
|
||||
$table->data['edit16'][1] .= __('Retries');
|
||||
$table->data['edit16'][1] .= html_print_input_text ('max_retries', '', '', 5, 10, true) . ' ' .
|
||||
ui_print_help_tip (
|
||||
__('Number of retries that the module will attempt to run.'), true);
|
||||
|
||||
|
||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);;
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter" cols="65" rows="15"></textarea>';
|
||||
|
||||
@ -1500,7 +1513,6 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
$values['disabled_types_event'] = json_encode($disabled_types_event);
|
||||
}
|
||||
|
||||
|
||||
if (strlen(get_parameter('history_data')) > 0) {
|
||||
$values['history_data'] = get_parameter('history_data');
|
||||
}
|
||||
@ -1509,6 +1521,10 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
}
|
||||
|
||||
if (get_parameter('cps_select', -2) != -2) {
|
||||
$values['cps'] = get_parameter('cps_select');
|
||||
}
|
||||
|
||||
$filter_modules = false;
|
||||
|
||||
if (!is_numeric($module_name) or ($module_name != 0))
|
||||
|
Loading…
x
Reference in New Issue
Block a user