last_seen might not be defined in check_unifi
This commit is contained in:
parent
e0be2c506f
commit
221a0afe5d
|
@ -136,7 +136,7 @@ if ($unifi){
|
||||||
$json->{$_} = $obj->{$_} if (defined $obj->{$_});
|
$json->{$_} = $obj->{$_} if (defined $obj->{$_});
|
||||||
}
|
}
|
||||||
# Convert last seen into a relative time
|
# Convert last seen into a relative time
|
||||||
$json->{last_seen} = time - $obj->{last_seen};
|
$json->{last_seen} = (defined $obj->{last_seen}) ? time - $obj->{last_seen} : time;
|
||||||
# Add some more info in sys_stats
|
# Add some more info in sys_stats
|
||||||
$json->{sys_stats}->{$_} = $obj->{'system-stats'}->{$_} foreach (qw/cpu mem uptime/);
|
$json->{sys_stats}->{$_} = $obj->{'system-stats'}->{$_} foreach (qw/cpu mem uptime/);
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ if ($unifi){
|
||||||
$json->{$_} = $obj->{$_} || 0;
|
$json->{$_} = $obj->{$_} || 0;
|
||||||
}
|
}
|
||||||
# Convert last_seen to relative
|
# Convert last_seen to relative
|
||||||
$json->{last_seen} = time - $json->{last_seen};
|
$json->{last_seen} = (defined $obj->{last_seen}) ? time - $obj->{last_seen} : time;
|
||||||
|
|
||||||
# For wireless stations, we gather some more info
|
# For wireless stations, we gather some more info
|
||||||
if ($obj->{is_wired} == JSON::false){
|
if ($obj->{is_wired} == JSON::false){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user