summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Corbacho <diana@rabbitmq.com>2017-02-22 15:56:31 +0000
committerDiana Corbacho <diana@rabbitmq.com>2017-02-22 15:56:31 +0000
commit19fcd1d49a8784159cafacb54c0af69cd70e4174 (patch)
tree5aef37450b6a2fe6b36d9fceb600cce1309cec87
parent3b8d508c257d5710fce2527bc97d99f8ec87fc1e (diff)
downloadrabbitmq-server-git-19fcd1d49a8784159cafacb54c0af69cd70e4174.tar.gz
Emit rabbit_event events when alarms go in and out of effect
-rw-r--r--src/rabbit_alarm.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index daf2c167fa..9466dd0eeb 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -128,8 +128,12 @@ handle_call(_Request, State) ->
handle_event({set_alarm, {{resource_limit, Source, Node}, []}}, State) ->
case is_node_alarmed(Source, Node, State) of
- true -> {ok, State};
- false -> handle_set_resource_alarm(Source, Node, State)
+ true ->
+ {ok, State};
+ false ->
+ rabbit_event:notify(alarm_set, [{source, Source},
+ {node, Node}]),
+ handle_set_resource_alarm(Source, Node, State)
end;
handle_event({set_alarm, Alarm}, State = #alarms{alarms = Alarms}) ->
case lists:member(Alarm, Alarms) of
@@ -141,6 +145,8 @@ handle_event({set_alarm, Alarm}, State = #alarms{alarms = Alarms}) ->
handle_event({clear_alarm, {resource_limit, Source, Node}}, State) ->
case is_node_alarmed(Source, Node, State) of
true ->
+ rabbit_event:notify(alarm_cleared, [{source, Source},
+ {node, Node}]),
handle_clear_resource_alarm(Source, Node, State);
false ->
{ok, State}