We are producing an incident report from IcingaDB postgre database. A piece of data that we want to include in the report is if the incident was a planned downtime or not.
The report seems OK and all the relevant data is there.
But I have already a couple of times where the operators forget to create the downtime before starting a maintenance intervention. I will like to be able to create that downtimes to make the database fully consistent with reality.
Through the regular icingaweb interface or trough the API is not possible to create a downtime in the past.
Is there any way to create a downtime in the past?
So do you want to check if there has been a downtime in the past? Or do you want to create that downtime after it has happened, just to have it look like there would have been a downtime if your operators would have created that downtime?
I want to create the downtime after it has happened.
The written procedure is start a downtime in case of a planned/controlled intervention, like installing a secpatch, but I sometimes they forget. Errare humanum est.
it includes “FROM sla_history_downtime” and it uses downtime_start and downtime_end.
so we look at this table:
CREATE TABLE sla_history_downtime (
environment_id bytea20 NOT NULL,
endpoint_id bytea20 DEFAULT NULL,
object_type checkable_type NOT NULL,
host_id bytea20 NOT NULL,
service_id bytea20 DEFAULT NULL,
downtime_id bytea20 NOT NULL,
downtime_start biguint NOT NULL,
downtime_end biguint NOT NULL,
CONSTRAINT pk_sla_history_downtime PRIMARY KEY (downtime_id)
);
and here you can insert anything you want. every bytea20 column is stored in binary so you need some hex2bin function to have it readable in your code.
if you need the downtime in icingaweb2 as well you will need to add an entry here as well: