0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Nagios interaction with Lita
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 0
>= 3.0.0.beta2

Runtime

 Project Readme

lita-nagios

Build Status Coverage Status

lita-nagios is a handler for Lita that allows interaction with Nagios monitoring solution. It listens for notifications on a HTTP endpoint and uses nagiosharder to send commands to the Nagios instance.

Note: Colors in notifications are not enabled yet, because it relies completely on the adapter and no abstraction layer is implemented nor designed as of now.

Installation

Add lita-nagios to your Lita instance's Gemfile:

gem "lita-nagios"

Configuration

HTTP interface

  • default_room (String) - Default chat room for notifications

Nagios commands (nagiosharder config)

  • cgi - Nagios CGI URL
  • user - Nagios user with system commands authorization
  • pass - User password
  • version - Nagios version, default: 3
  • time_format - default: "iso8601"
  • verify_ssl - default: true

Example

Lita.configure do |config|
  config.handlers.nagios.default_room = "#admin_room"
  config.handlers.nagios.cgi = "http://nagios.example.com/cgi-bin/nagios3"
  config.handlers.nagios.user = "lita"
  config.handlers.nagios.pass = "xxxx"
  config.handlers.nagios.version = 3
  config.handlers.nagios.time_format = "iso8601"
  config.handlers.nagios.verify_ssl = true
end

Usage

Display notifications in channel

lita-nagios provides a HTTP endpoint to receive Nagios notifications:

POST /nagios/notifications

Request parameters must include those fields:

  • type - host or service
  • room - notifications destination (see default_room in configuration section)
  • host - Nagios' $HOSTNAME$ or $HOSTALIAS$
  • output - Nagios' $HOSTOUTPUT$ or $SERVICEOUTPUT$
  • state - Nagios' $HOSTSTATE$ or $SERVICESTATE$
  • notificationtype - Nagios' $NOTIFICATIONTYPE$
  • description - Nagios' $SERVICEDESC$ (only for service type)

An example Nagios configuration (contact, commands) to send alerts to channels is provided in contrib folder

Send commands to Nagios

lita: nagios enable notif(ication(s)) <-h | --host HOST> [-s | --service SERVICE] - Enable notifications for given host/service
lita: nagios disable notif(ication(s)) <-h | --host HOST> [-s | --service SERVICE] - Disable notifications for given host/service
lita: nagios recheck <-h | --host HOST> [-s | --service SERVICE] - Reschedule check for given host/service
lita: nagios ack(nowledge) <-h | --host HOST> [-s | --service SERVICE] [-m | --message MESSAGE] - Acknowledge host/service problem with optional message
lita: nagios (fixed|flexible) downtime <-d | --duration DURATION > <-h | --host HOST> [-s | --service SERVICE] - Schedule downtime for a host/service with duration units in (m, h, d, default to seconds)

License

MIT