fix(java/awa): agent mode - show agents having empty date in LastCheck (#3180)
This commit is contained in:
parent
d8809fc7f4
commit
c68e99c224
|
@ -119,8 +119,13 @@ sub manage_selection {
|
||||||
next;
|
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(
|
my $dt = DateTime->new(
|
||||||
year => $1,
|
year => $1,
|
||||||
month => $2,
|
month => $2,
|
||||||
|
@ -130,13 +135,14 @@ sub manage_selection {
|
||||||
second => $6,
|
second => $6,
|
||||||
%$tz
|
%$tz
|
||||||
);
|
);
|
||||||
|
$agent_infos->{since} = time() - $dt->epoch;
|
||||||
|
} elsif ($result->{$mbean}->{LastCheck} =~ /^\s*00:00:00/) {
|
||||||
|
$agent_infos->{since} = 0;
|
||||||
|
} else {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
$self->{agent}->{$display} = {
|
$self->{agent}->{$display} = $agent_infos;
|
||||||
display => $display,
|
|
||||||
ipaddress => $result->{$mbean}->{IpAddress},
|
|
||||||
active => $result->{$mbean}->{Active} ? 'yes' : 'no',
|
|
||||||
since => time() - $dt->epoch,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{agent}}) <= 0) {
|
if (scalar(keys %{$self->{agent}}) <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue