Sha256: b84ed91e069392ee9282f0a61a49085b41453776dbb22a52c29255e7a29ca8fe

Contents?: true

Size: 761 Bytes

Versions: 14

Compression:

Stored size: 761 Bytes

Contents

always_start true
interval 60

default[:file] = '/etc/nginx/sites-enabled/status'
default[:url] = 'http://127.0.0.1:11311/status'
default[:nginx_status_1] = %W(accepts handled requests)
default[:nginx_status_2] = %W(reading writing waiting)

run_if do
  File.exists? plugin.file
end

collect :os => "linux" do
  lines = http_get(plugin.url).split("\n")
  lines[2].scan(/\d+/).each_with_index do |value, index|
    event(:service => "nginx #{plugin.nginx_status_1[index]}", :metric => value.to_f/interval, :diff => true)
  end
  event(:service => 'nginx active', :metric => lines[0].split(':')[1].strip.to_i)
  lines[3].scan(/\d+/).each_with_index do |value, index|
    event(:service => "nginx #{plugin.nginx_status_2[index]}", :metric => value.to_i)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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