Sha256: e6c8ee53f19f30b60729c5fe1adf8ced78bcffc73e8183cc97bca97bff316bc8

Contents?: true

Size: 765 Bytes

Versions: 14

Compression:

Stored size: 765 Bytes

Contents

interval 60

default[:http_code] = 200
default[:http_method] = 'GET'
default[:connect_timeout] = 5
default[:retry] = 0
default[:retry_delay] = 0
default[:max_time] = 10
default[:insecure] = false
default[:url] = 'http://127.0.0.1:80'
default[:service] = 'http check'

collect do

  @cmd ||= begin
    "curl -X#{plugin.http_method} -s --connect-timeout #{plugin.connect_timeout}" +
      " #{'--insecure' if plugin.insecure} " +
      " -w '%{http_code}\\n' --retry #{plugin.retry} --retry-delay #{plugin.retry_delay}" +
      " --max-time #{plugin.max_time} --fail #{plugin.url} -o /dev/null"
  end

  out = shell_out(@cmd).stdout.to_i
  event(:service => plugin.service, :metric => out, :description => "http code: #{out}", :state => out == plugin.http_code)

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kurchatov-0.0.5.pre5 examples/http.rb
kurchatov-0.0.5.pre4 examples/http.rb
kurchatov-0.0.5.pre2 examples/http.rb
kurchatov-0.0.5.pre1 examples/http.rb
kurchatov-0.0.4 examples/http.rb
kurchatov-0.0.4d examples/http.rb
kurchatov-0.0.4c examples/http.rb
kurchatov-0.0.4b examples/http.rb
kurchatov-0.0.3 examples/http.rb
kurchatov-0.0.3b examples/http.rb
kurchatov-0.0.3a examples/http.rb
kurchatov-0.0.2 examples/http.rb
kurchatov-0.0.2b examples/http.rb
kurchatov-0.0.1 examples/http.rb