We use checkmk 1.2.6p16 to monitor quite a few hosts and services. (An upgrade to the latest release is in planning… about time!).
For a monthly report, we’d like to see historical data on unscheduled downtimes for a number of hosts and services. By reading checkmk documentation, it’s clear we should be using GET statehist for this purpose. However, there doesn’t seem to be a lot of detailed documentation and/or examples on the usage of statehist.
What we want to know is the hostname and service, date of the downtime, start of the downtime, end of the downtime and duration of the downtime. (The last item can also be calculated from the preceding two, of course).
We already have a working Python script that asks the user for a start date and end date so we can give a range, for example: python reporting_downtimes.py -s 2020-06-01 -e 2020-06-30.
What we’re having trouble with is getting the actual query right so as to get the data as mentioned above. Is this something that’s possible with Livestatus Query Language? If so, do you have any tips on accomplishing this?
Thanks a lot in advance and of course, let me know if I can provide more detail for clarification on anything above.