#9678 Fixed _time_down_human_ and _time_down_seconds_

This commit is contained in:
Daniel Maya 2022-10-25 13:27:49 +02:00
parent a8902fed18
commit f9b2c9a243
1 changed files with 9 additions and 5 deletions

View File

@ -1299,13 +1299,17 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
$group = get_db_single_row ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo = ?', $agent->{'id_grupo'});
}
my $agent_status;
if(ref ($module) eq "HASH") {
$agent_status = get_db_single_row ($dbh, 'SELECT * FROM tagente_estado WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
my $time_down;
if ($alert_mode == RECOVERED_ALERT && defined($extra_macros->{'_modulelaststatuschange_'})) {
$time_down = (time() - $extra_macros->{'_modulelaststatuschange_'});
} else {
my $agent_status;
if(ref ($module) eq "HASH") {
$agent_status = get_db_single_row ($dbh, 'SELECT * FROM tagente_estado WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
}
$time_down = (defined ($agent_status)) ? (time() - $agent_status->{'last_status_change'}) : undef;
}
my $time_down = (defined ($agent_status)) ? (time() - $agent_status->{'last_status_change'}) : undef;
if (is_numeric($data)) {
my $data_precision = $pa_config->{'graph_precision'};
$data = sprintf("%.$data_precision" . "f", $data);