class Proxy::Monitoring::Api

Public Instance Methods

log_provider_errors() { || ... } click to toggle source
# File lib/smart_proxy_monitoring/monitoring_api.rb, line 85
def log_provider_errors
  yield
rescue Proxy::Monitoring::NotFound => e
  log_halt 404, e
rescue Proxy::Monitoring::ConnectionError => e
  log_halt 503, e
rescue Proxy::Monitoring::AuthenticationError => e
  log_halt 500, e
rescue Exception => e
  log_halt 400, e
end
strip_domain(name) click to toggle source
# File lib/smart_proxy_monitoring/monitoring_api.rb, line 101
def strip_domain(name)
  domain = Proxy::Monitoring::Plugin.settings.strip_domain
  name.slice!(domain) unless domain.nil?
  name
end
validate_dns_name!(name) click to toggle source
# File lib/smart_proxy_monitoring/monitoring_api.rb, line 97
def validate_dns_name!(name)
  raise Proxy::Monitoring::Error.new("Invalid DNS name #{name}") unless name =~ /^([a-zA-Z0-9]([-a-zA-Z0-9]+)?\.?)+$/
end