srvmonitor 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/srvmonitor/scouts/timed_http.rb +7 -5
- data/lib/srvmonitor/version.rb +1 -1
- metadata +1 -1
@@ -50,6 +50,7 @@ module SrvMonitor
|
|
50
50
|
@response_time = (Time.now - previous_time) * 1000 # Miliseconds
|
51
51
|
@response_code = response.code.to_i
|
52
52
|
@response_body = response.body
|
53
|
+
end
|
53
54
|
rescue Timeout::Error
|
54
55
|
@response_time = (Time.now - previous_time).round
|
55
56
|
@response_code = @response_body = nil
|
@@ -61,11 +62,12 @@ module SrvMonitor
|
|
61
62
|
def remote_exec
|
62
63
|
previous_time = Time.now
|
63
64
|
Timeout::timeout(@timeout) do
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
server.exec do |ssh|
|
66
|
+
response = ssh.exec!("curl --write-out %{http_code}:%{time_total} --silent --output /dev/null #{ url }")
|
67
|
+
@response_code = response.split(':').first.to_i
|
68
|
+
@response_time = response.split(':').last.to_f * 1000
|
69
|
+
@response_body = ssh.exec!("curl #{ url }")
|
70
|
+
end
|
69
71
|
end
|
70
72
|
rescue Timeout::Error
|
71
73
|
@response_time = (Time.now - previous_time).round
|
data/lib/srvmonitor/version.rb
CHANGED