Class: ChkDFront::Troubleshoot

Inherits:
Object
  • Object
show all
Defined in:
lib/chkdfront/troubleshoot.rb

Overview

Contains all troubleshooting functionalities. Currently, ping, http, nslookup

Class Method Summary collapse

Class Method Details

.dns_ping(host) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/chkdfront/troubleshoot.rb', line 14

def self.dns_ping(host)
  dns = Net::DNS::Resolver.start(host)
  dns.answer.select {|r| r.type == "CNAME"}&.map(&:cname)
rescue Exception => e
  puts e.message
  return []
end

.http_ping(host) ⇒ Object



9
10
11
12
# File 'lib/chkdfront/troubleshoot.rb', line 9

def self.http_ping(host)
  host = "http://#{host}" unless host.match(/^(http|https):\/\//i)
  Net::Ping::HTTP.new(host)
end

.icmp_ping(host) ⇒ Object



5
6
7
# File 'lib/chkdfront/troubleshoot.rb', line 5

def self.icmp_ping(host)
  Net::Ping::External.new(host)
end