Skip to content

Instantly share code, notes, and snippets.

@jnewland
Created April 30, 2012 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnewland/2563228 to your computer and use it in GitHub Desktop.
Save jnewland/2563228 to your computer and use it in GitHub Desktop.
# CheckGraphite
# A simple framework for writing nagios checks based on Graphite data.
# Usage
# -----
#
# $ cat /tmp/page-queue.coffee
# CheckGraphite = require('check-graphite')
#
# class PageQueue extends CheckGraphite
# options:
# from: "-20s"
# until: "-10s"
# targets:
# 'resque.queue.page':
# alias: 'value'
#
# output: (value) ->
# message = "#{value} jobs in the page queue"
# if value > 20
# @critical message
# else if value > 10
# @warning message
# else
# @ok message
#
# module.exports = @
#
# $ ./bin/check_graphite /tmp/page-queue.coffee
# OK: 0 jobs in the page queue
#
# CheckGraphite expects that the options hash be provided in a format acceptable
# to Graphite.coffee. By default, the first data point in the result set with
# the alias 'value' is passed to the output() method. Subclasses may override
# the represent() method to perform the conversion from raw to massaged data
# differently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment