require 'resolv'

class NameResolver < Scout::Plugin
  OPTIONS=<<-EOS
    nameserver:
      default: 8.8.8.8
    resolve_address:
      default: google.com
  EOS

  def build_report
    resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)])

    begin
      result = resolver.getaddress(option(:resolve_address))
    rescue Resolv::ResolvError => err
      alert('Failed to resolve', err)
    end
  end
end


Create domain name resolver plugin
Create domain name resolver plugin

Takes a nameserver and resolve_address as input and raises an alert if
resolution fails
