IcingaDB Web API documentation (resolve notes_url_id to notes_url)

Hi :slight_smile:

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?

...
"notes_url_id": "1ee1138811a20e0a38e4aeea120151e7102c522c",
"notes": "",
 ...

Is there any API documentation at all as I have tried to read the PHP code but to no avail?

Thanks in advance!
Raphael

Sadly the Icingaweb2 and director API documentation is lacking and could use some love.

1 Like

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.

Yes, in general I would do that, but in this particular case I need to work with the IcingaDBWeb API…

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.

There is Support `?columns` also for CSV and JSON exports · Issue #1011 · Icinga/icingadb-web · GitHub though, which would allow to use host.notes_url.notes_url etc. once supported.

At the moment, the Icinga 2 API already mentioned is the only way.

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.

Best Regards
Nicolas