monitoringicinga2

How to get icinga2 alert data


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.


Solution

  • 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.