lib/arborist/monitor/snmp.rb
changeset 3 d46ca2b52efe
parent 1 8446f55f7e58
child 4 e6eb11b1e00d
equal deleted inserted replaced
2:3d395894a3cf 3:d46ca2b52efe
    21 class Arborist::Monitor::SNMP
    21 class Arborist::Monitor::SNMP
    22 	extend Loggability
    22 	extend Loggability
    23 	log_to :arborist
    23 	log_to :arborist
    24 
    24 
    25 	# The version of this library.
    25 	# The version of this library.
    26 	VERSION = '0.2.0'
    26 	VERSION = '0.2.1'
    27 
    27 
    28 	# "Modes" that this monitor understands.
    28 	# "Modes" that this monitor understands.
    29 	VALID_MODES = %i[ disk load memory swap process ]
    29 	VALID_MODES = %i[ disk load memory swap process ]
    30 
    30 
    31 	# The OID that returns the system environment.
    31 	# The OID that returns the system environment.
   246 		threads.map( &:join )
   246 		threads.map( &:join )
   247 
   247 
   248 		# Map everything back to identifier -> attribute(s), and send to the manager.
   248 		# Map everything back to identifier -> attribute(s), and send to the manager.
   249 		#
   249 		#
   250 		reply = self.results.each_with_object({}) do |(address, results), hash|
   250 		reply = self.results.each_with_object({}) do |(address, results), hash|
   251 			identifier = self.identifiers[ address ].first
   251 			identifier = self.identifiers[ address ] or next
   252 			hash[ identifier ] = results
   252 			hash[ identifier.first ] = results
   253 		end
   253 		end
   254 		self.log.debug "Sending to manager: %p" % [ reply ]
   254 		self.log.debug "Sending to manager: %p" % [ reply ]
   255 		return reply
   255 		return reply
   256 	end
   256 	end
   257 
   257