2

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?

towo
  • 1,887
  • 14
  • 12
  • curl using the REST API, mysql client binary for DB IDO. what's your preferred method? – dnsmichi Jan 12 '16 at 13:35
  • @dnsmichi Since "icinga object list" exists, I'd be inclined to say that "icinga result list" or similar could be put in as a feature request? – towo Jan 12 '16 at 13:39
  • I think it's more reasonable to let users decide which attributes they need, and use that in a yet more programmatic way. You may already achieve that by using the icinga2 console and its eval command. Or use your own implementation. http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/icinga2-api#icinga2-api-clients – dnsmichi Jan 12 '16 at 13:42
  • Btw if you happen to have icingaweb2 and icingacli installed you may use the latter as well to query the state and check output. – dnsmichi Jan 22 '16 at 22:58

1 Answers1

4

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.

Cie6ohpa
  • 231
  • 1
  • 6