Service checks with Nagios

Nagios is an open source software application that can be used to monitor automated infrastructure. As implemented for LIGO, the service works by reading local JavaScript Object Notation (JSON) files containing status updates written at runtime.

This python module provides an interface to writing status updates for Nagios, intended for use by downstream consumers of GWDetChar. For live checks of all LIGO service automation, see https://monitor.ligo.org.

Python module

The gwdetchar.nagios module provides a simple utility for writing a status file in JSON format that Nagios can parse:

write_status(message, code[, timeout, ...])

Write a Nagios status file in JSON format

On the command-line

If needed, Nagios status files can also be generated from the command-line:

$ python -m gwdetchar.nagios --help
usage: python -m gwdetchar.nagios [-h] [-V] [-t TIMEOUT] [-m TIMEOUT_MESSAGE]
                                  [-o OUTPUT_FILE]
                                  code message

Command-line utility for providing status updates to Nagios

positional arguments:
  code                  exit code for Nagios, should be one of: 0 (success), 1
                        (warning), or 2 (critical)
  message               status message for Nagios

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -t TIMEOUT, --timeout TIMEOUT
                        timeout length in seconds, default: no timeout
  -m TIMEOUT_MESSAGE, --timeout-message TIMEOUT_MESSAGE
                        Error message upon timeout
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        full path to the output JSON file, default:
                        nagios.json