Giter Club home page Giter Club logo

nagios_check's Introduction

NagiosCheck

Description

NagiosCheck is a simple and efficient tool for building custom probes for the Nagios monitoring system. It alleviates the pain of parsing command line options, writing and formatting the check results according to the Nagios plugin API.

Installation

gem install nagios_check

Features

  • Provide a simple to use DSL for building your own probes.
  • Parse command line options.
  • Report status data to Nagios (handles exceptions as UNKNOWN status).
  • Provide a Nagios like range description format for the WARNING and CRITICAL states.
  • Provide a simple timeout functionality to be more Nagios friendly.
  • Report performance data to Nagios.

Usage and documentation

NagiosCheck is a module. To use it, simply include it in a class and declare how the check should behave:

require "nagios_check"

class SimpleCheck
  include NagiosCheck

  on "--host HOST", "-H HOST", :mandatory
  on "--port PORT", "-P PORT", Integer, default: 8080

  enable_warning
  enable_critical
  enable_timeout

  def check
    time = do_some_check(options.host, options.port)
    store_value :duration, time
  end
end

SimpleCheck.new.run

The command can then be used by Nagios:

  ruby simple_check.rb -H my_host -P my_port -w 4 -c 8 -t 10

If the value returned by do_some_check is between 0 and 4 inclusive the result is OK. If it is greater than 4 and less than 8 inclusive the result is WARNING. If it is greater than 8 the result is CRITICAL. See Nagios Developer Guidelines for more details on how the arguments of -w and -c are interpreted.

If the check method lasts more than 10 seconds, it times out and the returned value is UNKNOWN.

An alternative shorter way of writting the above check would be:

def check
  time(value_name: 'duration' do
    do_some_check(options.host, options.port)
  end
end

License

Released under the MIT License. See the MIT-LICENSE file for further details.

Copyright 2011 Dominique Broeglin

nagios_check's People

Contributors

dbroeglin avatar benbc avatar

Watchers

James Cloos avatar Wayne Conrad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.