Sha256: e846e8799ae8fc35a40a431c0ba6d2df4672f1ce9377b935124230f6cb56b07a

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

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

module CfnGuardian::Resource
  class Nrpe < Base
    
    def initialize(resource)
      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
          @alarms.push(alarm)
          
          alarm = CfnGuardian::Models::NrpeAlarm.new(host,@environment)
          alarm.name = "#{command.to_camelcase}Critical"
          alarm.metric_name = command
          alarm.threshold = 1
          @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

5 entries across 5 versions & 1 rubygems

Version Path
cfn-guardian-0.8.6 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.8.5 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.8.4 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.8.3 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.8.2 lib/cfnguardian/resources/nrpe.rb