Notifications are optional alerts sent to another source (e.g., email, PagerDuty, OpsGenie) when an event occurs. You will only receive notifications from policies that have a notification(s) configured. While notifications are enabled by default, they will be automatically disabled if they are used in a policy and fail for a period of time.

Using Notifications

The Policy Editor

Set up notifications by opening the desired policy in Policy Editor. To enable or disable existing notifications, see below.

  1. In the Policy Editor, under Notifications, click Add Notification.
  2. Select the desired notification type.
  3. Once a type is selected, choose a notification you have set up for the selected type. You can also create a new notification directly from here.
  4. Select how often—between 5 minutes and 24 hours or never—the policy should re-notify you if a policy is creating events.
  5. Enable Notify on Clear if you’d like to receive a notification when the policy stops triggering.
  6. Save the policy.

Enable/Disable Notifications
  1. From the user account drop-down menu, select Notifications.
  2. Open the desired notification.
  3. Select (or clear) the Enabled checkbox.
  4. Click Save.

Customize Notification Payloads

Custom JSON payloads in Metricly support FreeMarker writeup. This page contains a list of examples for you to reference when creating your own notification payloads for emails, SNS, and webhooks.

JSON Variables Available in Metricly
Escaping JSON With Freemarker

Use the official FreeMarker documentation on escaping for an in-depth look on various escaping rules. Note that escaping does not work for ', only " and >. If you do not properly escape your FreeMarker, you may not receive notifications. Remember to test any custom payloads that you create.


  "icon": "",
  "activity": "Metricly Alerts",
  "title": "${policyName}",
  "body": "Category: ${}\nElement: ${elementName}\nDescription: ${policyDescription?json_string}\nEventData: <#if><#if><#assign results =><#if results.conditions??><#list results.conditions as condition><#if condition?counter <= 5>${condition.expression}</#if></#list></#if></#if></#if>"


Email Payloads

There are two event payload types that can be leveraged with email notification payloads: event and event_cleared. An event is generated when a policy is violating. An event_cleared is generated when a once-violating policy is no longer violating. Your custom event payloads can be setup to notify you on either type with unique messaging and details about the event.

To create a custom event payload:

  1. Navigate to your Account > Notifications > Email.
  2. Click + Add Email.
  3. Choose Custom in the Template dropdown.
  4. Add a subject and input your JSON + FreeMarker writeup in the body of the email.
  5. Click Test & Save.
  6. Open a policy in the policy editor.
  7. Go to Notifications > Add Notification > Email.
  8. In the Email dropdown, select your newly created template.
  9. Save.

Alternatively, you can create your new custom email payload in the policy editor on the new notification itself by clicking + New Email.

Example 1

This example provides the policy name related to the event in the subject of the email and then provides the event category name of the event firing in the body. When the event clears, it sends another email with “CLEAR” as the body text.

Metricly Event [${policyName}]
<#if payloadType == "event">
<#if payloadType == "event_cleared">

Example 2

This example sends an email with UP or DOWN as the subject line, with all of the event details in the email body.

<#if payloadType == "event">DOWN</#if><#if payloadType == "event_cleared">UP</#if>
Time: ${eventTimestamp}
Event Category: ${}
Policy Name: ${policyName}
Policy Description: ${policyDescription}
Event ID: ${}
Element: ${elementName}
Violation: ${}

SNS Payloads

You must have AWS SNS setup in your console to use this payload type. The below payload returns the event category when active; once the event has cleared it returns CLEAR.

  "timestamp": "${eventTimestamp}",
  "category": "<#if payloadType == 'event_cleared'>CLEAR<#else>${}</#if>",
  "element": "${elementFqn}",
  "policy": "${policyName}"

Webhook Payloads

Webhooks have two main payload types: inbound and outbound. Outbound payloads can be customized and sent as notifications.

To create a customized webhook payload:

  1. Navigate to your Account Profile > Notifications > Webhook.
  2. Click + Add Webhook.
  3. Fill out all fields; select Custom from the Payload dropdown.
  4. Input your custom JSON + Freemarker writeup.
  5. Save.

Example 1

   "message_type":"<#if payloadType == "event">${}</#if><#if payloadType == "event_cleared">RECOVERY</#if>", 
   "state_message":"<#if payloadType == "event"> [${elementName}] [${policyName}] [${eventTimestamp}] : ${policyDescription}</#if><#if payloadType == "event_cleared">The policy ${policyName} has CLEARED for ${elementName} and is no longer generating events as of ${eventTimestamp}</#if>"

Example 2

{"text": "${eventTimestamp}: The CPU on ${elementId} has exceeded 5% for at least 5 minutes. \n Event Category: ${} \n Fqn: ${elementFqn} \n location: ${elementLocation}"}

Example 3

        "source":"Scality Tenant Alert",
        "title": "${policyName}",
        "tags": [
                "name":"Event Tag",
                "value": "External"
        "type": "INFO",
        "data": {
            "elementId": "${elementId}",
            "level": "WARNING",
            "message": "${policyDescription}"

Ready to get started with Metricly?

Sign up for free, and join DevOps who rate us 5-stars on Capterra!

21-day free trial No credit card required