mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Improvements and fixes H&D with review
This commit is contained in:
parent
1a2fd7ac09
commit
762ad3106d
@ -12,7 +12,7 @@ CREATE TABLE `tdiscovery_tmp_agents` (
|
|||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`id_rt` int(10) unsigned NOT NULL,
|
`id_rt` int(10) unsigned NOT NULL,
|
||||||
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
`data` text,
|
`data` MEDIUMTEXT,
|
||||||
`review_date` datetime DEFAULT NULL,
|
`review_date` datetime DEFAULT NULL,
|
||||||
`created` datetime DEFAULT NULL,
|
`created` datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
@ -1698,7 +1698,7 @@ CREATE TABLE `tdiscovery_tmp_agents` (
|
|||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`id_rt` int(10) unsigned NOT NULL,
|
`id_rt` int(10) unsigned NOT NULL,
|
||||||
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
`data` text,
|
`data` MEDIUMTEXT,
|
||||||
`review_date` datetime DEFAULT NULL,
|
`review_date` datetime DEFAULT NULL,
|
||||||
`created` datetime DEFAULT NULL,
|
`created` datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
@ -523,6 +523,7 @@ class DiscoveryTaskList extends HTML
|
|||||||
$data[4] = '-';
|
$data[4] = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$can_be_reviewed = false;
|
||||||
if ($task['review_mode'] == DISCOVERY_STANDARD) {
|
if ($task['review_mode'] == DISCOVERY_STANDARD) {
|
||||||
if ($task['status'] <= 0
|
if ($task['status'] <= 0
|
||||||
&& empty($task['summary']) === false
|
&& empty($task['summary']) === false
|
||||||
@ -539,6 +540,7 @@ class DiscoveryTaskList extends HTML
|
|||||||
if ($task['status'] <= 0
|
if ($task['status'] <= 0
|
||||||
&& empty($task['summary']) === false
|
&& empty($task['summary']) === false
|
||||||
) {
|
) {
|
||||||
|
$can_be_reviewed = true;
|
||||||
$data[5] = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[5] = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
$data[5] .= __('Review');
|
$data[5] .= __('Review');
|
||||||
$data[5] .= '</span>';
|
$data[5] .= '</span>';
|
||||||
@ -676,10 +678,22 @@ class DiscoveryTaskList extends HTML
|
|||||||
|
|
||||||
if (!$no_operations) {
|
if (!$no_operations) {
|
||||||
if ($task['disabled'] != 2) {
|
if ($task['disabled'] != 2) {
|
||||||
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[9] = '';
|
||||||
|
if ($can_be_reviewed) {
|
||||||
|
$data[9] .= '<a href="#" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
|
$data[9] .= html_print_image(
|
||||||
|
'images/expand.png',
|
||||||
|
true,
|
||||||
|
['title' => __('Review results')]
|
||||||
|
);
|
||||||
|
$data[9] .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
$data[9] .= html_print_image(
|
$data[9] .= html_print_image(
|
||||||
'images/eye.png',
|
'images/eye.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('View summary')]
|
||||||
);
|
);
|
||||||
$data[9] .= '</a>';
|
$data[9] .= '</a>';
|
||||||
}
|
}
|
||||||
@ -693,7 +707,8 @@ class DiscoveryTaskList extends HTML
|
|||||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
$data[9] .= html_print_image(
|
$data[9] .= html_print_image(
|
||||||
'images/dynamic_network_icon.png',
|
'images/dynamic_network_icon.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('View map')]
|
||||||
);
|
);
|
||||||
$data[9] .= '</a>';
|
$data[9] .= '</a>';
|
||||||
}
|
}
|
||||||
@ -713,13 +728,15 @@ class DiscoveryTaskList extends HTML
|
|||||||
)
|
)
|
||||||
).'">'.html_print_image(
|
).'">'.html_print_image(
|
||||||
'images/config.png',
|
'images/config.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('Edit task')]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('Delete task')]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
} else {
|
} else {
|
||||||
// Check if is a H&D, Cloud or Application or IPAM.
|
// Check if is a H&D, Cloud or Application or IPAM.
|
||||||
@ -731,13 +748,15 @@ class DiscoveryTaskList extends HTML
|
|||||||
)
|
)
|
||||||
).'">'.html_print_image(
|
).'">'.html_print_image(
|
||||||
'images/config.png',
|
'images/config.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('Edit task')]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true
|
true,
|
||||||
|
['title' => __('Delete task')]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1214,7 +1233,6 @@ class DiscoveryTaskList extends HTML
|
|||||||
if (is_array($task_data)) {
|
if (is_array($task_data)) {
|
||||||
foreach ($task_data as $agent) {
|
foreach ($task_data as $agent) {
|
||||||
$data = json_decode(base64_decode($agent['data']), true);
|
$data = json_decode(base64_decode($agent['data']), true);
|
||||||
|
|
||||||
if (is_array($data) === false) {
|
if (is_array($data) === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1287,10 +1305,13 @@ class DiscoveryTaskList extends HTML
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo '<div>';
|
echo '<div>';
|
||||||
echo $this->progressTaskSummary($task);
|
echo $this->progressTaskSummary($task);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
if (count($simple_data) > 0) {
|
||||||
echo '<div class="subtitle">';
|
echo '<div class="subtitle">';
|
||||||
echo '<span>';
|
echo '<span>';
|
||||||
echo __('Please select devices to be monitored');
|
echo __('Please select devices to be monitored');
|
||||||
@ -1309,7 +1330,6 @@ class DiscoveryTaskList extends HTML
|
|||||||
echo '</button>';
|
echo '</button>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<form id="review">';
|
echo '<form id="review">';
|
||||||
echo '<div id="tree"></div>';
|
echo '<div id="tree"></div>';
|
||||||
echo parent::printTree(
|
echo parent::printTree(
|
||||||
@ -1317,6 +1337,12 @@ class DiscoveryTaskList extends HTML
|
|||||||
$simple_data
|
$simple_data
|
||||||
);
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="subtitle">';
|
||||||
|
echo '<span>';
|
||||||
|
echo __('No devices found in temporary resources, please re-launch.');
|
||||||
|
echo '</span>';
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,18 @@ class HostDevices extends Wizard
|
|||||||
$interval = get_parameter('interval', 0);
|
$interval = get_parameter('interval', 0);
|
||||||
|
|
||||||
if ($network_csv_enabled) {
|
if ($network_csv_enabled) {
|
||||||
if ($_FILES['network_csv']['type'] != 'text/csv') {
|
if ($_FILES['network_csv']['type'] != 'text/csv'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/plain'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'application/octet-stream'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'application/vnd.ms-excel'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/x-csv'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'application/csv'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'application/x-csv'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/csv'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/comma-separated-values'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/x-comma-separated-values'
|
||||||
|
&& $_FILES['network_csv']['type'] != 'text/tab-separated-values'
|
||||||
|
) {
|
||||||
$this->msg = __(
|
$this->msg = __(
|
||||||
'Invalid mimetype for csv file: %s',
|
'Invalid mimetype for csv file: %s',
|
||||||
$_FILES['network_csv']['type']
|
$_FILES['network_csv']['type']
|
||||||
@ -1057,6 +1068,7 @@ class HostDevices extends Wizard
|
|||||||
'nothing_value' => 0,
|
'nothing_value' => 0,
|
||||||
'nothing' => __('None'),
|
'nothing' => __('None'),
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
|
'class' => 'select_multiple',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -722,6 +722,7 @@ function html_print_select(
|
|||||||
* @param string $style The string of style.
|
* @param string $style The string of style.
|
||||||
* @param mixed $size Max elements showed in select or default (size=10)
|
* @param mixed $size Max elements showed in select or default (size=10)
|
||||||
* @param integer $truncante_size Truncate size of the element, by default is set to GENERIC_SIZE_TEXT constant
|
* @param integer $truncante_size Truncate size of the element, by default is set to GENERIC_SIZE_TEXT constant
|
||||||
|
* @param integer $class Class to apply.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
@ -738,7 +739,8 @@ function html_print_select_from_sql(
|
|||||||
$disabled=false,
|
$disabled=false,
|
||||||
$style=false,
|
$style=false,
|
||||||
$size=false,
|
$size=false,
|
||||||
$trucate_size=GENERIC_SIZE_TEXT
|
$trucate_size=GENERIC_SIZE_TEXT,
|
||||||
|
$class=''
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -770,7 +772,7 @@ function html_print_select_from_sql(
|
|||||||
$return,
|
$return,
|
||||||
$multiple,
|
$multiple,
|
||||||
$sort,
|
$sort,
|
||||||
'',
|
$class,
|
||||||
$disabled,
|
$disabled,
|
||||||
$style,
|
$style,
|
||||||
'',
|
'',
|
||||||
@ -3589,7 +3591,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||||
((isset($data['style']) === true) ? $data['style'] : false),
|
((isset($data['style']) === true) ? $data['style'] : false),
|
||||||
((isset($data['size']) === true) ? $data['size'] : false),
|
((isset($data['size']) === true) ? $data['size'] : false),
|
||||||
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
|
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT),
|
||||||
|
((isset($data['class']) === true) ? $data['class'] : '')
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
* TODO: This may be at hostdevices.css
|
* TODO: This may be at hostdevices.css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#id_network_profile {
|
select.select_multiple {
|
||||||
width: 300px;
|
min-width: 500px;
|
||||||
|
width: 50%;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indented select.select_multiple {
|
||||||
|
min-width: calc(500px - 1em);
|
||||||
|
width: calc(50% - 1em);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ ul.wizard li > textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.wizard .indented {
|
.wizard .indented {
|
||||||
margin-left: 2em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wizard .std_input {
|
.wizard .std_input {
|
||||||
|
@ -822,7 +822,7 @@ CREATE TABLE `tdiscovery_tmp_agents` (
|
|||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`id_rt` int(10) unsigned NOT NULL,
|
`id_rt` int(10) unsigned NOT NULL,
|
||||||
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
`label` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
`data` text,
|
`data` MEDIUMTEXT,
|
||||||
`review_date` datetime DEFAULT NULL,
|
`review_date` datetime DEFAULT NULL,
|
||||||
`created` datetime DEFAULT NULL,
|
`created` datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
@ -497,19 +497,32 @@ sub PandoraFMS::Recon::Base::test_module($$) {
|
|||||||
|
|
||||||
} elsif (($test->{'id_tipo_modulo'} >= 1 && $test->{'id_tipo_modulo'} <= 5)
|
} elsif (($test->{'id_tipo_modulo'} >= 1 && $test->{'id_tipo_modulo'} <= 5)
|
||||||
|| ($test->{'id_tipo_modulo'} >= 21 && $test->{'id_tipo_modulo'} <= 23)
|
|| ($test->{'id_tipo_modulo'} >= 21 && $test->{'id_tipo_modulo'} <= 23)
|
||||||
&& is_enabled($test->{'id_plugin'})
|
|
||||||
) {
|
) {
|
||||||
# Generic, plugins. (21-23 ASYNC)
|
# Generic, plugins. (21-23 ASYNC)
|
||||||
# XXX TODO: Test plugins.
|
if ($test->{'id_modulo'} == 6) {
|
||||||
return 1;
|
# WMI commands.
|
||||||
|
$value = $self->call(
|
||||||
|
'wmi_get_value',
|
||||||
|
$test->{'ip_target'},
|
||||||
|
# WMI query.
|
||||||
|
$test->{'snmp_oid'},
|
||||||
|
# Column
|
||||||
|
$test->{'tcp_port'}
|
||||||
|
);
|
||||||
|
} elsif(is_enabled($test->{'id_plugin'})) {
|
||||||
|
# XXX TODO: Test plugins. How to identify arguments? and values?
|
||||||
|
# Disabled until we can ensure result.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} elsif ($test->{'id_tipo_modulo'} >= 34 && $test->{'id_tipo_modulo'} <= 37) {
|
} elsif ($test->{'id_tipo_modulo'} >= 34 && $test->{'id_tipo_modulo'} <= 37) {
|
||||||
# Remote command.
|
# Remote command.
|
||||||
# XXX TODO: Test remote commands.
|
# XXX TODO: Test remote commands.
|
||||||
return 1;
|
# Disabled until we can ensure result.
|
||||||
|
return 0;
|
||||||
|
|
||||||
} elsif ($test->{'id_tipo_modulo'} >= 8 && $test->{'id_tipo_modulo'} <= 11) {
|
} elsif ($test->{'id_tipo_modulo'} >= 8 && $test->{'id_tipo_modulo'} <= 11) {
|
||||||
# TCP
|
# TCP
|
||||||
|
|
||||||
return 0 unless is_numeric($test->{'tcp_port'})
|
return 0 unless is_numeric($test->{'tcp_port'})
|
||||||
&& $test->{'tcp_port'} > 0
|
&& $test->{'tcp_port'} > 0
|
||||||
&& $test->{'tcp_port'} <= 65535;
|
&& $test->{'tcp_port'} <= 65535;
|
||||||
|
@ -2175,7 +2175,7 @@ sub wmi_credentials_calculation {
|
|||||||
my ($self, $target) = @_;
|
my ($self, $target) = @_;
|
||||||
|
|
||||||
# Test empty credentials.
|
# Test empty credentials.
|
||||||
my @output = `$self->{'timeout_cmd'}$self->{'wmi_client'} -N //$target "SELECT * FROM Win32_ComputerSystem" 2>&1`;
|
my @output = `$self->{'timeout_cmd'}$self->{'wmi_client'} -N //$target "SELECT * FROM Win32_ComputerSystem" 2>$DEVNULL`;
|
||||||
my $rs = $self->wmi_output_check($?, @output);
|
my $rs = $self->wmi_output_check($?, @output);
|
||||||
|
|
||||||
if ($rs == WMI_OK) {
|
if ($rs == WMI_OK) {
|
||||||
@ -2198,7 +2198,7 @@ sub wmi_credentials_calculation {
|
|||||||
my $auth = $cred->{'username'}.'%'.$cred->{'password'};
|
my $auth = $cred->{'username'}.'%'.$cred->{'password'};
|
||||||
next if $auth eq '%';
|
next if $auth eq '%';
|
||||||
|
|
||||||
@output = `$self->{'timeout_cmd'}$self->{'wmi_client'} -U $auth //$target "SELECT * FROM Win32_ComputerSystem" 2>&1`;
|
@output = `$self->{'timeout_cmd'}$self->{'wmi_client'} -U $auth //$target "SELECT * FROM Win32_ComputerSystem" 2>$DEVNULL`;
|
||||||
|
|
||||||
my $rs = $self->wmi_output_check($?, @output);
|
my $rs = $self->wmi_output_check($?, @output);
|
||||||
|
|
||||||
@ -2288,11 +2288,13 @@ sub wmi_get {
|
|||||||
sub wmi_get_command {
|
sub wmi_get_command {
|
||||||
my ($self, $target, $auth, $query) = @_;
|
my ($self, $target, $auth, $query) = @_;
|
||||||
|
|
||||||
|
return () if is_empty($target);
|
||||||
|
|
||||||
my @output;
|
my @output;
|
||||||
if (defined($auth) && $auth ne '') {
|
if (defined($auth) && $auth ne '') {
|
||||||
@output = `$self->{'timeout_cmd'}"$self->{'wmi_client'}" -U $auth //$target "$query" 2>&1`;
|
@output = `$self->{'timeout_cmd'}"$self->{'wmi_client'}" -U $auth //$target "$query" 2>$DEVNULL`;
|
||||||
}else {
|
}else {
|
||||||
@output = `$self->{'timeout_cmd'}"$self->{'wmi_client'}" -N //$target "$query" 2>&1`;
|
@output = `$self->{'timeout_cmd'}"$self->{'wmi_client'}" -N //$target "$query" 2>$DEVNULL`;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $rs = $self->wmi_output_check($?, @output);
|
my $rs = $self->wmi_output_check($?, @output);
|
||||||
@ -2301,9 +2303,12 @@ sub wmi_get_command {
|
|||||||
return @output;
|
return @output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $err = $self->{'last_wmi_error'};
|
||||||
|
$err = 'Not OK, empty error' if is_empty($err);
|
||||||
|
|
||||||
$self->call(
|
$self->call(
|
||||||
'message',
|
'message',
|
||||||
"[".$target."] WMI error: ".$self->{'last_wmi_error'},
|
"[".$target."] WMI error: ".$err,
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user