Fix the matcher for slower responses.
authorMahlon E. Smith <mahlon@martini.nu>
Thu, 12 Apr 2018 10:50:57 -0700
changeset 7 919f139d2931
parent 6 f82534b40e06
child 8 4f397a05dcdf
Fix the matcher for slower responses.
lib/arborist/monitor/fping.rb
--- a/lib/arborist/monitor/fping.rb	Tue Mar 27 14:30:38 2018 -0700
+++ b/lib/arborist/monitor/fping.rb	Thu Apr 12 10:50:57 2018 -0700
@@ -61,13 +61,14 @@
 	def handle_results( pid, stdout, stderr )
 		# 8.8.8.8 is alive (32.1 ms)
 		# 8.8.4.4 is alive (14.9 ms)
+		# 1.1.1.1 is alive (236 ms)
 		# 8.8.0.1 is unreachable
 
 		return stdout.each_line.with_object({}) do |line, hash|
 			address, remainder = line.split( ' ', 2 )
 			identifier = self.identifiers[ address ] or next
 
-			if remainder =~ /is alive \((\d+\.\d+) ms\)/
+			if remainder =~ /is alive \((\d+(?:\.\d+)?) ms\)/
 				hash[ identifier ] = { rtt: Float( $1 ) }
 			else
 				hash[ identifier ] = { error: remainder.chomp }