mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Merge branch 'ent-3545-8250-7558-7882-monitorizar-servicios-de-azure' into 'develop'
Ent 3545 8250 7558 7882 monitorizar servicios de azure See merge request artica/pandorafms!2591
This commit is contained in:
commit
99a219aa64
@ -534,8 +534,8 @@ echo '</div>';
|
|||||||
$('#div-extra_1').hide();
|
$('#div-extra_1').hide();
|
||||||
$('#div-extra_2').hide();
|
$('#div-extra_2').hide();
|
||||||
} else if ($('#product :selected').val() == "AZURE") {
|
} else if ($('#product :selected').val() == "AZURE") {
|
||||||
$('#div-username label').text('<?php echo __('Account ID'); ?>');
|
$('#div-username label').text('<?php echo __('Client ID'); ?>');
|
||||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
$('#div-password label').text('<?php echo __('Application secret'); ?>');
|
||||||
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
||||||
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
||||||
$('#div-extra_1').show();
|
$('#div-extra_1').show();
|
||||||
|
@ -501,41 +501,60 @@ class DiscoveryTaskList extends Wizard
|
|||||||
$data[5] = __('Pending');
|
$data[5] = __('Pending');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($task['id_recon_script'] == 0) {
|
switch ($task['type']) {
|
||||||
// Internal discovery task.
|
case DISCOVERY_CLOUD_AZURE_COMPUTE:
|
||||||
switch ($task['type']) {
|
// Discovery Applications MySQL.
|
||||||
case DISCOVERY_CLOUD_AWS_RDS:
|
$data[6] = html_print_image(
|
||||||
// Discovery Applications MySQL.
|
'images/plugin.png',
|
||||||
$data[6] = html_print_image(
|
true,
|
||||||
'images/network.png',
|
['title' => __('Discovery Cloud Azure Compute')]
|
||||||
true,
|
).' ';
|
||||||
['title' => __('Discovery Cloud RDS')]
|
$data[6] .= __('Cloud.Azure.Compute');
|
||||||
).' ';
|
break;
|
||||||
$data[6] .= __('Discovery.Cloud.Aws.RDS');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DISCOVERY_APP_MYSQL:
|
case DISCOVERY_CLOUD_AWS_EC2:
|
||||||
// Discovery Applications MySQL.
|
// Discovery Applications MySQL.
|
||||||
$data[6] = html_print_image(
|
$data[6] = html_print_image(
|
||||||
'images/network.png',
|
'images/plugin.png',
|
||||||
true,
|
true,
|
||||||
['title' => __('Discovery Applications MySQL')]
|
['title' => __('Discovery Cloud AWS EC2')]
|
||||||
).' ';
|
).' ';
|
||||||
$data[6] .= __('Discovery.App.MySQL');
|
$data[6] .= __('Cloud.AWS.EC2');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISCOVERY_APP_ORACLE:
|
case DISCOVERY_CLOUD_AWS_RDS:
|
||||||
// Discovery Applications Oracle.
|
// Discovery Cloud RDS.
|
||||||
$data[6] = html_print_image(
|
$data[6] = html_print_image(
|
||||||
'images/network.png',
|
'images/network.png',
|
||||||
true,
|
true,
|
||||||
['title' => __('Discovery Applications Oracle')]
|
['title' => __('Discovery Cloud RDS')]
|
||||||
).' ';
|
).' ';
|
||||||
$data[6] .= __('Discovery.App.Oracle');
|
$data[6] .= __('Discovery.Cloud.Aws.RDS');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISCOVERY_HOSTDEVICES:
|
case DISCOVERY_APP_MYSQL:
|
||||||
default:
|
// Discovery Applications MySQL.
|
||||||
|
$data[6] = html_print_image(
|
||||||
|
'images/network.png',
|
||||||
|
true,
|
||||||
|
['title' => __('Discovery Applications MySQL')]
|
||||||
|
).' ';
|
||||||
|
$data[6] .= __('Discovery.App.MySQL');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISCOVERY_APP_ORACLE:
|
||||||
|
// Discovery Applications Oracle.
|
||||||
|
$data[6] = html_print_image(
|
||||||
|
'images/network.png',
|
||||||
|
true,
|
||||||
|
['title' => __('Discovery Applications Oracle')]
|
||||||
|
).' ';
|
||||||
|
$data[6] .= __('Discovery.App.Oracle');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISCOVERY_HOSTDEVICES:
|
||||||
|
default:
|
||||||
|
if ($task['id_recon_script'] == 0) {
|
||||||
// Discovery NetScan.
|
// Discovery NetScan.
|
||||||
$data[6] = html_print_image(
|
$data[6] = html_print_image(
|
||||||
'images/network.png',
|
'images/network.png',
|
||||||
@ -550,15 +569,15 @@ class DiscoveryTaskList extends Wizard
|
|||||||
} else {
|
} else {
|
||||||
$data[6] .= __('Discovery.NetScan');
|
$data[6] .= __('Discovery.NetScan');
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
}
|
// APP or external script recon task.
|
||||||
} else {
|
$data[6] = html_print_image(
|
||||||
// APP recon task.
|
'images/plugin.png',
|
||||||
$data[6] = html_print_image(
|
true
|
||||||
'images/plugin.png',
|
).' ';
|
||||||
true
|
$data[6] .= $recon_script_name;
|
||||||
).' ';
|
}
|
||||||
$data[6] .= $recon_script_name;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||||
@ -699,7 +718,16 @@ class DiscoveryTaskList extends Wizard
|
|||||||
if ($script !== false) {
|
if ($script !== false) {
|
||||||
switch ($script['type']) {
|
switch ($script['type']) {
|
||||||
case DISCOVERY_SCRIPT_CLOUD_AWS:
|
case DISCOVERY_SCRIPT_CLOUD_AWS:
|
||||||
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
|
switch ($task['type']) {
|
||||||
|
case DISCOVERY_CLOUD_AWS_EC2:
|
||||||
|
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
|
||||||
|
|
||||||
|
case DISCOVERY_CLOUD_AZURE_COMPUTE:
|
||||||
|
return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0';
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 'wiz=cloud';
|
||||||
|
}
|
||||||
|
|
||||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||||
return 'wiz=app&mode=vmware&page=0';
|
return 'wiz=app&mode=vmware&page=0';
|
||||||
|
@ -582,6 +582,7 @@ define('DISCOVERY_APP_MYSQL', 4);
|
|||||||
define('DISCOVERY_APP_ORACLE', 5);
|
define('DISCOVERY_APP_ORACLE', 5);
|
||||||
define('DISCOVERY_CLOUD_AWS_EC2', 6);
|
define('DISCOVERY_CLOUD_AWS_EC2', 6);
|
||||||
define('DISCOVERY_CLOUD_AWS_RDS', 7);
|
define('DISCOVERY_CLOUD_AWS_RDS', 7);
|
||||||
|
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
|
||||||
|
|
||||||
|
|
||||||
// Discovery types matching definition.
|
// Discovery types matching definition.
|
||||||
@ -594,6 +595,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3);
|
|||||||
define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
|
define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
|
||||||
|
|
||||||
// Discovery task descriptions.
|
// Discovery task descriptions.
|
||||||
|
define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute');
|
||||||
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
||||||
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
|
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ function credentials_get_all(
|
|||||||
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($filter['product']) && !empty($filter['product'])) {
|
||||||
|
$sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
||||||
$sql_filters[] = vsprintf(
|
$sql_filters[] = vsprintf(
|
||||||
' AND (lower(cs.username) like lower("%%%s%%")
|
' AND (lower(cs.username) like lower("%%%s%%")
|
||||||
@ -163,7 +167,7 @@ function credentials_get_all(
|
|||||||
%s
|
%s
|
||||||
%s',
|
%s',
|
||||||
join(',', $fields),
|
join(',', $fields),
|
||||||
join(',', $sql_filters),
|
join(' ', $sql_filters),
|
||||||
$order_by,
|
$order_by,
|
||||||
$pagination
|
$pagination
|
||||||
);
|
);
|
||||||
@ -292,8 +296,8 @@ function print_inputs($values=null)
|
|||||||
'script' => 'calculate_inputs()',
|
'script' => 'calculate_inputs()',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
// 'CUSTOM' => __('Custom'),
|
// 'CUSTOM' => __('Custom'),
|
||||||
'AWS' => __('Aws'),
|
'AWS' => __('Aws'),
|
||||||
// 'AZURE' => __('Azure'),
|
'AZURE' => __('Azure'),
|
||||||
// 'GOOGLE' => __('Google'),
|
// 'GOOGLE' => __('Google'),
|
||||||
],
|
],
|
||||||
'selected' => $values['product'],
|
'selected' => $values['product'],
|
||||||
@ -319,7 +323,7 @@ function print_inputs($values=null)
|
|||||||
|
|
||||||
case 'AZURE':
|
case 'AZURE':
|
||||||
$user_label = __('Account ID');
|
$user_label = __('Account ID');
|
||||||
$pass_label = __('Password');
|
$pass_label = __('Application secret');
|
||||||
$extra_1_label = __('Tenant or domain name');
|
$extra_1_label = __('Tenant or domain name');
|
||||||
$extra_2_label = __('Subscription id');
|
$extra_2_label = __('Subscription id');
|
||||||
break;
|
break;
|
||||||
@ -358,7 +362,7 @@ function print_inputs($values=null)
|
|||||||
'label' => $extra_1_label,
|
'label' => $extra_1_label,
|
||||||
'name' => 'extra_1',
|
'name' => 'extra_1',
|
||||||
'input_class' => 'flex-row',
|
'input_class' => 'flex-row',
|
||||||
'type' => 'password',
|
'type' => 'text',
|
||||||
'value' => $values['extra_1'],
|
'value' => $values['extra_1'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
]
|
]
|
||||||
@ -371,7 +375,7 @@ function print_inputs($values=null)
|
|||||||
'label' => $extra_2_label,
|
'label' => $extra_2_label,
|
||||||
'name' => 'extra_2',
|
'name' => 'extra_2',
|
||||||
'input_class' => 'flex-row',
|
'input_class' => 'flex-row',
|
||||||
'type' => 'password',
|
'type' => 'text',
|
||||||
'value' => $values['extra_2'],
|
'value' => $values['extra_2'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'display' => $extra2,
|
'display' => $extra2,
|
||||||
|
@ -96,7 +96,6 @@ function snmp_browser_get_html_tree(
|
|||||||
foreach ($tree['__LEAVES__'] as $level => $sub_level) {
|
foreach ($tree['__LEAVES__'] as $level => $sub_level) {
|
||||||
// Id used to expand leafs.
|
// Id used to expand leafs.
|
||||||
$sub_id = time().rand(0, getrandmax());
|
$sub_id = time().rand(0, getrandmax());
|
||||||
|
|
||||||
// Display the branch.
|
// Display the branch.
|
||||||
$output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
|
$output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
|
||||||
|
|
||||||
@ -174,7 +173,6 @@ function snmp_browser_get_html_tree(
|
|||||||
$last_array,
|
$last_array,
|
||||||
$sufix,
|
$sufix,
|
||||||
$checked,
|
$checked,
|
||||||
$return,
|
|
||||||
$descriptive_ids,
|
$descriptive_ids,
|
||||||
$previous_id
|
$previous_id
|
||||||
);
|
);
|
||||||
@ -225,7 +223,6 @@ function snmp_browser_print_tree(
|
|||||||
$last_array,
|
$last_array,
|
||||||
$sufix,
|
$sufix,
|
||||||
$checked,
|
$checked,
|
||||||
$return,
|
|
||||||
$descriptive_ids,
|
$descriptive_ids,
|
||||||
$previous_id
|
$previous_id
|
||||||
);
|
);
|
||||||
|
@ -94,7 +94,7 @@ function pandora_session_write($session_id, $data)
|
|||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
// Avoid session upadte while processing ajax responses - notifications.
|
// Avoid session upadte while processing ajax responses - notifications.
|
||||||
if (get_parameter('check_new_notifications', false)) {
|
if (get_parameter('check_new_notifications', false)) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ if (is_ajax()) {
|
|||||||
if ($id_agente > 0) {
|
if ($id_agente > 0) {
|
||||||
$last_contact = db_get_value_sql(
|
$last_contact = db_get_value_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT intervalo - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto)))
|
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
|
||||||
FROM `tagente`
|
FROM `tagente`
|
||||||
WHERE id_agente = %d ',
|
WHERE id_agente = %d ',
|
||||||
$id_agente
|
$id_agente
|
||||||
|
@ -56,15 +56,7 @@ my $TaskSem :shared;
|
|||||||
use constant {
|
use constant {
|
||||||
OS_OTHER => 10,
|
OS_OTHER => 10,
|
||||||
OS_ROUTER => 17,
|
OS_ROUTER => 17,
|
||||||
OS_SWITCH => 18,
|
OS_SWITCH => 18
|
||||||
DISCOVERY_HOSTDEVICES => 0,
|
|
||||||
DISCOVERY_HOSTDEVICES_CUSTOM => 1,
|
|
||||||
DISCOVERY_CLOUD_AWS => 2,
|
|
||||||
DISCOVERY_APP_VMWARE => 3,
|
|
||||||
DISCOVERY_APP_MYSQL => 4,
|
|
||||||
DISCOVERY_APP_ORACLE => 5,
|
|
||||||
DISCOVERY_CLOUD_AWS_EC2 => 6,
|
|
||||||
DISCOVERY_CLOUD_AWS_RDS => 7
|
|
||||||
};
|
};
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
@ -196,49 +188,11 @@ sub data_consumer ($$) {
|
|||||||
my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh);
|
my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh);
|
||||||
|
|
||||||
my %cnf_extra;
|
my %cnf_extra;
|
||||||
if ($task->{'type'} == DISCOVERY_CLOUD_AWS_EC2
|
|
||||||
|| $task->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
|
|
||||||
# auth_strings stores the crential identifier to be used.
|
|
||||||
my $key = pandora_get_credential($dbh, $task->{'auth_strings'});
|
|
||||||
|
|
||||||
if (ref($key) eq "HASH") {
|
my $r = enterprise_hook('discovery_generate_extra_cnf',[$pa_config, $dbh, $task, \%cnf_extra]);
|
||||||
$cnf_extra{'aws_access_key_id'} = $key->{'username'};
|
if (defined($r) && $r eq 'ERR') {
|
||||||
$cnf_extra{'aws_secret_access_key'} = $key->{'password'};
|
# Could not generate extra cnf, skip this task.
|
||||||
} else {
|
return;
|
||||||
# Invalid credential.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cnf_extra{'cloud_util_path'} = pandora_get_config_value($dbh, 'cloud_util_path');
|
|
||||||
|
|
||||||
# Pass credentials by file due Perl limitations. We cannot update ENV here.
|
|
||||||
$cnf_extra{'creds_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time());
|
|
||||||
eval {
|
|
||||||
open(my $__file_cfg, '> '. $cnf_extra{'creds_file'}) or die($!);
|
|
||||||
print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n";
|
|
||||||
print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n";
|
|
||||||
close($__file_cfg);
|
|
||||||
set_file_permissions(
|
|
||||||
$pa_config,
|
|
||||||
$cnf_extra{'creds_file'},
|
|
||||||
"0600"
|
|
||||||
);
|
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
logger(
|
|
||||||
$pa_config,
|
|
||||||
'Cannot instantiate configuration file for task: ' . safe_output($task->{'name'}),
|
|
||||||
5
|
|
||||||
);
|
|
||||||
# A server restart will override ENV definition (see run)
|
|
||||||
logger(
|
|
||||||
$pa_config,
|
|
||||||
'Cannot execute Discovery task: ' . safe_output($task->{'name'}) . '. Please restart the server.',
|
|
||||||
1
|
|
||||||
);
|
|
||||||
# Skip this task.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $recon = new PandoraFMS::Recon::Base(
|
my $recon = new PandoraFMS::Recon::Base(
|
||||||
|
@ -72,6 +72,15 @@ our @EXPORT = qw(
|
|||||||
MIGRATIONSERVER
|
MIGRATIONSERVER
|
||||||
METACONSOLE_LICENSE
|
METACONSOLE_LICENSE
|
||||||
OFFLINE_LICENSE
|
OFFLINE_LICENSE
|
||||||
|
DISCOVERY_HOSTDEVICES
|
||||||
|
DISCOVERY_HOSTDEVICES_CUSTOM
|
||||||
|
DISCOVERY_CLOUD_AWS
|
||||||
|
DISCOVERY_APP_VMWARE
|
||||||
|
DISCOVERY_APP_MYSQL
|
||||||
|
DISCOVERY_APP_ORACLE
|
||||||
|
DISCOVERY_CLOUD_AWS_EC2
|
||||||
|
DISCOVERY_CLOUD_AWS_RDS
|
||||||
|
DISCOVERY_CLOUD_AZURE_COMPUTE
|
||||||
$DEVNULL
|
$DEVNULL
|
||||||
$OS
|
$OS
|
||||||
$OS_VERSION
|
$OS_VERSION
|
||||||
@ -172,6 +181,17 @@ use constant OFFLINE_LICENSE => 0x02;
|
|||||||
use constant RECOVERED_ALERT => 0;
|
use constant RECOVERED_ALERT => 0;
|
||||||
use constant FIRED_ALERT => 1;
|
use constant FIRED_ALERT => 1;
|
||||||
|
|
||||||
|
# Discovery task types
|
||||||
|
use constant DISCOVERY_HOSTDEVICES => 0;
|
||||||
|
use constant DISCOVERY_HOSTDEVICES_CUSTOM => 1;
|
||||||
|
use constant DISCOVERY_CLOUD_AWS => 2;
|
||||||
|
use constant DISCOVERY_APP_VMWARE => 3;
|
||||||
|
use constant DISCOVERY_APP_MYSQL => 4;
|
||||||
|
use constant DISCOVERY_APP_ORACLE => 5;
|
||||||
|
use constant DISCOVERY_CLOUD_AWS_EC2 => 6;
|
||||||
|
use constant DISCOVERY_CLOUD_AWS_RDS => 7;
|
||||||
|
use constant DISCOVERY_CLOUD_AZURE_COMPUTE => 8;
|
||||||
|
|
||||||
# Set OS, OS version and /dev/null
|
# Set OS, OS version and /dev/null
|
||||||
our $OS = $^O;
|
our $OS = $^O;
|
||||||
our $OS_VERSION = "unknown";
|
our $OS_VERSION = "unknown";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user