Skip to main content

How to trigger Opsgenie notifications as an Action

This guide will help you set up Opsgenie alert notifications when running Great Expectations. This is useful as it can provide alerting when Great Expectations is run, or certain ExpectationsA verifiable assertion about data. begin failing (or passing!).

Prerequisites: This how-to guide assumes you have:

Steps

1. Set up a new API integration within Opsgenie

  • Navigate to Settings > Integration list within Opsgenie using the sidebar menu.

    /images/opsgenie_integration_list.png

  • Select add on the 'API' integration, this will generally be the first available option.

  • Name the integration something meaningful such as 'Great Expectations'

  • Assign the alerts to any relevant team.

  • Click the copy icon next to the API Key - you'll need this for the next step.

  • Add any required responders.

  • Ensure 'Create and Update Access' is checked along with the 'Enabled' checkbox.

  • Click 'Save Integration' to save the newly created integration.

2. Update your Great Expectations configuration variables

Using the API Key you copied from Step 1, update your Great Expectations configuration variables in your config_variables.yml file

opsgenie_api_key: YOUR-API-KEY

3. Add send_opsgenie_alert_on_validation_result operator to your Checkpoint configuration

Next, update your Checkpoint configuration file to add a new action to the ActionsA Python class with a run method that takes a Validation Result and does something with it list in great_expectations.yml

action_list:
- name: send_opsgenie_alert_on_validation_result
action:
class_name: OpsgenieAlertAction
notify_on: all
api_key: ${opsgenie_api_key}
priority: P3
renderer:
module_name: great_expectations.render.renderer.opsgenie_renderer
class_name: OpsgenieRenderer
tags:
- Production
- Non-Critical
  • Set notify_on to one of, "all", "failure", or "success"
  • Optionally set a priority (from P1 - P5, defaults to P3)
  • Set region: eu if you are using the European Opsgenie endpoint
  • Optionally include 'tags' in your settings which will be included in your API call to OpsGenie. e.g.: 'Production'

4. Validate a Batch of data to test your alerts

Run your Checkpoint to ValidateThe act of applying an Expectation Suite to a Batch. a BatchA selection of records from a Data Asset. of data and receive an Opsgenie alert on the success or failure of the Validation.

Reminder

Our guide on how to Validate data by running a Checkpoint has instructions for this step.