Added new functionality in CLI create_network_component

Former-commit-id: 89e2bf6002da2f68c09d06e6756f8a7be7c4c241
This commit is contained in:
samucarc 2019-03-20 12:48:44 +01:00
parent 392c0d0bff
commit d7e5858050
1 changed files with 22 additions and 0 deletions

View File

@ -155,6 +155,7 @@ sub help_screen{
help_screen_line('--update_module', '<module_name> <agent_name> <field_to_change> <new_value>', 'Update a module field');
help_screen_line('--get_agents_module_current_data', '<module_name>', "Get the agent and current data \n\t of all the modules with a given name");
help_screen_line('--create_network_module_from_component', '<agent_name> <component_name>', "Create a new network \n\t module from a network component");
help_screen_line('--create_network_component', "<network_component_name> <network_component_group> <network_component_type> \n\t [<description> <module_interval> <max_value> <min_value> \n\t <snmp_community> <id_module_group> <max_timeout> \n\t <history_data> <min_warning> <max_warning> \n\t <str_warning> <min_critical> <max_critical> \n\t <str_critical> <min_ff_event> <post_process> \n\t <disabled_types_event> <each_ff> <min_ff_event_normal> \n\t <min_ff_event_warning> <min_ff_event_critical>]", "Create a new network component");
help_screen_line('--create_synthetic', "<module_name> <synthetic_type> <agent_name> <source_agent1>,<operation>,<source_module1>|<source_agent1>,<source_module1> \n\t [ <operation>,<fixed_value> | <source agent2>,<operation>,<source_module2> ]", "Create a new Synthetic module");
print "\nALERTS:\n\n" unless $param ne '';
help_screen_line('--create_template_module', '<template_name> <module_name> <agent_name>', 'Add alert template to module');
@ -1685,6 +1686,23 @@ sub cli_create_network_module_from_component() {
pandora_create_module_from_network_component ($conf, $component, $agent_id, $dbh);
}
##############################################################################
# Create a network component.
# Related option: --create_network_component
##############################################################################
sub cli_create_network_component() {
my ($c_name, $c_group, $c_type) = @ARGV[2..4];
my @todo = @ARGV[5..20];
my $other = join('|', @todo);
my @todo2 = @ARGV[22..26];
my $other2 = join('|', @todo2);
# Call the API.
my $result = api_call( $conf, 'set', 'new_network_component', $c_name, undef, "$c_type|$other|$c_group|$other2");
print "$result \n\n ";
}
##############################################################################
# Create netflow filter
# Related option: --create_netflow_filter
@ -6204,6 +6222,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 2);
cli_create_network_module_from_component();
}
elsif ($param eq '--create_network_component') {
param_check($ltotal, 24, 21);
cli_create_network_component();
}
elsif ($param eq '--create_netflow_filter') {
param_check($ltotal, 5);
cli_create_netflow_filter();