diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3619bf91a9..d10da575fb 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -116,9 +116,9 @@ sub help_screen{ help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)'); print "\nMODULES:\n\n" unless $param ne ''; help_screen_line('--create_data_module', " [ \n\t \n\t \n\t \n\t ]", 'Add data server module to agent'); - help_screen_line('--create_network_module', " \n\t [ \n\t \n\t \n\t ]", 'Add not snmp network module to agent'); - help_screen_line('--create_snmp_module', " \n\t [ \n\t \n\t \n\t \n\t \n\t ]", 'Add snmp network module to agent'); - help_screen_line('--create_plugin_module', " \n\t [ \n\t \n\t \n\t \n\t ]", 'Add plug-in module to agent'); + help_screen_line('--create_network_module', " \n\t [ \n\t \n\t \n\t ]", 'Add not snmp network module to agent'); + help_screen_line('--create_snmp_module', " \n\t [ \n\t \n\t \n\t \n\t \n\t ]", 'Add snmp network module to agent'); + help_screen_line('--create_plugin_module', " \n\t [ \n\t \n\t \n\t \n\t ]", 'Add plug-in module to agent'); help_screen_line('--delete_module', 'Delete module from agent', ' '); help_screen_line('--data_module', " \n\t []", 'Insert data to module'); help_screen_line('--get_module_data', " []", "\n\t Show the data of a module in the last X seconds (interval) in CSV format"); @@ -1170,21 +1170,22 @@ sub cli_create_network_module($) { my $in_policy = shift; my ($policy_name, $module_name, $module_type, $agent_name, $module_address, $module_port, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, - $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical); + $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, $each_ff, + $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries); if ($in_policy == 0) { ($module_name, $module_type, $agent_name, $module_address, $module_port, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, $each_ff, $ff_threshold_normal, $ff_threshold_warning, - $ff_threshold_critical) = @ARGV[2..25]; + $ff_threshold_critical, $timeout, $retries) = @ARGV[2..27]; } else { ($policy_name, $module_name, $module_type, $module_port, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, $each_ff, $ff_threshold_normal, $ff_threshold_warning, - $ff_threshold_critical) = @ARGV[2..24]; + $ff_threshold_critical, $timeout, $retries) = @ARGV[2..26]; } my $module_name_def; @@ -1294,6 +1295,8 @@ sub cli_create_network_module($) { $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); + $parameters{'max_timeout'} = $timeout unless !defined ($timeout); + $parameters{'max_retries'} = $retries unless !defined ($retries); if ($in_policy == 0) { pandora_create_module_from_hash ($conf, \%parameters, $dbh); @@ -1314,21 +1317,21 @@ sub cli_create_snmp_module($) { $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical); + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries); if ($in_policy == 0) { ($module_name, $module_type, $agent_name, $module_address, $module_port, $version, $community, $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical) = @ARGV[2..34]; + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries) = @ARGV[2..36]; } else { ($policy_name, $module_name, $module_type, $module_port, $version, $community, $oid, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $snmp3_priv_method, $snmp3_priv_pass, $snmp3_sec_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_auth_pass, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical) = @ARGV[2..33]; + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout, $retries) = @ARGV[2..35]; } my $module_name_def; @@ -1443,6 +1446,8 @@ sub cli_create_snmp_module($) { $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); + $parameters{'max_timeout'} = $timeout unless !defined ($timeout); + $parameters{'max_retries'} = $retries unless !defined ($retries); if ($in_policy == 0) { pandora_create_module_from_hash ($conf, \%parameters, $dbh); @@ -1463,21 +1468,21 @@ sub cli_create_plugin_module($) { $user, $password, $params, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical); + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout); if ($in_policy == 0) { ($module_name, $module_type, $agent_name, $module_address, $module_port, $plugin_name, $user, $password, $params, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical) = @ARGV[2..29]; + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout) = @ARGV[2..30]; } else { ($policy_name, $module_name, $module_type, $module_port, $plugin_name, $user, $password, $params, $description, $module_group, $min, $max, $post_process, $interval, $warning_min, $warning_max, $critical_min, $critical_max, $history_data, $ff_threshold, $warning_str, $critical_str, $enable_unknown_events, - $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical) = @ARGV[2..28]; + $each_ff, $ff_threshold_normal, $ff_threshold_warning, $ff_threshold_critical, $timeout) = @ARGV[2..29]; } my $module_name_def; @@ -1583,6 +1588,7 @@ sub cli_create_plugin_module($) { $parameters{'min_ff_event_normal'} = $ff_threshold_normal unless !defined ($ff_threshold_normal); $parameters{'min_ff_event_warning'} = $ff_threshold_warning unless !defined ($ff_threshold_warning); $parameters{'min_ff_event_critical'} = $ff_threshold_critical unless !defined ($ff_threshold_critical); + $parameters{'max_timeout'} = $timeout unless !defined ($timeout); if ($in_policy == 0) { pandora_create_module_from_hash ($conf, \%parameters, $dbh); @@ -2040,6 +2046,12 @@ sub pandora_check_network_module_fields($) { } $field_value->{'field'} = 'tcp_port'; } + elsif($field_value->{'field'} eq 'timeout') { + $field_value->{'field'} = 'max_timeout'; + } + elsif($field_value->{'field'} eq 'retries') { + $field_value->{'field'} = 'max_retries'; + } else { print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for network modules\n\n"; exit; @@ -2107,6 +2119,12 @@ sub pandora_check_snmp_module_fields($) { } $field_value->{'field'} = 'tcp_port'; } + elsif($field_value->{'field'} eq 'timeout') { + $field_value->{'field'} = 'max_timeout'; + } + elsif($field_value->{'field'} eq 'retries') { + $field_value->{'field'} = 'max_retries'; + } else { print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for SNMP modules\n\n"; exit; @@ -2160,6 +2178,9 @@ sub pandora_check_plugin_module_fields($) { elsif($field_value->{'field'} eq 'module_port') { $field_value->{'field'} = 'tcp_port'; } + elsif($field_value->{'field'} eq 'timeout') { + $field_value->{'field'} = 'max_timeout'; + } else { print_log "[ERROR] The field '".$field_value->{'field'}."' is not available for plugin modules\n\n"; exit; @@ -3755,15 +3776,15 @@ sub pandora_manage_main ($$$) { cli_create_data_module(0); } elsif ($param eq '--create_network_module') { - param_check($ltotal, 24, 20); + param_check($ltotal, 26, 20); cli_create_network_module(0); } elsif ($param eq '--create_snmp_module') { - param_check($ltotal, 33, 28); + param_check($ltotal, 35, 28); cli_create_snmp_module(0); } elsif ($param eq '--create_plugin_module') { - param_check($ltotal, 28, 19); + param_check($ltotal, 29, 19); cli_create_plugin_module(0); } elsif ($param eq '--delete_module') {