Fork me on GitHub

nagios-cli

About

Nagios-cli is an intuitive command line interface utility to interface the Nagios monitoring tools. By default, Nagios comes with a web based graphical user interface, now with nagios-cli, you can also bring the power of text based console interfaces to your favourite monitoring suite.

Requirements

To run nagios-cli, you need at least:

To fully profit from history and tab completion, optionally install:

Installation

To install nagios-cli, run the provided setup.py setup script:

$ python setup.py build
$ sudo python setup.py install

Usage

For a list of options, run nagios-cli --help:

$ nagios-cli --help
Usage: nagios-cli [<options>] [<host> [<service>]]

Options:
  -h, --help            show this help message and exit

  Generic:
    -c filename, --config=filename
                        configuration file name
    -w, --write         write configuration file

  User Interface:
    --no-color          disable UI colors

Demo

$ nagios-cli
Welcome to the nagios command line interface
nagios > host
42 hosts available

To switch objects, use: host <hostname>
nagios > host loc<tab>
nagios > host localhost
nagios (host) localhost> service
12 services for this host
Disk Space          : ! WARNING, WARNING - /data0 has 8% free (19G/246G ext3)
Free Memory         : ↑ OK, OK - 14% RAM used, 3% Swap used
Func daemon         : ↑ OK, TCP OK - 0.000 second response time on port 5123
HTTP                : ↑ OK, HTTP OK HTTP/1.1 200 OK - 261 bytes in 0.001 sec
NRPE Daemon Running : ↑ OK, TCP OK - 0.000 second response time on port 5666
NRPE EMail Queue    : ↑ OK, OK: mailq (0) is below threshold (10/20)
NTP Check           : ↑ OK, NTP OK: Offset -0.001946568489 secs
Puppet Activity     : ↑ OK, OK: Host updated 1742s ago
RAID                : ↓ CRITICAL, RAID CRITICAL - SparesMissing event
Rsync               : ↑ OK, TCP OK - 0.000 second response time on port 873
SSH                 : ↑ OK, SSH OK - OpenSSH_4.4 (protocol 2.0)
nagios (host) localhost> service disk<tab>
nagios (host) localhost> service Disk-Space
nagios (host) localhost → Disk Space> ack<tab>
nagios (host) localhost → Disk Space> acknowledge
comment        : Ordered bigger disks
sticky     [Yn]: y
notify     [Yn]: y
persistent [Yn]: y
Problem acknowledged
nagios (host) localhost → Disk Space> ^d
nagios (host) localhost> service SSH
nagios (host) localhost → SSH> status
host name           : localhost
service description : SSH
current state       : ↑ OK
is flapping         : no
plugin output       : SSH OK - OpenSSH_4.4 (protocol 2.0)
last time down      : N/A
last state change   : 2010-07-30 11:00:06
last check          : 2012-01-27 01:04:16
next check          : 2012-01-27 01:09:16
check interval      : 5.000000
check latency       : 0.086
check period        : 24x7
notification period : 24x7
current attempt     : 1
max attempts        : 3
nagios (host) localhost → SSH>