lib/wmap/network_profiler.rb
# Wrapper for local ping executable. This is needed if the process do not have the root privilege to operate 
#   on the raw ICMP socket
Wrapper for local ping executable. This is needed if the process do not have the root privilege to operate
on the raw ICMP socket
Wrapper for local ping executable . This is needed if the process do not have the root privilege to operate on the raw ICMP socket
def shell_pingable? (target)		
		puts "Perform ping test from the shell on: #{target}" if @verbose
		begin
            sum=0
			test_ping= `#{@which_ping} -c 3 #{target}`
			test_ping.scan(/^(.+?)\stime=(.+)\s(.+?)\n/).map do |entry|
				puts "entry: #{entry}" if @verbose
				sum=sum+entry[1].to_f
			end
			if sum > 0
				@latency = sum / 3
				puts "Ping test from the shell environment successful on #{target}." if @verbose
				return true
			else
				puts "Ping test from the shell environment fail on #{target}." if @verbose
				return false
			end
		rescue Exception => ee
			puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
			return false
		end
	end
def shell_pingable? ( target ) puts "Perform ping test from the shell on: #{target}" if @verbose begin sum = 0 test_ping = ` #{ @which_ping }  -c 3  #{ target } ` test_ping . scan ( / ^(.+?) \s time=(.+) \s (.+?) \n / ) . map do | entry | puts "entry: #{entry}" if @verbose sum = sum + entry [ 1 ] . to_f end if sum > 0 @latency = sum / 3 puts "Ping test from the shell environment successful on #{target}." if @verbose return true else puts "Ping test from the shell environment fail on #{target}." if @verbose return false end rescue Exception => ee puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose return false end end
Wrapper for local ping executable.
Wrapper for local ping executable .
target
<not_specific>