Report number of unarchived alarms in check_unifi --unifi

tags/zabbix-agent-addons-0.2.49-1
Daniel Berteaud 6 years ago
parent c793235413
commit e0b80742cc
  1. 8
      zabbix_scripts/check_unifi

@ -90,6 +90,14 @@ if ($unifi){
$json->{$_} = from_json($resp->decoded_content)->{data}->[0]->{$_} $json->{$_} = from_json($resp->decoded_content)->{data}->[0]->{$_}
foreach (qw/version build update_available/); 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) { } elsif ($dev) {
# Dev is identified by MAC # Dev is identified by MAC
$resp = $ua->get($url . '/api/s/' . $site . '/stat/device/' . $dev); $resp = $ua->get($url . '/api/s/' . $site . '/stat/device/' . $dev);

Loading…
Cancel
Save