def do_tcpconnection_check(connection)
raise ArgumentError unless connection.is_a?(Symbiosis::Monitor::TCPConnection)
begin
puts "Testing connection to #{connection.host}:#{connection.port}"
connection.do_check
do_tcpresponse_check(connection.responses)
puts "Connection test OK"
SystemExit::EX_OK
rescue Errno::ETIMEDOUT,
Errno::ECONNREFUSED,
Errno::EPROTO,
IOError, Errno::EIO => err
puts "Connection test temporarily failed: "+err.to_s
SystemExit::EX_TEMPFAIL
rescue => err
puts "Connection test failed: "+err.to_s
SystemExit::EX_SOFTWARE
end
end