I need to call the Icinga DB Web API and was looking for some documentation on how to use it. Unfortunately found nothing.
With try and error I found this for the service api https://icingadbweb/icingadb/services?host.name=$HOSTNAME&name=$SERVICENAME
But some fields like notes_url are not available, instead there is a notes_url_id field. How can I convert this to the actual notes_url?
In general, I would recommend trying to use the Icinga 2 API since it allows deep insights into Icinga 2 itself and has decent documentation. Of course, sometimes it cannot answer certain questions, e.g., for the Director.
There’s no API to speak of in Icinga DB Web. Hence no documentation.
The lists allow export to json and csv, that’s about it. But the result only includes what the view already uses. Since notes_url and action_url are not rendered in lists, they are not included.
Thank you for your responses.
Is it possible to query only a single service of a host (with notes_url) and not the whole list? So somehow like icingadb/service/…?
Otherwise I guess I have no choice than using the IcingaAPI directly
Since you tried to read the php code, how familiar are you with writing something?
I totally understand that icinga2 api is not always the best option and her comes the good news:
you can always write your own module and exposing whatever you see fit.
Other idea:
You obiously want to automate something.
In Python3 you can use BeautifulSoap, login into icingaweb2, and get the plain html of some service note.