diff --git a/zabbix_scripts/check_unifi b/zabbix_scripts/check_unifi index ed6c4f0..a049b7b 100755 --- a/zabbix_scripts/check_unifi +++ b/zabbix_scripts/check_unifi @@ -136,7 +136,7 @@ if ($unifi){ $json->{$_} = $obj->{$_} if (defined $obj->{$_}); } # 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 $json->{sys_stats}->{$_} = $obj->{'system-stats'}->{$_} foreach (qw/cpu mem uptime/); @@ -199,7 +199,7 @@ if ($unifi){ $json->{$_} = $obj->{$_} || 0; } # 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 if ($obj->{is_wired} == JSON::false){