Ruby detect if webserver is running
<p>I'm using Ruby with dashing and wish t report the status of a few flask webservers that are running on various ports on a couple of machines.</p>

<p><a href="http://example.url.ltd:5009" rel="nofollow">http://example.url.ltd:5009</a>
<a href="http://example.urltwo.ltd:5007" rel="nofollow">http://example.urltwo.ltd:5007</a></p>

<p>Any ideas?</p>

<p>I've tried the net/http library but with no luck.</p>

<pre><code>begin
    uri = URI.parse("#{host}:#{port}")
    http = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Get.new("/ping?")

    response = http.request(request)
    return JSON.parse(response.body)
rescue
    return
end
</code></pre>

<p>Thanks.</p>