REST-Api set downtime for all services of a DB

Hello checkmk Gurus!

i am using the Rest-Api to set up downtimes directly from the command line so i can include this on our maintenance scripts, but i have to declare all the services i want to downtime and i can not use a regular expression, or some kind of pattern which affect to all the services of a database.

This is a pain, i mean we got different services depending of the database and if i have to know the name of each one and include it on the curl request, it does not make any sense to use the api because i will do it from the web interface.

Does anyone know how this could be archive?

i paste the curl request example:

out=$(
curl -X ‘POST’
https://CHECKMKSITE/check_mk/api/1.0/domain-types/downtime/collections/service
-H ‘accept: /
-H ‘Content-Type: application/json’
–header “Authorization: Bearer automation PASSWORD”
-d ‘{
“start_time”: “2021-10-06T11:59:28+02”,
“end_time”: “2021-10-06T16:32:28+02”,
“comment”: “TEST_SCRIPT”,
“downtime_type”: “service”,
“host_name”: “TESTHOST.int.hlg.de”,
“service_descriptions”: [
“CPU utilization”,
“Memory”
]
}’
)

it will be nice to have something like Oracle Cloud control blackout which its smart enough to know all the services of a database without the need of specifing it.

Thanks in advance
Regards
Carlos

Yes, would be. In this case you are the entity that knows which services belong to a specific database.

Checkmk is a generic monitoring system. It does now even know that this particular service monitors a database.

Maybe you could work with service labels here, but I am not sure if they can be used to set downtimes via REST API.

1 Like

You may can use a combination of livestatus and curl to achieve your goal. With a request against the livestatus you can get all services from a host or in case of a oracle database all your services relevant to the database via regular expressions. With this combined you can build your curl calls dynamically each time you like to set downtimes.

I do similar things on our larger RAC installations with several databases on it if i only like to downtime one of them for maintenance.

Hi Tosch! exactly thats what i am working on, i gather all the services of all host and then, i do some magic ( awk, sed,etc… ) to get the ones i need and launch a request to the api for downtime those ones.

The only problem i see now, its that if got one db on dataguard ( Similar to master- slave for none oracle people) i downtime the services on both sides, but i will work this out on the future.

Anyway whenever i finish it i will paste it here or other my git page, because this feature will no be included on further checkmk versions right?

Thanks in advance checkmk gurus!!!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.