Curl to https:/icinga2/monitoring/list/notifications?host_name=xyz

Hi!

Is it possible to use curl for getting arbitrary pages. Ive tried

url="https://icinga2/icingaweb2/monitoring/list/notifications?notification_timestamp%3E=-2%20days&host_name=myhostname&modifyFilter=1&format=json"
curl -c /tmp/cookie.jar -b -j -L -v -u "login:pw" $url

with no luck.

Best regards
Timo

Try it with a proper API request:

curl -u "icingaadmin:icinga" -H "Accept:application/json" https://icinga2/icingaweb2/monitoring/list/notifications?notification_timestamp%3E=-2%20days&host_name=myhostname

By passing the Accept header, you don’t get a cookie and don’t need to add &format=json to the url.

That really works! :slight_smile:

Till know I only used the Icinga-REST API (for object) on port 5665. But this one is icingaweb2 specific, I think. Where can I read more about it?
Best regards
Timo

Nowhere. It’s not documented. There’s also not that much more you can do with it, besides retrieving lists easily as JSON. The only advantage over the Icinga 2 API here is that restrictions (dependent on the used login) are applied to the result.

1 Like