Sha256: d8e32525fa16af57602cde0475bb8b9aa41ff5420d6c14b0ef5e9dadfeb51ce8

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 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
          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

14 entries across 14 versions & 1 rubygems

Version Path
cfn-guardian-0.11.7 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.6 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.5 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.4 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.3 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.2 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.1 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.11.0 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.10.4 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.10.1 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.10.0 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.9.2 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.9.1 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.9.0 lib/cfnguardian/resources/nrpe.rb