Icinga2 API Event Streams -

Hi All,

I wanted to leverage Icinga2 API Event Streams to subscribe to Notification,CheckResult and StateChange.

I tried to run the curl command as shown on this page: https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#icinga2-api-clients-event-streams

curl -k -s -u root:icinga -H ‘Accept: application/json’
-X POST ‘https://localhost:5665/v1/events
-d ‘{ “queue”: “myqueue”, “types”: “CheckResult”, “filter”: “event.check_result.exit_status==2” }’
and it throws an error like :

{“error”:404.0,“status”:“The requested path ‘v1/events’ could not be found or the request method is not valid for this path.”}

But When I try:
curl -k -s -u root:icinga -H ‘Accept: application/json’ -X POST ‘https://localhost:5665/v1/events?queue=america&types=CheckResult&filter=event.check_result.exit_status==2

It works fine.

I also tried to write a client code in python using this library :https://github.com/joni1993/icinga2apic

But there also I am getting the same error like:
{“error”:404.0,“status”:“The requested path ‘v1/events’ could not be found or the request method is not valid for this path.”}

Could someone help me understand why : -
curl -k -s -u root:icinga -H ‘Accept: application/json’
-X POST ‘https://localhost:5665/v1/events
-d ‘{ “queue”: “myqueue”, “types”: “CheckResult”, “filter”: “event.check_result.exit_status==2” }’ is not working?

I tested it on my side, and i can confirm i have the same behaviour for icinga 2.11.4.

I cant answer the initial question here, but in my opinion it should work to pass the same parameter in the data or directly in url, so there may be an issue underlying here.

I can advise you to create an issue here to have it fixed :

Thank you for checking it up.

I have raised a ticket here. https://github.com/Icinga/icinga2/issues/8246

Hello @umanath and thank you for reporting!

Please have a look here.

Best,
AK

1 Like