Using the Icinga Web API

by | Mar 12, 2021

Unfortunately, there is little to no documentation for using the Icinga Web API to perform monitoring actions such as scheduling downtimes. But it’s a simple thing and I’ll give you a quick example of how to do it. Using the Icinga Web API instead of the Icinga API gives you the advantages of the permission and restriction system, various authentication methods and auditing.

Icinga Web supports API access to all forms by simply adding the Accept: application/json header to the requests. In the following examples we plan downtimes for single and multiple hosts and services. The required fields for planning downtimes are the following:

  • type which is either fixed or flexible
  • start as UNIX timestamp
  • end as UNIX timestamp
  • comment

The following command creates a downtime for $hostname for the next hour.

curl -H "Accept: application/json" -u user:password \
"https://$server/icingaweb2/monitoring/host/schedule-downtime?host=$hostname" \
-F "type=fixed" \
-F "start=$(date +%s)" \
-F "end=$(expr $(date +%s) + 3600)" \
-F "comment=Reboot"

If you want to create downtimes for all services on this host as well, just add -F "all_services=1".

If you want to plan downtimes for multiple hosts, the URL looks like this:


$filter can be used from the multi-select or list views, e.g. hostgroup_name=test-servers or ((host_name=db1)|(host_name=db2)).

Scheduling service downtimes is done using the following URLs:



If you want to use the API for other monitoring commands, use your browser’s developer tools to see which URL is used by the relevant forms and what data they POST.

You can also find more how-tos at

You May Also Like…

Releasing Icinga 2.13.5

Releasing Icinga 2.13.5

Today we are releasing Icinga 2.13.5. It addresses issues with 2.13.x-only changes such as logging startup messages to...

Icinga Camp Berlin 2022

Icinga Camp Berlin 2022

Our first Icinga Camp after 2019 now took place almost 3 years later and was an amazing event that took us right back...

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.