Created
April 30, 2012 22:23
-
-
Save jnewland/2563228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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