Skip to content

Instantly share code, notes, and snippets.

@pshima
Created December 15, 2011 06:43
Show Gist options
  • Save pshima/1480096 to your computer and use it in GitHub Desktop.
Save pshima/1480096 to your computer and use it in GitHub Desktop.
check_raindrops
# from https://github.com/petey5king/raindrops-nagios
#!/usr/bin/env ruby
#script to check the unicorn backlog
#requires the nagios gem, raindrops and rubygems
$LOAD_PATH.unshift '../lib'
require 'rubygems'
require 'raindrops'
require 'nagios'
class CheckRaindrops < Nagios::Plugin
def warning (x)
x > threshold(:warning)
end
def critical (x)
x > threshold(:critical)
end
def measure
addr = [ "/tmp/unicorn.sock" ]
@stats = Raindrops::Linux.unix_listener_stats(addr)
@stats[0].queued
end
def to_s(value)
"QUEUE #{status}: #{@stats[0].queued}"
end
end
CheckRaindrops.run!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment