Sha256: 52c2bd93c4becee1c6554f972127da350c4c94121445fbf5adc58f8132993ba5

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'digest/md5'
require 'cfnguardian/string'

module CfnGuardian::Resource
  class Nrpe < Base
    
    def initialize(resource, override_group = nil)
      super(resource)
      @resource_list = resource['Hosts']
      @environment = resource['Environment']
    end
    
    def default_alarms()
      @resource_list.each do |host|
        host['Commands'].each do |command|
          alarm = CfnGuardian::Models::NrpeAlarm.new(host,@environment)
          alarm.name = "#{command.to_camelcase}Warning"
          alarm.metric_name = command
          alarm.threshold = 0
          alarm.alarm_action = 'Warning'
          @alarms.push(alarm)
          
          alarm = CfnGuardian::Models::NrpeAlarm.new(host,@environment)
          alarm.name = "#{command.to_camelcase}Critical"
          alarm.metric_name = command
          alarm.threshold = 1
          alarm.alarm_action = 'Critical'
          @alarms.push(alarm)
        end
      end
    end
    
    def default_events()
      @resource_list.each do |host|
        host['Commands'].each do |command|
          @events.push(CfnGuardian::Models::NrpeEvent.new(host,@environment,command))
        end
      end
    end
    
    def default_checks()
      @checks.push(CfnGuardian::Models::NrpeCheck.new(@resource))
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cfn-guardian-0.11.9 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.8 lib/cfnguardian/resources/nrpe.rb