I have set the threshold value to get the alert in icinga2 for infrastructure. Alert is coming on Icinga2 UI but how to fetch this all alert data through API call either using JAVA or python. I need only alert data.
Asked
Active
Viewed 979 times
1 Answers
1
Use the event Stream
Here's an example:
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'
This means you'll get data whenever a service goes critical. Here's some more info on return codes incase you need it. Icinga2 uses the same as Nagios.

cflinspach
- 290
- 1
- 4
- 16
-
Thank you, it helped me a lot. – RCP Aug 18 '17 at 07:12
-
in the example you have given, what 'queue' parameter does – RCP Aug 18 '17 at 07:20
-
It just set's a name for that queue. I set it to america but you can use any string. – cflinspach Aug 18 '17 at 14:45
-
Is this the answer you wanted? – cflinspach Aug 21 '17 at 15:50
-
Yes i am getting alert data by using the above API call – RCP Aug 22 '17 at 05:01
-
Can you mark this as the answer? There's a check mark under the up down button. – cflinspach Aug 22 '17 at 16:00
-
1Thank you, check out [monitoring-portal](https://monitoring-portal.org/). There's alot better people at Icinga there and the devs frequent it. – cflinspach Aug 23 '17 at 13:55