Class: AwsAlertMonitor::Alert

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-alert-monitor/alert.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Alert

Returns a new instance of Alert.



6
7
8
9
# File 'lib/aws-alert-monitor/alert.rb', line 6

def initialize(args)
  @config = args[:config]
  @logger = @config.logger
end

Instance Method Details

#process(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/aws-alert-monitor/alert.rb', line 11

def process(args)
  @name    = args[:name]
  @events  = args[:events]
  @message = args[:message]

  unless process_message
    @logger.error "Unable to process message."
    return false
  end

  @events.each_pair do |event, policy|
    @logger.info "Evaluating '#{@message_event}' against '#{event}'"
    send_alert(policy) if event == @message_event
  end
end