WIP: NetworkMaps rebuild

Former-commit-id: d3ca9d0de1b718a35bbc4aae80982b2c4705a454
This commit is contained in:
fbsanchez 2019-03-14 18:51:48 +01:00
parent 99b1aadacb
commit 8c8f368993
6 changed files with 40 additions and 13 deletions

View File

@ -26,14 +26,15 @@
* ============================================================================ * ============================================================================
*/ */
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2'); // Begin.
/**
* Global Wizard generic class. Needs to be inherited. /**
* * Global Wizard generic class. Needs to be inherited.
* Used in Hostdevices class, Applications class and others, is the core of *
* Discovery proyect. * Used in Hostdevices class, Applications class and others, is the core of
*/ * Discovery proyect.
*/
class Wizard class Wizard
{ {

View File

@ -32,10 +32,6 @@ global $config;
require_once $config['homedir'].'/include/functions_networkmap.php'; require_once $config['homedir'].'/include/functions_networkmap.php';
enterprise_include_once('include/functions_networkmap.php'); enterprise_include_once('include/functions_networkmap.php');
define('SOURCE_GROUP', 0);
define('SOURCE_TASK', 1);
define('SOURCE_NETWORK', 2);
/** /**
* Manage networkmaps in Pandora FMS * Manage networkmaps in Pandora FMS
*/ */
@ -217,7 +213,7 @@ class NetworkMap
$this->loadMap(); $this->loadMap();
if (empty($this->nodes) if (empty($this->nodes)
|| empty($this->relations) && empty($this->relations)
) { ) {
$this->createMap(); $this->createMap();
} }
@ -423,7 +419,7 @@ class NetworkMap
$relations = $this->relations; $relations = $this->relations;
// Generate if there's no data in DB about nodes or relations. // Generate if there's no data in DB about nodes or relations.
if (empty($nodes) || empty($relations)) { if (empty($nodes) && empty($relations)) {
$this->generateNetworkMap(); $this->generateNetworkMap();
return; return;
} }

View File

@ -548,13 +548,28 @@ define('LAYOUT_SPRING2', 4);
// Extra: radial dynamic. // Extra: radial dynamic.
define('LAYOUT_RADIAL_DYNAMIC', 6); define('LAYOUT_RADIAL_DYNAMIC', 6);
// Map sources.
define('SOURCE_GROUP', 0);
define('SOURCE_TASK', 1);
define('SOURCE_NETWORK', 2);
// Backward compatibility ~ Migration.
define('MAP_SOURCE_GROUP', 0); define('MAP_SOURCE_GROUP', 0);
define('MAP_SOURCE_IP_MASK', 1); define('MAP_SOURCE_IP_MASK', 1);
define('NETWORKMAP_DEFAULT_WIDTH', 800); define('NETWORKMAP_DEFAULT_WIDTH', 800);
define('NETWORKMAP_DEFAULT_HEIGHT', 800); define('NETWORKMAP_DEFAULT_HEIGHT', 800);
// Discovery task types.
define('DISCOVERY_HOSTDEVICES', 0);
define('DISCOVERY_HOSTDEVICES_CUSTOM', 1);
define('DISCOVERY_CLOUD_AWS', 10);
define('DISCOVERY_APP_VMWARE', 100);
// Discovery task descriptions.
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
// Background options. // Background options.
define('CENTER', 0); define('CENTER', 0);
define('MOSAIC', 1); define('MOSAIC', 1);

View File

@ -305,6 +305,16 @@ function networkmap_generate_dot(
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$text_filter.'%")'; $filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$text_filter.'%")';
} }
/*
* Select data origin.
* group
* discovery task
* - Cloud
* - Application
* - Standar or custom
* network/mask
*/
if ($group >= 0 && empty($ip_mask)) { if ($group >= 0 && empty($ip_mask)) {
if ($dont_show_subgroups) { if ($dont_show_subgroups) {
$filter['id_grupo'] = $group; $filter['id_grupo'] = $group;

View File

@ -1041,6 +1041,9 @@ function servers_get_server_string_name(int $server)
case SERVER_TYPE_WUX: case SERVER_TYPE_WUX:
return __('WUX server'); return __('WUX server');
case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite');
default: default:
return __('N/A'); return __('N/A');
} }

View File

@ -732,6 +732,8 @@ switch ($tab) {
if (($count == 0) && ($network_map['source'] != 'empty')) { if (($count == 0) && ($network_map['source'] != 'empty')) {
if ($network_map['generated']) { if ($network_map['generated']) {
$data['nodes'] = __('Empty map'); $data['nodes'] = __('Empty map');
} else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
$data['nodes'] = __('Dynamic');
} else { } else {
$data['nodes'] = __('Pending to generate'); $data['nodes'] = __('Pending to generate');
} }