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?