> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mage.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Alerting status updates in Opsgenie

> Get status updates in Opsgenie.

export const ProOnly = ({button = 'Get started for free', description = 'Try our fully managed solution to access this advanced feature.', source = 'documentation', title = 'Only in Mage Pro.'}) => <div className="block my-4 px-5 py-4 overflow-hidden rounded-xl flex gap-3 border border-emerald-500/20 bg-emerald-50/50 dark:border-emerald-500/30 dark:bg-emerald-500/10">
    <div style={{
  display: 'flex',
  alignItems: 'center',
  width: '100%'
}}>
      <div className="text-sm prose min-w-0 text-emerald-900 dark:text-emerald-200" style={{
  flex: 1
}}>
        <span className="font-semibold">{title}</span>
        <p className="normal">{description}</p>
      </div>

      <div> </div>

      <div style={{
  height: 32,
  position: 'relative'
}}>
        <a target="_blank" rel="noopener noreferrer" className="group px-4 py-1.5 relative inline-flex items-center text-sm font-medium rounded-full" href={`https://cloud.mage.ai/sign-up?source=${source}`}>
          <span className="absolute inset-0 bg-primary-dark dark:bg-primary-light/10 border-primary-light/30 rounded-full dark:border group-hover:opacity-[0.9] dark:group-hover:border-primary-light/60">
          </span>

          <div className="mr-0.5 space-x-2.5 flex items-center">
            <span className="z-10 text-white dark:text-primary-light">
              {button}
            </span>

            <svg width="3" height="24" viewBox="0 -9 3 24" className="h-5 rotate-0 overflow-visible text-white/90 dark:text-primary-light">
              <path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"></path>
            </svg>
          </div>
        </a>
      </div>
    </div>
  </div>;

<img alt="Opsgenie" src="https://logotyp.us/files/opsgenie.svg" width="300" />

## Overview of steps

1. Set up Api Integration for Opsgenie
2. Update Mage project settings

***

## Configure alerts in the Mage Pro UI

After you create your Opsgenie API integration, you can configure alerts in the
Mage Pro UI instead of editing `metadata.yaml` directly:

1. For project defaults, go to **Settings > Account > Alerts**.
2. For one pipeline, open the pipeline and go to **Alerts**. Pipeline-level
   settings override the project-level alert config for that pipeline.
3. Choose the alert outcomes, enable Opsgenie, enter the API URL and API key,
   and use **Send test notification** to send a test alert before saving.

You can still reference secrets with values such as
`{{ env_var('MAGE_OPSGENIE_API_KEY') }}`.

***

## Set up Api Integration for Opsgenie

Follow these
[instructions on Opsgenie](https://support.atlassian.com/opsgenie/docs/create-a-default-api-integration/)
to setup an API Integration in your account.

***

## Update Mage project settings

Once you’ve set up API Integration for Opsgenie, you should have an API Key that Opsgenie
provides.

Follow these steps to add that Opsgenie Configuration to your project settings:

1. Open the Mage tool in your browser (e.g. [http://localhost:6789/](http://localhost:6789/)).

2. Open a pipeline and start editing it (e.g.
   [http://localhost:6789/pipelines/example\_pipeline/edit](http://localhost:6789/pipelines/example_pipeline/edit)).

3. In your left sidebar in the file browser, scroll all the way down and click
   on a file named `metadata.yaml`.

4. In the `metadata.yaml` file, add a section with the following
   configuration or update the existing `notification_config` section:

   ```yaml theme={"system"}
   notification_config:
     alert_on:
       - trigger_failure
       - trigger_passed_sla
   ```

   If you omit the `alert_on` section it will default to `trigger_failure` and `trigger_passed_sla`.

   Options:

   * `trigger_failure`: alert when a run of a trigger fails
   * `trigger_success`: alert when a run of a trigger succeeds
   * `trigger_passed_sla`: alert when a run of a trigger passes sla

5. In the `metadata.yaml` file, add the following values:

   ```yaml theme={"system"}
   notification_config:
     alert_on:
       ...
     opsgenie_config:
       url: "https://api.eu.opsgenie.com/v2/alerts"
       api_key: "<your_api_key>"
       priority: "P2" # Default P3
       tags: # Default empty
       - production
       details: # Default empty
         environment: production
       responders: # Default empty
       - id: "4513b7ea-3b91-438f-b7e4-e3e54af9147c"
         type: "team"
   ```

   Change the `your_api_key` value to be the API Key you created from Opsgenie.

***

## What next?

Whenever a pipeline run is successfully completed or fails, an Opsgenie alert be
created.

Here is an example of what the alert could look like:

| |
| - |
| ![Opsgenie](https://mage-ai.github.io/assets/opsgenie-alert-example.jpeg) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.