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.2.5 examples/http.rb
kurchatov-0.2.4 examples/http.rb
kurchatov-0.2.3 examples/http.rb
kurchatov-0.2.2 examples/http.rb
kurchatov-0.2.1 examples/http.rb
kurchatov-0.2.0 examples/http.rb
kurchatov-0.1.8 examples/http.rb
kurchatov-0.1.7 examples/http.rb
kurchatov-0.1.6 examples/http.rb
kurchatov-0.1.5 examples/http.rb
kurchatov-0.1.4 examples/http.rb
kurchatov-0.1.3 examples/http.rb
kurchatov-0.1.2 examples/http.rb
kurchatov-0.1.1 examples/http.rb
kurchatov-0.1.0 examples/http.rb
kurchatov-0.0.9 examples/http.rb
kurchatov-0.0.8.pre.3 examples/http.rb
kurchatov-0.0.7.pre.4 examples/http.rb
kurchatov-0.0.8.pre.2 examples/http.rb
kurchatov-0.0.8.pre.1 examples/http.rb