lib/puppet/reports/snmp.rb
def process
    if self.status == 'failed'
      Puppet.debug "Sending status for #{self.host} to SNMP server #{SNMP_SERVER} at #{Time.now.asctime} due to run status #{self.status} on #{self.configuration_version} in #{self.environment}"
      
      system_uptime = 12345 # Dummy value because we must provide one
      
      if SNMP_VERSION =~ /v2/
        SNMP::Manager.open(:Host => SNMP_SERVER, :Version => :SNMPv2c) do |snmp|
          snmp.trap_v2(system_uptime, PUPPETLABS_OID, trap_options)
        end
      else
        SNMP::Manager.open(:Host => SNMP_SERVER, :Version => :SNMPv1) do |snmp|
          snmp.trap_v1(PUPPETLABS_OID, ip_address, :enterpriseSpecific, SPECIFIC_TRAP_ID, system_uptime, trap_options)
        end
      end
    end
  end
# connect to PuppetDB to get ip for the node
connect to PuppetDB to get ip for the node
connect to PuppetDB to get ip for the node
def process
    if self.status == 'failed'
      Puppet.debug "Sending status for #{self.host} to SNMP server #{SNMP_SERVER} at #{Time.now.asctime} due to run status #{self.status} on #{self.configuration_version} in #{self.environment}"
      system_uptime = 12345 
      if SNMP_VERSION =~ /v2/
        SNMP::Manager.open(:Host => SNMP_SERVER, :Version => :SNMPv2c) do |snmp|
          snmp.trap_v2(system_uptime, PUPPETLABS_OID, trap_options)
        end
      else
        SNMP::Manager.open(:Host => SNMP_SERVER, :Version => :SNMPv1) do |snmp|
          snmp.trap_v1(PUPPETLABS_OID, ip_address, :enterpriseSpecific, SPECIFIC_TRAP_ID, system_uptime, trap_options)
        end
      end
    end
  end
def process if self . status == 'failed' Puppet . debug "Sending status for #{self.host} to SNMP server #{SNMP_SERVER} at #{Time.now.asctime} due to run status #{self.status} on #{self.configuration_version} in #{self.environment}" system_uptime = 12345 if SNMP_VERSION =~ / v2 / SNMP :: Manager . open ( :Host => SNMP_SERVER , :Version => :SNMPv2c ) do | snmp | snmp . trap_v2 ( system_uptime , PUPPETLABS_OID , trap_options ) end else SNMP :: Manager . open ( :Host => SNMP_SERVER , :Version => :SNMPv1 ) do | snmp | snmp . trap_v1 ( PUPPETLABS_OID , ip_address , :enterpriseSpecific , SPECIFIC_TRAP_ID , system_uptime , trap_options ) end end end end
connect to PuppetDB to get ip for the node
connect to PuppetDB to get ip for the node
# Dummy value because we must provide one