Report number of unarchived alarms in check_unifi --unifi

This commit is contained in:
Daniel Berteaud 2018-09-15 14:05:33 +02:00
parent c793235413
commit e0b80742cc

View File

@ -90,6 +90,14 @@ if ($unifi){
$json->{$_} = from_json($resp->decoded_content)->{data}->[0]->{$_}
foreach (qw/version build update_available/);
# Get unarchived alarms
$resp = $ua->post($url . '/api/s/' . $site . '/stat/alarm',
Content => to_json({ archived => 'false' }),
Content_Type => 'application/json;charset=UTF-8'
);
die $resp->message . "\n" if $resp->is_error;
$json->{alarm} = scalar @{from_json($resp->decoded_content)->{data}};
} elsif ($dev) {
# Dev is identified by MAC
$resp = $ua->get($url . '/api/s/' . $site . '/stat/device/' . $dev);