From 7c66939f40b01250845ef09346b29dc85ce8b2c8 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Mon, 29 Jun 2020 14:27:51 +0200 Subject: [PATCH] fix alarm mode --- apps/monitoring/netdata/restapi/mode/alarms.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/monitoring/netdata/restapi/mode/alarms.pm b/apps/monitoring/netdata/restapi/mode/alarms.pm index 54e0cd9fc..88547f1c1 100644 --- a/apps/monitoring/netdata/restapi/mode/alarms.pm +++ b/apps/monitoring/netdata/restapi/mode/alarms.pm @@ -99,6 +99,7 @@ sub prefix_alarm_output { sub manage_selection { my ($self, %options) = @_; + $self->{global} = { warning => 0, critical => 0 }; $self->{alarms} = {}; my $result = $options{custom}->get_alarms(); foreach my $alarm (values %{$result->{alarms}}) { @@ -119,11 +120,7 @@ sub manage_selection { $self->{global}->{critical}++ if ($alarm->{status} =~ m/CRITICAL/); } - $self->{global} = { - total => scalar(keys %{$self->{alarms}}), - warning => 0, - critical => 0 - }; + $self->{global}->{total} = scalar(keys %{$self->{alarms}}); } 1;