diff --git a/pandora_console/extras/mr/61.sql b/pandora_console/extras/mr/61.sql
index b73069c058..2812efb2a6 100644
--- a/pandora_console/extras/mr/61.sql
+++ b/pandora_console/extras/mr/61.sql
@@ -2,6 +2,8 @@ START TRANSACTION;
ALTER TABLE `tserver` ADD COLUMN `server_keepalive_utimestamp` BIGINT NOT NULL DEFAULT 0;
+ALTER TABLE `tmap` MODIFY COLUMN `id_group` TEXT NOT NULL default '';
+
CREATE TABLE IF NOT EXISTS `tmonitor_filter` (
`id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_name` VARCHAR(600) NOT NULL,
diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php
index 7b43a3daf6..3f1a5f6e9a 100644
--- a/pandora_console/include/class/NetworkMap.class.php
+++ b/pandora_console/include/class/NetworkMap.class.php
@@ -782,7 +782,9 @@ class NetworkMap
if ($this->network) {
// Network map, based on direct network.
$nodes = networkmap_get_nodes_from_ip_mask(
- $this->network
+ $this->network,
+ false,
+ '
'
);
} else if ($this->mapOptions['map_filter']['empty_map']) {
// Empty map returns no data.
@@ -792,17 +794,22 @@ class NetworkMap
|| $this->mapOptions['map_filter']['dont_show_subgroups'] == 1
) {
// Show only current selected group.
- $filter['id_grupo'] = $this->idGroup;
+ $filter['id_grupo'] = explode(',', $this->idGroup);
} else {
// Show current group and children.
- $childrens = groups_get_children($this->idGroup, null, true);
- if (!empty($childrens)) {
- $childrens = array_keys($childrens);
+ foreach (explode(',', $this->idGroup) as $key => $group) {
+ $childrens = groups_get_children($group, null, true);
+ if (!empty($childrens)) {
+ $childrens = array_keys($childrens);
- $filter['id_grupo'] = $childrens;
- $filter['id_grupo'][] = $this->idGroup;
- } else {
- $filter['id_grupo'] = $this->idGroup;
+ if (empty($filter['id_grupo']) === false) {
+ $filter['id_grupo'] = array_merge($filter['id_grupo'], $childrens);
+ } else {
+ $filter['id_grupo'] = $childrens;
+ }
+ } else {
+ $filter['id_grupo'][] = $group;
+ }
}
}
diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php
index 120af5b571..de685384be 100644
--- a/pandora_console/include/functions_networkmap.php
+++ b/pandora_console/include/functions_networkmap.php
@@ -1356,9 +1356,10 @@ function networkmap_get_types($strict_user=false)
*/
function networkmap_get_nodes_from_ip_mask(
$ip_mask,
- $return_ids_only=false
+ $return_ids_only=false,
+ $separator=',',
) {
- $list_ip_masks = explode(',', $ip_mask);
+ $list_ip_masks = explode($separator, $ip_mask);
if (empty($list_ip_masks) === true) {
return [];
@@ -1375,14 +1376,14 @@ function networkmap_get_nodes_from_ip_mask(
$sql = sprintf(
'SELECT *
FROM `tagente`
- INNER JOIN
- (SELECT DISTINCT `id_agent` FROM
+ INNER JOIN
+ (SELECT DISTINCT `id_agent` FROM
(SELECT `id_agente` AS "id_agent", `direccion` AS "ip"
- FROM `tagente`
+ FROM `tagente`
UNION
SELECT ag.`id_agent`, a.`ip`
- FROM `taddress_agent` ag
- INNER JOIN `taddress` a
+ FROM `taddress_agent` ag
+ INNER JOIN `taddress` a
ON ag.id_a=a.id_a
) t_tmp
WHERE (-1 << %d) & INET_ATON(t_tmp.ip) = INET_ATON("%s")
diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php
index c03af62bf3..a638bc9aa9 100644
--- a/pandora_console/operation/agentes/pandora_networkmap.editor.php
+++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php
@@ -273,6 +273,25 @@ if (!empty($result)) {
if ($not_found) {
ui_print_error_message(__('Not found networkmap.'));
} else {
+ if ($disabled_source === false) {
+ echo '
';
+ echo html_print_image('images/spinner.gif', true, 'width: 50px;height: 50px;');
+ echo '
'.__('Creating map...').'
';
+ echo '
';
+ $info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.');
+ $separator = '
';
+ $info2 = __('Discovery Server discovers relationships between interfaces (L2) through SNMP and relationships between hosts (L3) through route discovery.');
+ $info3 = __('You can also create these relationships manually by editing nodes or re-passing a discovery task after adding new information (for example by adding new SNMP communities).');
+ $info4 = __('See our documentation for more information.');
+ ui_print_info_message(
+ [
+ 'no_close' => false,
+ 'message' => $info1.$separator.$info2.$separator.$info3.$separator.$info4,
+ ],
+ 'style="width: 98%;"'
+ );
+ }
+
$table = new stdClass();
$table->id = 'form_editor';
@@ -337,7 +356,14 @@ if ($not_found) {
);
$table->data[3][0] = __('Description');
- $table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
+ $table->data[3][1] = html_print_input_text(
+ 'description',
+ $description,
+ '',
+ 100,
+ 100,
+ true
+ );
$table->data[4][0] = __('Position X');
$table->data[4][1] = html_print_input_text('pos_x', $offset_x, '', 2, 10, true);
@@ -352,7 +378,23 @@ if ($not_found) {
$table->data[6][1] = html_print_input_text('scale_z', $scale_z, '', 2, 10, true).ui_print_help_tip(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
$table->data['source'][0] = __('Source');
- $table->data['source'][1] = html_print_radio_button('source', 'group', __('Group'), $source, true, $disabled_source).html_print_radio_button('source', 'recon_task', __('Discovery task'), $source, true, $disabled_source).html_print_radio_button('source', 'ip_mask', __('CIDR IP mask'), $source, true, $disabled_source);
+ $table->data['source'][1] = html_print_select(
+ [
+ 'group' => __('Group'),
+ 'recon_task' => __('Discovery task'),
+ 'ip_mask' => __('CIDR IP mask'),
+ ],
+ 'source',
+ $source,
+ '',
+ '',
+ 0,
+ true,
+ false,
+ false,
+ '',
+ $disabled_source
+ );
$table->data['source_data_recon_task'][0] = __('Source from recon task');
$table->data['source_data_recon_task'][0] .= ui_print_help_tip(
@@ -378,18 +420,28 @@ if ($not_found) {
);
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
- $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
+ $table->data['source_data_ip_mask'][1] = html_print_textarea(
+ 'ip_mask',
+ 3,
+ 5,
+ $ip_mask,
+ 'style="width: 238px"',
+ true,
+ '',
+ $disabled_source
+ );
$table->data['source_data_group'][0] = __('Source group');
$table->data['source_data_group'][1] = ''.html_print_select_groups(
$config['id_user'],
'AR',
true,
- 'id_group',
- $id_group,
+ 'id_group[]',
+ explode(',', $id_group),
'',
'',
'',
+ true,
true
).'
';
$table->data['source_data_group'][1] .= html_print_image(
@@ -498,9 +550,10 @@ if ($not_found) {
';
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 57a1d5e122..e43aaa7646 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -2323,7 +2323,7 @@ CREATE TABLE IF NOT EXISTS `tsessions_php` (
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmap` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `id_group` INT UNSIGNED NOT NULL DEFAULT 0,
+ `id_group` TEXT NOT NULL DEFAULT '',
`id_user` VARCHAR(255) NOT NULL DEFAULT '',
`type` INT UNSIGNED NOT NULL DEFAULT 0,
`subtype` INT UNSIGNED NOT NULL DEFAULT 0,