From d7e5858050b1288f703854c38db8ede64f951558 Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 20 Mar 2019 12:48:44 +0100 Subject: [PATCH] Added new functionality in CLI create_network_component Former-commit-id: 89e2bf6002da2f68c09d06e6756f8a7be7c4c241 --- pandora_server/util/pandora_manage.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 7379821f9b..2035268cae 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -155,6 +155,7 @@ sub help_screen{ 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('--create_network_module_from_component', ' ', "Create a new network \n\t module from a network component"); + help_screen_line('--create_network_component', " \n\t [ \n\t \n\t \n\t \n\t \n\t \n\t ]", "Create a new 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'); @@ -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();