Agent collection synchronization aysnc some improvements
This commit is contained in:
parent
9c314bcd39
commit
86f2beb587
|
@ -95,10 +95,8 @@ if ($info == 'version') {
|
||||||
|
|
||||||
if (empty($apiPassword) === true
|
if (empty($apiPassword) === true
|
||||||
|| (empty($apiPassword) === false && $api_password === $apiPassword)
|
|| (empty($apiPassword) === false && $api_password === $apiPassword)
|
||||||
&& enterprise_hook(
|
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|
||||||
'metaconsole_validate_origin',
|
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
|
||||||
[get_parameter('server_auth')]
|
|
||||||
) === true
|
|
||||||
) {
|
) {
|
||||||
// Allow internal direct node -> metaconsole connection.
|
// Allow internal direct node -> metaconsole connection.
|
||||||
$config['id_usuario'] = 'admin';
|
$config['id_usuario'] = 'admin';
|
||||||
|
|
|
@ -650,9 +650,6 @@ sub main() {
|
||||||
|
|
||||||
close (CFG);
|
close (CFG);
|
||||||
|
|
||||||
pandora_set_tconfig_token($DBH, 'internal_user_pass',
|
|
||||||
pandora_input_password(\%Config, $Config{"console_pass"})
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
logger(\%Config, "[WARNING] Error with configuration file when define `console_pass`: $!", 3);
|
logger(\%Config, "[WARNING] Error with configuration file when define `console_pass`: $!", 3);
|
||||||
}
|
}
|
||||||
|
@ -698,7 +695,6 @@ sub main() {
|
||||||
print CFG "console_user " . $Config{"console_user"} . "\n";
|
print CFG "console_user " . $Config{"console_user"} . "\n";
|
||||||
close (CFG);
|
close (CFG);
|
||||||
|
|
||||||
pandora_set_tconfig_token($DBH, 'internal_user', $Config{"console_user"});
|
|
||||||
} else {
|
} else {
|
||||||
logger(\%Config, "Warning. Was not possible edit configuration file for add console user", 3);
|
logger(\%Config, "Warning. Was not possible edit configuration file for add console user", 3);
|
||||||
}
|
}
|
||||||
|
@ -715,6 +711,12 @@ sub main() {
|
||||||
if ( $res_testing_api[0] ne 'OK' ) {
|
if ( $res_testing_api[0] ne 'OK' ) {
|
||||||
logger(\%Config, "Warning! The server does not have access to the API, this can trigger problems in the generation of reports and graphs.", 1);
|
logger(\%Config, "Warning! The server does not have access to the API, this can trigger problems in the generation of reports and graphs.", 1);
|
||||||
pandora_event (\%Config, "Server does not have access to the API", 0, 0, 0, 0, 0, 'system', 0, $DBH);
|
pandora_event (\%Config, "Server does not have access to the API", 0, 0, 0, 0, 0, 'system', 0, $DBH);
|
||||||
|
} else {
|
||||||
|
# Test successful.
|
||||||
|
pandora_set_tconfig_token($DBH, 'internal_user_pass',
|
||||||
|
pandora_input_password(\%Config, $Config{"console_pass"})
|
||||||
|
);
|
||||||
|
pandora_set_tconfig_token($DBH, 'internal_user', $Config{"console_user"});
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate 'going up' events
|
# Generate 'going up' events
|
||||||
|
|
|
@ -1340,7 +1340,9 @@ sub pandora_get_tconfig_token ($$$) {
|
||||||
sub pandora_set_tconfig_token ($$$) {
|
sub pandora_set_tconfig_token ($$$) {
|
||||||
my ($dbh, $token, $value) = @_;
|
my ($dbh, $token, $value) = @_;
|
||||||
|
|
||||||
my $token_value = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = ?", $token);
|
my $token_value = get_db_value ($dbh,
|
||||||
|
"SELECT `value` FROM `tconfig` WHERE `token` = ?", $token
|
||||||
|
);
|
||||||
if (defined ($token_value) && $token_value ne '') {
|
if (defined ($token_value) && $token_value ne '') {
|
||||||
db_update($dbh,
|
db_update($dbh,
|
||||||
'UPDATE `tconfig` SET `value`=? WHERE `token`= ?',
|
'UPDATE `tconfig` SET `value`=? WHERE `token`= ?',
|
||||||
|
|
Loading…
Reference in New Issue