Class: AwsAlertMonitor::Parser
- Inherits:
-
Object
- Object
- AwsAlertMonitor::Parser
- Defined in:
- lib/aws-alert-monitor/parser.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Parser
constructor
A new instance of Parser.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 8 9 |
# File 'lib/aws-alert-monitor/parser.rb', line 4 def initialize(args) log_level = args[:log_level] @config = AwsAlertMonitor::Config.new :log_level => log_level @config_file = @config.file @logger = @config.logger end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aws-alert-monitor/parser.rb', line 11 def run @config_file.each_pair do |name, data| sqs_endpoint = data['sqs_endpoint'] access_key = data['access_key'] secret_key = data['secret_key'] events = data['events'] ::AWS.config :access_key_id => access_key, :secret_access_key => secret_key @logger.info "Processing #{name}." @logger.debug "Receiving messages from #{sqs_endpoint}" count = sqs. sqs_endpoint @logger.info "Approximatley #{count} messages available." while = sqs.(sqs_endpoint) alert.process :name => name, :message => .body, :events => events @logger.info "Deleting message from queue." .delete end end end |