Icinga2: query check results from command line

command-line-interfaceicingamonitoring

is there any native way of actually retrieving the current check results from an Icinga 2 instance? I can't find it documented.

If not, are there accepted, known-good command line frontends to query Icinga/IDO/API?

Best Answer

With icinga2 you can use icingacli, see https://github.com/Icinga/icingaweb2/blob/master/modules/monitoring/application/clicommands/ListCommand.php for options, look at this ascii movie for some examples: https://asciinema.org/a/136882/ You can install icingacli with sudo apt-get install icingacli.

I can use following on my icinga2 web version 2.5.0:

sudo icingacli monitoring list --host=shares* --service=*inodes \
 --format=csv  \
 --columns='host_name,host_state,host_output,host_handled,host_acknowledged,host_in_downtime,service_description,service_state,service_acknowledged,service_in_downtime,service_handled,service_output,service_perfdata,service_last_state_change'

The tool has some help, use: sudo icingacli help monitoring list.