diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 1c369db688..0ed041d680 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -21,6 +21,21 @@ require_once 'include/functions_menu.php'; $menu_godmode = []; $menu_godmode['class'] = 'godmode'; + +if (check_acl($config['id_user'], 0, 'PM')) { + $sub = []; + $sub['godmode/servers/discovery']['text'] = __('Discover'); + $sub['godmode/servers/discovery']['id'] = 'Discover'; + $sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery']; + + // Add to menu. + $menu_godmode['discover']['text'] = __('Discovery'); + $menu_godmode['discover']['sec2'] = 'godmode/servers/discovery'; + $menu_godmode['discover']['id'] = 'god-discovery'; + $menu_godmode['discover']['sub'] = $sub; +} + + $sub = []; if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AD')) { $sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents'); @@ -200,18 +215,12 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, ' $menu_godmode['gservers']['id'] = 'god-servers'; $sub = []; - if (check_acl($config['id_user'], 0, 'PM')) { - $sub['godmode/servers/discovery']['text'] = __('Discover'); - $sub['godmode/servers/discovery']['id'] = 'Discover'; - } if (check_acl($config['id_user'], 0, 'AW')) { $sub['godmode/servers/modificar_server']['text'] = __('Manage servers'); $sub['godmode/servers/modificar_server']['id'] = 'Manage servers'; } - - // This subtabs are only for Pandora Admin if (check_acl($config['id_user'], 0, 'PM')) { enterprise_hook('ha_cluster'); diff --git a/pandora_console/images/discovery-100.png b/pandora_console/images/discovery-100.png new file mode 100644 index 0000000000..7ec755e7eb Binary files /dev/null and b/pandora_console/images/discovery-100.png differ diff --git a/pandora_console/images/discovery_green-100.png b/pandora_console/images/discovery_green-100.png new file mode 100644 index 0000000000..bcda80e4dd Binary files /dev/null and b/pandora_console/images/discovery_green-100.png differ diff --git a/pandora_console/images/gm_discovery.menu.png b/pandora_console/images/gm_discovery.menu.png new file mode 100644 index 0000000000..0f396c08c6 Binary files /dev/null and b/pandora_console/images/gm_discovery.menu.png differ diff --git a/pandora_console/images/gm_discovery_green.menu.png b/pandora_console/images/gm_discovery_green.menu.png new file mode 100644 index 0000000000..f4a387c201 Binary files /dev/null and b/pandora_console/images/gm_discovery_green.menu.png differ diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index a30978b3a8..001e9a7c32 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -167,6 +167,9 @@ li:hover ul { } /* Godmode images */ +#icon_god-discovery { + background: url(../../images/gm_discovery.menu.png) no-repeat 50% 50%; +} #icon_god-resources { background: url(../../images/gm_resources.menu.png) no-repeat 50% 50%; } diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 527dbe5054..89f1c6919a 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -28,6 +28,7 @@ use IO::Socket::INET; use POSIX qw(strftime ceil); use JSON qw(decode_json encode_json); use Encode qw(encode_utf8); +use MIME::Base64; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; @@ -252,9 +253,20 @@ sub exec_recon_script ($$$) { $macros_parameters = $macros_parameters . ' "' . $m->{"value"} . '"'; } } + + my $args = "$task->{'id_rt'} $task->{'id_group'} $task->{'create_incident'} $macros_parameters"; + + # Depending of the recon_script type (name) should be invoked + # in different ways: + if ($script->{'name'} =~ /Discovery.App/i) { + # Discovery Application recon script. Imported from heavy server plugins. + # Instantiate configuration file. + + + } if (-x $command) { - `$command $task->{'id_rt'} $task->{'id_group'} $task->{'create_incident'} $macros_parameters`; + `$command $args`; } else { logger ($pa_config, "Cannot execute recon task command $command."); }