Sha256: 8e34ea88ab99bb39951c980922130289e8d5e9f746bc523ccfb23426b8c9eeec

Contents?: true

Size: 771 Bytes

Versions: 51

Compression:

Stored size: 771 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

51 entries across 51 versions & 1 rubygems

Version Path
kurchatov-0.4.7 examples/http.rb
kurchatov-0.4.6 examples/http.rb
kurchatov-0.4.5 examples/http.rb
kurchatov-0.4.4 examples/http.rb
kurchatov-0.4.3 examples/http.rb
kurchatov-0.4.2 examples/http.rb
kurchatov-0.4.1 examples/http.rb
kurchatov-0.3.8 examples/http.rb
kurchatov-0.3.7 examples/http.rb
kurchatov-0.3.6 examples/http.rb
kurchatov-0.3.5 examples/http.rb
kurchatov-0.3.4 examples/http.rb
kurchatov-0.3.3 examples/http.rb
kurchatov-0.3.2 examples/http.rb
kurchatov-0.3.1 examples/http.rb
kurchatov-0.3.0 examples/http.rb
kurchatov-0.2.9 examples/http.rb
kurchatov-0.2.8 examples/http.rb
kurchatov-0.2.7 examples/http.rb
kurchatov-0.2.6 examples/http.rb