lib/arborist/monitor/fping.rb
changeset 6 f82534b40e06
parent 5 6cf2c60c80f7
child 7 919f139d2931
equal deleted inserted replaced
5:6cf2c60c80f7 6:f82534b40e06
    24 module Arborist::Monitor::FPing
    24 module Arborist::Monitor::FPing
    25 	extend Loggability
    25 	extend Loggability
    26 	log_to :arborist
    26 	log_to :arborist
    27 
    27 
    28 	# The version of this library.
    28 	# The version of this library.
    29 	VERSION = '0.2.0'
    29 	VERSION = '0.1.2'
    30 
    30 
    31 	# Always request the node addresses.
    31 	# Always request the node addresses.
    32 	USED_PROPERTIES = [ :addresses ].freeze
    32 	USED_PROPERTIES = [ :addresses ].freeze
    33 
    33 
    34 	### Return the properties used by this monitor.
    34 	### Return the properties used by this monitor.
    45 		self.log.debug "Building fping input for %d nodes" % [ nodes.size ]
    45 		self.log.debug "Building fping input for %d nodes" % [ nodes.size ]
    46 		self.identifiers = nodes.each_with_object({}) do |(identifier, props), hash|
    46 		self.identifiers = nodes.each_with_object({}) do |(identifier, props), hash|
    47 			next unless props.key?( 'addresses' )
    47 			next unless props.key?( 'addresses' )
    48 			address = props[ 'addresses' ].first
    48 			address = props[ 'addresses' ].first
    49 			hash[ address ] = identifier
    49 			hash[ address ] = identifier
    50 			self.log.debug "%s -> %s" % [ identifier, address ]
       
    51 		end
    50 		end
    52 
    51 
    53 		return if self.identifiers.empty?
    52 		return if self.identifiers.empty?
    54 
    53 
    55 		self.identifiers.keys.each{|ip| io.puts(ip) }
    54 		self.identifiers.keys.each{|ip| io.puts(ip) }