All Projects → dbroeglin → nagios_check

dbroeglin / nagios_check

Licence: MIT license
Ruby Nagios Check Integration

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to nagios check

hscode
📘🖥 A command line reference tool for http status codes.
Stars: ✭ 31 (+138.46%)
Mutual labels:  gem
nagitheus
Nagios Check towards Prometheus
Stars: ✭ 19 (+46.15%)
Mutual labels:  nagios
link-check
checks whether a hyperlink is alive (`200 OK`) or dead.
Stars: ✭ 35 (+169.23%)
Mutual labels:  checker
link-verifier
A tool for verifying links in text-based files
Stars: ✭ 26 (+100%)
Mutual labels:  checker
acts as inheritable
Inheritable functionality for ActiveRecord models.
Stars: ✭ 24 (+84.62%)
Mutual labels:  gem
Vanhiupun.github.io
🏖️ Vanhiupun's Awesome Site ==> another theme for elegant writers with modern flat style and beautiful night/dark mode.
Stars: ✭ 57 (+338.46%)
Mutual labels:  gem
acts as user
A gem which handles multiple types of users on a rails app
Stars: ✭ 24 (+84.62%)
Mutual labels:  gem
check clever tanken
Benzinpreis-Monitoring mit Icinga 2 || Kraftstoffmonitoring
Stars: ✭ 21 (+61.54%)
Mutual labels:  nagios
madness
Instant Markdown Server
Stars: ✭ 54 (+315.38%)
Mutual labels:  gem
git-reclone
reclone your git repo
Stars: ✭ 11 (-15.38%)
Mutual labels:  gem
nagmapReborn
Nagmap Reborn - Standalone integration with some server monitoring systems providing a user-friendly interface through geographic visualization.
Stars: ✭ 19 (+46.15%)
Mutual labels:  nagios
RailLink
Compact isolated version of J-Link v9.
Stars: ✭ 69 (+430.77%)
Mutual labels:  probe
interface
AngularJS based Web Interface for Statusengine
Stars: ✭ 15 (+15.38%)
Mutual labels:  nagios
RandomProxyRuby
Tiny Library for get random proxy (free).
Stars: ✭ 16 (+23.08%)
Mutual labels:  gem
tinify-ruby
Ruby client for the Tinify API.
Stars: ✭ 41 (+215.38%)
Mutual labels:  gem
grape-jwt-authentication
A reusable Grape JWT authentication concern
Stars: ✭ 31 (+138.46%)
Mutual labels:  gem
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (+7.69%)
Mutual labels:  checker
codeigniter3-filename-checker
CodeIgniter3 Filename Checker
Stars: ✭ 21 (+61.54%)
Mutual labels:  checker
apachrot
Apache (Linux) CVE-2021-41773/2021-42013 Mass Vulnerability Checker
Stars: ✭ 21 (+61.54%)
Mutual labels:  checker
lockup
Lockup Gem
Stars: ✭ 111 (+753.85%)
Mutual labels:  gem

NagiosCheck

Gem Version Build Status

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
    store_message "The check took #{time} seconds"
  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 number passed to store_value 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 store_value is called multiple times, the value from the first call is used to determine the result. Multiple store_value calls can be used to include additional performance data in the output.

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

Calling store_message is optional. However, the text passed to store_message will be displayed next to the check status in the Nagios web interface and can be included in notification mails to provide some context in a human readable format.

If the only metric we are interested is the time it takes to execute the check, an alternative shorter way of writting the above would be:

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

This check will execute do_some_check measure the time it takes to execute it and return both status and performance data labeled duration.

License

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

Copyright 2011-2016 Dominique Broeglin

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].