Agent collection synchronization aysnc some improvements

This commit is contained in:
fbsanchez 2021-06-11 13:55:18 +02:00
parent 9c314bcd39
commit 86f2beb587
3 changed files with 11 additions and 9 deletions

View File

@ -95,10 +95,8 @@ if ($info == 'version') {
if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword)
&& enterprise_hook(
'metaconsole_validate_origin',
[get_parameter('server_auth')]
) === true
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
) {
// Allow internal direct node -> metaconsole connection.
$config['id_usuario'] = 'admin';

View File

@ -650,9 +650,6 @@ sub main() {
close (CFG);
pandora_set_tconfig_token($DBH, 'internal_user_pass',
pandora_input_password(\%Config, $Config{"console_pass"})
);
} else {
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";
close (CFG);
pandora_set_tconfig_token($DBH, 'internal_user', $Config{"console_user"});
} else {
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' ) {
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);
} 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

View File

@ -1340,7 +1340,9 @@ sub pandora_get_tconfig_token ($$$) {
sub pandora_set_tconfig_token ($$$) {
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 '') {
db_update($dbh,
'UPDATE `tconfig` SET `value`=? WHERE `token`= ?',