From aceb7ac34fafd26efb7a47ff6b1f23a5376db89c Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 5 Jan 2016 13:17:35 +0100 Subject: [PATCH] Added documentation for locale_agent call. TICKET: #3119 --- pandora_server/util/pandora_manage.pl | 100 +++++++++++++------------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index df59d14523..c23ff782f7 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -83,15 +83,15 @@ db_disconnect ($history_dbh) if defined ($history_dbh); db_disconnect ($dbh); exit; -############################################################################### -############################################################################### +######################################################################## +######################################################################## # GENERAL FUNCTIONS -############################################################################### -############################################################################### +######################################################################## +######################################################################## -############################################################################## +######################################################################## # Print a help screen and exit. -############################################################################## +######################################################################## sub help_screen{ print "\nPandora FMS CLI $version Copyright (c) 2013-2015 Artica ST\n"; print "This program is Free Software, licensed under the terms of GPL License v2\n"; @@ -101,12 +101,12 @@ sub help_screen{ print "Available options by category:\n\n" unless $param ne ''; print "Available options for $param:\n\n" unless $param eq ''; print "AGENTS:\n\n" unless $param ne ''; - help_screen_line('--create_agent', " \n\t [
]", 'Create agent'); - help_screen_line('--update_agent', ' ', "Update an agent field. The fields can be \n\t the following: agent_name, address, description, group_name, interval, os_name, disabled (0-1), \n\t parent_name, cascade_protection (0-1), icon_path, update_gis_data (0-1), custom_id"); + help_screen_line('--create_agent', " \n\t [
]", 'Create agent'); + help_screen_line('--update_agent', ' ', "Update an agent field. The fields can be \n\t the following: agent_name, address, description, group_name, interval, os_name, disabled (0-1), \n\t parent_name, cascade_protection (0-1), icon_path, update_gis_data (0-1), custom_id"); help_screen_line('--delete_agent', '', 'Delete agent'); help_screen_line('--disable_group', '', 'Disable agents from an entire group'); - help_screen_line('--enable_group', '', 'Enable agents from an entire group'); - help_screen_line('--create_group', ' [ ]', 'Create an agent group'); + help_screen_line('--enable_group', '', 'Enable agents from an entire group'); + help_screen_line('--create_group', ' [ ]', 'Create an agent group'); help_screen_line('--stop_downtime', '', 'Stop a planned downtime'); help_screen_line('--create_downtime', " \n\t \n\t ", 'Create a planned downtime'); help_screen_line('--add_item_planned_downtime', " ", 'Add a items planned downtime'); @@ -120,24 +120,25 @@ sub help_screen{ help_screen_line('--delete_conf_file', '', 'Delete a local conf of a given agent'); help_screen_line('--clean_conf_file', '', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments"); help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)'); + help_screen_line('--locate_agent', '', 'Search a agent into of nodes of metaconsole. Only Enterprise.'); 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('--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"); - help_screen_line('--delete_data', '-m | -a | -g ', "Delete historic \n\t data of a module, the modules of an agent or the modules of the agents of a group"); + 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"); + help_screen_line('--delete_data', '-m | -a | -g ', "Delete historic \n\t data of a module, the modules of an agent or the modules of the agents of a group"); help_screen_line('--update_module', ' ', 'Update a module field'); - help_screen_line('--get_agents_module_current_data', '', "Get the agent and current data \n\t of all the modules with a given name"); + help_screen_line('--get_agents_module_current_data', '', "Get the agent and current data \n\t of all the modules with a given name"); help_screen_line('--create_network_module_from_component', ' ', "Create a new network \n\t module from a network component"); help_screen_line('--create_synthetic', " ,,|, \n\t [ , | ,, ]", "Create a new Synthetic module"); print "\nALERTS:\n\n" unless $param ne ''; - help_screen_line('--create_template_module', ' ', 'Add alert template to module'); - help_screen_line('--delete_template_module', ' ', 'Delete alert template from module'); - help_screen_line('--create_template_action', " \n\t [ ]', 'Add alert action to module-template"); - help_screen_line('--delete_template_action', " \n\t ", 'Delete alert action from module-template'); + help_screen_line('--create_template_module', ' ', 'Add alert template to module'); + help_screen_line('--delete_template_module', ' ', 'Delete alert template from module'); + help_screen_line('--create_template_action', " \n\t [ ]', 'Add alert action to module-template"); + help_screen_line('--delete_template_action', " \n\t ", 'Delete alert action from module-template'); help_screen_line('--disable_alerts', '', 'Disable alerts in all groups (system wide)'); help_screen_line('--enable_alerts', '', 'Enable alerts in all groups (system wide)'); help_screen_line('--create_alert_template', " \n\t [ \n\t \n\t \n\t ]", 'Create alert template'); @@ -149,32 +150,32 @@ sub help_screen{ help_screen_line('--update_special_day', " ", 'Update a field of a special day'); help_screen_line('--create_data_module_from_local_component', ' ', "Create a new data \n\t module from a local component"); help_screen_line('--create_local_component', " [ \n\t \n\t \n\t \n\t \n\t \n\t \n\t \n\t ]", 'Create local component'); - + print "\nUSERS:\n\n" unless $param ne ''; - help_screen_line('--create_user', ' []', 'Create user'); - help_screen_line('--delete_user', '', 'Delete user'); - help_screen_line('--update_user', ' ', "Update a user field. The fields\n\t can be the following: email, phone, is_admin (0-1), language, id_skin, flash_chart (0-1)\n\t , comments, fullname, password"); - help_screen_line('--enable_user', '', 'Enable a given user'); - help_screen_line('--disable_user', '', 'Disable a given user'); - help_screen_line('--create_profile', ' ', 'Add perfil to user'); - help_screen_line('--delete_profile', ' ', 'Delete perfil from user'); - help_screen_line('--add_profile_to_user', ' []', 'Add a profile in group to a user'); + help_screen_line('--create_user', ' []', 'Create user'); + help_screen_line('--delete_user', '', 'Delete user'); + help_screen_line('--update_user', ' ', "Update a user field. The fields\n\t can be the following: email, phone, is_admin (0-1), language, id_skin, flash_chart (0-1)\n\t , comments, fullname, password"); + help_screen_line('--enable_user', '', 'Enable a given user'); + help_screen_line('--disable_user', '', 'Disable a given user'); + help_screen_line('--create_profile', ' ', 'Add perfil to user'); + help_screen_line('--delete_profile', ' ', 'Delete perfil from user'); + help_screen_line('--add_profile_to_user', ' []', 'Add a profile in group to a user'); help_screen_line('--disable_eacl', '', 'Disable enterprise ACL system'); help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system'); print "\nEVENTS:\n\n" unless $param ne ''; help_screen_line('--create_event', " [ \n\t \n\t ]", 'Add event'); - help_screen_line('--validate_event', " \n\t ", 'Validate events'); - help_screen_line('--validate_event_id', '', 'Validate event given a event id'); - help_screen_line('--get_event_info', '[]', 'Show info about a event given a event id'); - help_screen_line('--add_event_comment', ' ', 'Add event\'s comment'); + help_screen_line('--validate_event', " \n\t ", 'Validate events'); + help_screen_line('--validate_event_id', '', 'Validate event given a event id'); + help_screen_line('--get_event_info', '[]', 'Show info about a event given a event id'); + help_screen_line('--add_event_comment', ' ', 'Add event\'s comment'); print "\nINCIDENTS:\n\n" unless $param ne ''; - help_screen_line('--create_incident', " <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents'); + help_screen_line('--create_incident', "<title> <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents'); print "\nPOLICIES:\n\n" unless $param ne ''; - help_screen_line('--apply_policy', '<policy_name>', 'Force apply a policy'); - help_screen_line('--apply_all_policies', '', 'Force apply to all the policies'); - help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy'); - help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file'); - help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy'); + help_screen_line('--apply_policy', '<policy_name>', 'Force apply a policy'); + help_screen_line('--apply_all_policies', '', 'Force apply to all the policies'); + help_screen_line('--add_agent_to_policy', '<agent_name> <policy_name>', 'Add an agent to a policy'); + help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file'); + help_screen_line('--disable_policy_alerts', '<policy_name>', 'Disable all the alerts of a policy'); help_screen_line('--create_policy_data_module', "<policy_name> <module_name> <module_type> [<description> \n\t <module_group> <min> <max> <post_process> <interval> <warning_min> <warning_max> \n\t <critical_min> <critical_max> <history_data> <data_configuration> <warning_str> \n\t <critical_str> <unknown_events> <ff_threshold> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>\n\t <ff_timeout>]", 'Add data server module to policy'); help_screen_line('--create_policy_network_module', "<policy_name> <module_name> <module_type> [<module_port> \n\t <description> <module_group> <min> <max> <post_process> <interval> \n\t <warning_min> <warning_max> <critical_min> <critical_max> <history_data> <ff_threshold> \n\t <warning_str> <critical_str> <unknown_events> <each_ff>\n\t <ff_threshold_normal> <ff_threshold_warning> <ff_threshold_critical>]", "Add not snmp network module to policy"); help_screen_line('--create_policy_snmp_module', "<policy_name> <module_name> <module_type> <module_port> \n\t <version> [<community> <oid> <description> <module_group> <min> <max> \n\t <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> <history_data>\n\t <snmp3_priv_method> <snmp3_priv_pass> <snmp3_sec_level> <snmp3_auth_method> <snmp3_auth_user> \n\t <snmp3_priv_pass> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>]", 'Add snmp network module to policy'); @@ -183,26 +184,26 @@ sub help_screen{ help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy'); help_screen_line('--get_policies', '[<agent_name>]', "Get all the policies (without parameters) or \n\tthe policies of a given agent (agent name as parameter)"); help_screen_line('--recreate_collection', '<collection_id>', 'Recreate the files of a collection'); - + print "\nNETFLOW:\n\n" unless $param ne ''; help_screen_line('--create_netflow_filter', "<filter_name> <group_name> <filter> \n\t <aggregate_by dstip|dstport|none|proto|srcip|srcport> <output_format kilobytes|kilobytespersecond|\n\t megabytes|megabytespersecond>", "Create a new netflow filter"); print "\nTOOLS:\n\n" unless $param ne ''; help_screen_line('--exec_from_file', '<file_path> <option_to_execute> <option_params>', "Execute any CLI option \n\t with macros from CSV file"); - help_screen_line('--create_snmp_trap', '<name> <oid> <description> <severity>', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)"); - print "\nSETUP:\n\n" unless $param ne ''; + help_screen_line('--create_snmp_trap', '<name> <oid> <description> <severity>', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)"); + print "\nSETUP:\n\n" unless $param ne ''; help_screen_line('--set_event_storm_protection', '<value>', "Enable (1) or disable (0) event \n\t storm protection"); - - print "\n"; + + print "\n"; exit; } -############################################################################### +######################################################################## # -############################################################################### +######################################################################## sub api_call($$$;$$$) { my ($pa_config, $op, $op2, $id, $id2, $other) = @_; my $content = undef; - + eval { # Set the parameters for the POST request. my $params = {}; @@ -220,14 +221,15 @@ sub api_call($$$;$$$) { my $ua = new LWP::UserAgent; my $url = $pa_config->{"console_api_url"}; my $response = $ua->post($url, $params); - + if ($response->is_success) { $content = $response->decoded_content(); - } else { + } + else { $content = $response->decoded_content(); } }; - + return $content; }