I want to extract reports of the status of different subsets of services from the command line. At the moment I see a large number of the same service on different hosts which are CRITICAL, but with a variety of different problems; having a text report, ideally as a .csv file, would make it easier to analyse the extent of the different problems.
I can probably cobble something together with icinga2 console, which I can put into a script, but isn’t there something suitable available?
Oh, yes, so there is - however, it seems the csv export doesn’t include all the values I need; the long alert text is missing. And I need something to use in a script, so a web interface isn’t useful for me. Here is something I cobbled together:
{
icinga2 console --connect 'https://toot:TheresATrainsaComin@myserver.com:5665/' <<!
get_service("some.very.long.host.name","name-of-a-service")
!
} | grep -E '__name|output' | paste -sd, - | while IFS=, read a b c d
> do
> echo $a
> echo $b
> echo $c
> echo $d
> done
It is still only a sketch, but it gives me some sort of output I can work on.