Repository is archived
No commit activity in last 3 years
No release in over 3 years
This is a very "lightweight" command line client (written in Ruby) for the MK Livestatus Nagios module.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

 Project Readme

LivestatusClient

This is a very "lightweight" command line client (written in Ruby) for the MK Livestatus Nagios module.

It makes simple queries and commands against the Livestatus API and returns slightly parsed JSON responses. Filters and complex queries (beyond just requesting particular data types and columns) are not yet supported.

Installation

Install it yourself as:

$ gem install livestatus-client

Usage

Run the livestatus executable:

$ livestatus --help
Options:
  -h, --host=<s>         Livestatus host
  -p, --port=<s>         Livestatus port
  -q, --query=<s>        The query string
  -l, --columns=<s>      Which columns to display (comma separated)
  -i, --list             List available columns
  -c, --command=<s>      Command to send
  -a, --arguments=<s>    Command argumenets (comma separated)
  -e, --help             Show this message

Listing hosts with any configured downtimes

$ livestatus -h 10.99.0.1 -p 50000 -q hosts -l downtimes

This should return something like this:

{
  "default-ubuntu-1404": {
    "downtimes": [

    ]
  },
  "stage-api": {
    "downtimes": [

    ]
  },
  "test-dns": {
    "downtimes": [
      1483559124159689
    ]
  }
}

Configuring a service downtime

$ livestatus \
    -h 10.99.0.1 -p 50000 \
    -c SCHEDULE_HOST_DOWNTIME \
    -a 'server-ubuntu-1404,1483644522,1483644523,1,0,0,yourname,Some downtime coment'

Valid Nagios external commands (Click on individual commands for the argument syntax. Note that the script replaces , with ; to prevent conflicts with the shell)

To get a list of valid columns for a data type

$ livestatus -h 10.99.0.1 -p 50000 -q hosts --list

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/evertrue/livestatus-client.

License

The gem is available as open source under the terms of the MIT License.