Sha256: d088e917093ab5ed15dce4cc604b3eac16e03cc2373a233f11fa1dd75425e017

Contents?: true

Size: 1.11 KB

Versions: 35

Compression:

Stored size: 1.11 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
          @alarms.push(alarm)
          
          alarm = CfnGuardian::Models::NrpeAlarm.new(host,@environment)
          alarm.name = "#{command.to_camelcase}Critical"
          alarm.metric_name = command
          @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

35 entries across 35 versions & 1 rubygems

Version Path
cfn-guardian-0.8.1 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.8.0 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.16 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.15 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.14 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.13 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.12 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.11 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.10 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.9 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.8 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.7 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.6 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.5 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.4 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.3 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.2 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.1 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.7.0 lib/cfnguardian/resources/nrpe.rb
cfn-guardian-0.6.13 lib/cfnguardian/resources/nrpe.rb