Project

yz-monitor

0.0
No commit activity in last 3 years
No release in over 3 years
Sensu-style monitoring tools for Riak Search 2
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

= 2.2.0.pre1
~> 1.1.0
 Project Readme

Ruby Yokozuna Monitor

The Ruby Yokozuna Monitor gem keeps an eye on your Riak Search 2 (a.k.a. "Yokozuna" or "yz") installation.

The intended use is to find objects that have failed indexing using the _yz_err functionality, but it is customizable to monitor other yz activity.

Using the yokozuna error patch distributed separately from Riak and this gem, monitoring for erroneous records becomes vitally important, as they are saved separately, and take up space over time.

Installation

Add this line to your application's Gemfile:

gem 'yz-monitor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install .

Usage

The command-line yz-errors-sensu application is the original interface:

Usage: bin/yz-errors-sensu (options)
    -c, --crit CRIT                  The number of errors that trigger a critical warning.
    -h, --host HOST                  The Riak host to connect to.
    -i, --index INDEX                The index to query
    -p, --port PORT                  The Protocol Buffers port on the Riak host to query.
    -q, --query QUERY                The query to perform
    -w, --warn WARN                  The number of errors that trigger a warning.

The command-line tool has several error/unknown conditions, evaluated in this order:

  1. If the warning threshold is greater than the critical threshold, the check will fail before attempting to connect to Riak.
  2. If the Riak server cannot is not ping-able (due to a failed connection or other misconfiguration), the check will fail.
  3. If the Riak server does not have the specified index ('yz_err' is the default), the check will fail.
yz-errors-sensu -w 1 -c 100 -i yz_err -h 127.0.0.1 -p 8087 -q '*:*'

Example Sensu Check Definition

{
  "checks": {
    "chef_client": {
      "command": "yz-errors-sensu -w 1 -c 100 -i yz_err -h 127.0.0.1 -p 8087 -q '*:*'",
      "subscribers": [
        "production"
      ],
      "interval": 60
    }
  }
}

For different checks, write a small Ruby script:

require 'yz-monitor'

c = Riak::Client.new pb_port: 8087
i = Riak::Search::Index.new c, 'yz_err'
q = Riak::Search::Query.new c, i, '*:*'
q.rows = 0 # we care about the total results found, not the actual results
case q.results.num_found
when (0..10) ...

Contributing

  1. Fork it ( https://github.com/[my-github-username]/./fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request