Module: Handler

Included in:
Sermont
Defined in:
lib/handler/ftp.rb,
lib/handler/http.rb,
lib/handler/ping.rb,
lib/handler/mysql.rb,
lib/handler/open_port.rb

Instance Method Summary collapse

Instance Method Details

#ftp(host, port) ⇒ Object



3
4
5
# File 'lib/handler/ftp.rb', line 3

def ftp(host, port)
  open_port(host, port)
end

#http(host, port) ⇒ Object



3
4
5
# File 'lib/handler/http.rb', line 3

def http(host, port)
  open_port(host, port)
end

#mysql(host, port) ⇒ Object



3
4
5
# File 'lib/handler/mysql.rb', line 3

def mysql(host, port)
  open_port(host, port)
end

#open_port(host, port) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/handler/open_port.rb', line 5

def open_port(host, port)
  s = TCPSocket.open(host, port)
  s.close
  true
rescue Exception
  false
end

#ping(host) ⇒ Object



5
6
7
# File 'lib/handler/ping.rb', line 5

def ping(host)
  Ping::pingecho(host, 5)
end