A lot of people who want to integrate Icinga in their enviroment ask us if there’s a way of requesting database information over an unified API. This is possible over our ‘Icinga-Web REST Adapter’. It’s been in Icinga-Web for about 2 releases now, but I think it’s now time to make it public (as we don’t plan to make any major changes to the format in the future).
So here some facts about REST API:
- You have to install Icinga-Web in order to use it, because it’s based on the Icinga-Web authorization system. This has some advantages as you can limit access to, for example, only hosts in a specific host group or to items with a special custom variable.
- You can create users with an API key that can be sent with requests, thus allowing instant authorization. Requests can also be done via POST and via GET.
- If you don’t want the API, you can disable the authprovider for it (which is disabled by default)
What can I do with REST API?
- Request almost all Icinga database fields that are supported by Icinga-API (which covers almost all fields)
- Filter via nested AND and OR groups Â (Condition 1 Â AND (Condition 2 OR (Condition 3 AND Condition 4))..etc.)
- Add Order, Limit, Group By
- Get data via XML or JSON
- Note:Â Sending commands via PUT is a work-in-progress and will probably not be supported in Icinga-Web 1.2.
ThroughÂ oneÂ GETÂ request,Â youÂ couldÂ returnÂ allÂ SMTPÂ servicesÂ thatÂ areÂ CriticalÂ orÂ Warning,Â
butÂ onlyÂ whenÂ theirÂ correspondingÂ hostsÂ areÂ reachable. You could, for example tell the API to return the name of the service, its state, Â its host name, host status and the hostgroup the host is in, and arrange them in descending order by status number.
More details and a complete documentation about how to use the API can be found in our wiki.
…and what about SOAP ?
We’ve already started a SOAP provider, but it’s yet not functional and won’t be available in Icinga-Web 1.2. We decided to focus on REST API, as this will certainly be used more often at this stage.