diff options
Diffstat (limited to 'lib/mauve/alert_group.rb')
-rw-r--r-- | lib/mauve/alert_group.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb index d8156fa..288b263 100644 --- a/lib/mauve/alert_group.rb +++ b/lib/mauve/alert_group.rb @@ -29,11 +29,14 @@ module Mauve logger.warn "no groups found for #{alert.id}" if groups.empty? # - # Notify each group. + # Notify just the group that thinks this alert is the most urgent. # - groups.each do |grp| - logger.info("notifying group #{groups[0]} of AlertID.#{alert.id}.") - grp.notify(alert) + %w(urgent normal low).each do |lvl| + this_group = groups.find{|grp| grp.level.to_s == lvl} + next if this_group.nil? + logger.info("notifying group #{this_group} of AlertID.#{alert.id} (matching #{lvl})") + this_group.notify(alert) + break end end end |