fix(java/awa): agent mode - show agents having empty date in LastCheck (#3180)

This commit is contained in:
llange 2021-10-13 10:11:14 +02:00 committed by GitHub
parent d8809fc7f4
commit c68e99c224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 15 deletions

View File

@ -119,8 +119,13 @@ sub manage_selection {
next;
}
next if ($result->{$mbean}->{LastCheck} !~ /^\s*(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/);
my $agent_infos = {
display => $display,
ipaddress => $result->{$mbean}->{IpAddress},
active => $result->{$mbean}->{Active} ? 'yes' : 'no',
};
if ($result->{$mbean}->{LastCheck} =~ /^\s*(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/) {
my $dt = DateTime->new(
year => $1,
month => $2,
@ -130,13 +135,14 @@ sub manage_selection {
second => $6,
%$tz
);
$agent_infos->{since} = time() - $dt->epoch;
} elsif ($result->{$mbean}->{LastCheck} =~ /^\s*00:00:00/) {
$agent_infos->{since} = 0;
} else {
next;
}
$self->{agent}->{$display} = {
display => $display,
ipaddress => $result->{$mbean}->{IpAddress},
active => $result->{$mbean}->{Active} ? 'yes' : 'no',
since => time() - $dt->epoch,
};
$self->{agent}->{$display} = $agent_infos;
}
if (scalar(keys %{$self->{agent}}) <= 0) {