Added documentation for locale_agent call. TICKET: #3119
(cherry picked from commit aceb7ac34f
)
Conflicts:
pandora_server/util/pandora_manage.pl
This commit is contained in:
parent
1e9f086cae
commit
c12a6c1e3a
|
@ -84,15 +84,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";
|
||||
|
@ -102,12 +102,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', "<agent_name> <operating_system> <group> <server_name> \n\t [<address> <description> <interval>]", 'Create agent');
|
||||
help_screen_line('--update_agent', '<agent_name> <field_to_change> <new_value>', "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', "<agent_name> <operating_system> <group> <server_name> \n\t [<address> <description> <interval>]", 'Create agent');
|
||||
help_screen_line('--update_agent', '<agent_name> <field_to_change> <new_value>', "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', '<agent_name>', 'Delete agent');
|
||||
help_screen_line('--disable_group', '<group_name>', 'Disable agents from an entire group');
|
||||
help_screen_line('--enable_group', '<group_name>', 'Enable agents from an entire group');
|
||||
help_screen_line('--create_group', '<group_name> [<parent_group_name> <icon> <description>]', 'Create an agent group');
|
||||
help_screen_line('--enable_group', '<group_name>', 'Enable agents from an entire group');
|
||||
help_screen_line('--create_group', '<group_name> [<parent_group_name> <icon> <description>]', 'Create an agent group');
|
||||
help_screen_line('--stop_downtime', '<downtime_name>', 'Stop a planned downtime');
|
||||
help_screen_line('--create_downtime', "<downtime_name> <description> <date_from> <date_to> <id_group> <monday> <tuesday>\n\t <wednesday> <thursday> <friday> <saturday> <sunday> <periodically_time_from>\n\t <periodically_time_to> <periodically_day_from> <periodically_day_to> <type_downtime> <type_execution> <type_periodicity>", 'Create a planned downtime');
|
||||
help_screen_line('--add_item_planned_downtime', "<id_downtime> <id_agente1,id_agente2,id_agente3...id_agenteN> <name_module1,name_module2,name_module3...name_moduleN> ", 'Add a items planned downtime');
|
||||
|
@ -121,6 +121,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_conf_file', '<agent_name>', 'Delete a local conf of a given agent');
|
||||
help_screen_line('--clean_conf_file', '<agent_name>', "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', '<agent_name>', 'Search a agent into of nodes of metaconsole. Only Enterprise.');
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_network_module', "<module_name> <module_type> <agent_name> <module_address> \n\t [<module_port> <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> <timeout> <retries>]", 'Add not snmp network module to agent');
|
||||
|
@ -150,33 +151,33 @@ sub help_screen{
|
|||
help_screen_line('--update_special_day', "<special_day> <field_to_change> <new_value>", 'Update a field of a special day');
|
||||
help_screen_line('--create_data_module_from_local_component', '<agent_name> <component_name>', "Create a new data \n\t module from a local component");
|
||||
help_screen_line('--create_local_component', "<component_name> <data> [<description> <id_os> <os_version> \n\t <id_network_component_group> <type> <min> <max> <module_interval> <id_module_group> <history_data> <min_warning> \n\t <max_warning> <str_warning> <min_critical> <max_critical>\n\t <str_critical> <min_ff_event> <post_process> <unit>\n\t <wizard_level> <critical_instructions>\n\t <warning_instructions> <unknown_instructions> <critical_inverse>\n\t <warning_inverse> <id_category> <disabled_types_event>\n\t <tags> <min_ff_event_normal> <min_ff_event_warning>\n\t <min_ff_event_critical> <each_ff> <ff_timeout>]", 'Create local component');
|
||||
|
||||
|
||||
print "\nUSERS:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_user', '<user_name> <user_password> <is_admin> [<comments>]', 'Create user');
|
||||
help_screen_line('--delete_user', '<user_name>', 'Delete user');
|
||||
help_screen_line('--update_user', '<user_id> <field_to_change> <new_value>', "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', '<user_id>', 'Enable a given user');
|
||||
help_screen_line('--disable_user', '<user_id>', 'Disable a given user');
|
||||
help_screen_line('--create_profile', '<user_name> <profile_name> <group_name>', 'Add perfil to user');
|
||||
help_screen_line('--delete_profile', '<user_name> <profile_name> <group_name>', 'Delete perfil from user');
|
||||
help_screen_line('--add_profile_to_user', '<user_id> <profile_name> [<group_name>]', 'Add a profile in group to a user');
|
||||
help_screen_line('--create_user', '<user_name> <user_password> <is_admin> [<comments>]', 'Create user');
|
||||
help_screen_line('--delete_user', '<user_name>', 'Delete user');
|
||||
help_screen_line('--update_user', '<user_id> <field_to_change> <new_value>', "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', '<user_id>', 'Enable a given user');
|
||||
help_screen_line('--disable_user', '<user_id>', 'Disable a given user');
|
||||
help_screen_line('--create_profile', '<user_name> <profile_name> <group_name>', 'Add perfil to user');
|
||||
help_screen_line('--delete_profile', '<user_name> <profile_name> <group_name>', 'Delete perfil from user');
|
||||
help_screen_line('--add_profile_to_user', '<user_id> <profile_name> [<group_name>]', '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');
|
||||
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
|
||||
print "\nEVENTS:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <custom_data_json>]", 'Add event');
|
||||
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name>", 'Validate events');
|
||||
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
|
||||
help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id');
|
||||
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name>", 'Validate events');
|
||||
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
|
||||
help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id');
|
||||
help_screen_line('--add_event_comment', '<event_id> <user_name> <comment>', 'Add event\'s comment');
|
||||
print "\nINCIDENTS:\n\n" unless $param ne '';
|
||||
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');
|
||||
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');
|
||||
|
@ -185,12 +186,12 @@ 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)");
|
||||
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");
|
||||
|
||||
|
@ -198,18 +199,18 @@ sub help_screen{
|
|||
help_screen_line('--create_tag', '<tag_name> <tag_description> [<tag_url>] [<tag_email>]', 'Create a new tag');
|
||||
help_screen_line('--add_tag_to_user_profile', '<user_id> <tag_name> <group_name> <profile_name>', 'Add a tag to the given user profile');
|
||||
help_screen_line('--add_tag_to_module', '<agent_name> <module_name> <tag_name>', 'Add a tag to the given module');
|
||||
|
||||
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 = {};
|
||||
|
@ -227,14 +228,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;
|
||||
}
|
||||
|
||||
|
@ -262,7 +264,7 @@ sub pandora_enable_group ($$$) {
|
|||
if ($group == 0){
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 0");
|
||||
}
|
||||
else {
|
||||
else {
|
||||
db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group");
|
||||
}
|
||||
exit;
|
||||
|
@ -272,13 +274,13 @@ sub pandora_enable_group ($$$) {
|
|||
# Init screen
|
||||
##############################################################################
|
||||
sub pandora_manage_init ($) {
|
||||
my $conf = shift;
|
||||
|
||||
my $conf = shift;
|
||||
|
||||
$conf->{"verbosity"}=0; # Verbose 1 by default
|
||||
$conf->{"daemon"}=0; # Daemon 0 by default
|
||||
$conf->{'PID'}=""; # PID file not exist by default
|
||||
$conf->{"quiet"}=0; # Daemon 0 by default
|
||||
|
||||
|
||||
|
||||
# Load config file from command line
|
||||
help_screen () if ($#ARGV < 0);
|
||||
|
|
Loading…
Reference in New Issue