Check::Conditional::Aggregate

Plugin for Sensu to run an aggregate of other aggregates, following some simple logic rules.

Installation

Add this line to your application's Gemfile:

gem 'check-conditional-aggregate'

And then execute:

$ bundle

Or install it yourself with:

$ gem install check-conditional-aggregate

Usage

Synopsis

# Generate a warning alert if ANY checks have ANY critical hosts.
check-conditional -a API -c "check_foo,check_bar" --warning "any critical in any"

# Generate a critical if either check_foo or check_bar has all hosts at critical.
check-conditional -a API -c "check_foo,check_bar" --critical "all warning in any"

# Generate a warning if 80% or more of the checks are critical in any of the checks
check-conditional -a API -c CHECKS --warning "80% critical in any"

General form:

check-conditional -a API -c CHECKS [ --critical EXPRESSION | --warning EXPRESSION ]

CHECKS is a list of one or more comma-separated aggregate checkers. These return a tally of hosts that are OK, in warning state and in critical state. These results are then rolled up to generate a critical or warning depending on whether the associated EXPRESSION matches. The two options can be used together, so you can define a broader expression to generate a warning and a tighter expression that generates a critcal state. The expression syntax is:

any|all|N% critical|warning in any|all

The quantifier on the left determines what threshold to apply as each check is being considered, and the quantifier on the right expresses how the results get rolled up.

Example

Suppose we have 3 aggregate checks that monitor latency in 3 regions, and we want to produce an overall health. For the purpose of this

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

License

The gem is available as open source under the terms of the MIT License.

Release Notes

0.0.5

  • Fixed executable path.

0.0.4

  • Fixed incorrect spelling of --checks
  • Made Rubocop output squeaky clean.

0.0.3

  • Perform logic accross multiple aggregate checkers using --checks "Check1,Check2,..."
  • Removed pattern matching (had been deprecated/broken anyways)

0.0.2

  • Fixed bug pertaining to specifying --critical and --warning at the same time.