Skip to content

Sending alerts to Amazon EventBridge

In Mackerel, JSON of alert contents can be received with Amazon EventBridge. This can be useful for tasks such as using AWS Lambda etc. to automate post-notification processing and more.

Adding Amazon EventBridge notifications

Configuration from the console

Notification settings can be added using the Amazon EventBridge form on the Channels page. Specify your AWS account ID, the AWS region that will receive the notifications, and an event name to identify the notifications.

  • For how to check your AWS account ID, please refer to AWS Account Identifiers - AWS General Reference.
  • Mackerel's event source name with Amazon EventBridge follows the format below.   - aws.partner/mackerel.io/{organization name}/{customer specified event name}

Integrated configuration from the AWS console

Once you've completed the configuration in Mackerel, you'll need to create an event bus/rule with Amazon EventBridge in order to receive notifications.

  1. Open the Partner Event Sources page from the AWS console.
  2. Switch the console's region of operation to the AWS region to receive notifications that was set in Mackerel.
  3. Select the added event source and press the 'Associate with event bus' button in the upper right.
  4. Select the necessary access permission and click the 'Associate' button.
  5. Open the Rules page from the leftside panel, select the event bus that you created from the drop-down list, and click 'Create rule' at the bottom.
  6. In the Create rule screen, set the name, pattern, and targets. Then, in the Select event bus section, select the 'Custom or partner event bus' option and set your event bus.

JSON format

The JSON that will be sent contains the following. (Items may be added at any time)

javascript
{
  "orgName": "Macker...",
  "event": "alert",
  "memo": "memo....",
  "host": {
    "id": "22D4...",
    "name": "app01",
    "url": "https://mackerel.io/orgs/.../hosts/...",
    "type": "unknown",
    "status": "working",
    "memo": "",
    "isRetired": false,
    "roles": [
      {
        "fullname": "Service: Role",
        "serviceName": "Service",
        "serviceUrl": "https://mackerel.io/orgs/.../services/...",
        "roleName": "Role",
        "roleUrl": "https://mackerel.io/orgs/.../services/..."
      }
    ]
  },
  "alert": {
    "openedAt": 1473129912,
    "closedAt": 1473130092,
    "createdAt": 1473129912693,
    "statusChangedAt": 1473130092,
    "criticalThreshold": 1.9588528112516932, 
    "duration": 5, 
    "isOpen": true, 
    "metricLabel": "MetricName", 
    "metricValue": 2.255356387321597, 
    "monitorName": "MonitorName", 
    "monitorOperator": ">", 
    "status": "critical", 
    "trigger": "monitor", 
    "id": "2bj...",
    "url": "https://mackerel.io/orgs/.../alerts/2bj...",
    "warningThreshold": 1.4665636369580741
  },
  "resourceInfo": {
    "service":"ec2",
    "region":null,
    "accountId":null,
    "resourceType":"instance",
    "resourceId":"i-12345..."
  }
}

JSON items

KEYTYPEDESCRIPTION
orgNamestringname of the organization where the alert occurred
eventstringfixed as alert
memostringnotes for the monitoring configuration.
hostobjecthost information (output for alerts of host metrics only)
serviceobjectservice information (output for alerts of service metrics only)
alertobjectalert information
resourceInfoobjectAWS resource information (output for supported components only)

JSON items (host information)

KEYTYPEDESCRIPTION
idstringhost ID
namestringhost name
urlstringURL of the host details
statusstringhost status (working, standby, poweroff, maintenance)
memostringmemo registered to the host
isRetiredbooleanwhether or not retired
rolesarray[object]role information (if the role is configured to the host)

JSON items (role information)

KEYTYPEDESCRIPTION
fullnamestringservice name: role name
serviceNamestringservice name
serviceUrlstringURL of the service details
roleNamestringrole name
roleUrlstringURL of the role in service details

JSON items (service information)

KEYTYPEDESCRIPTION
idstringservice ID
memostringmemo registered to services
namestringservice name
orgIdstringID of the organization where the service is registered
rolesarray[object]role information (if the role is registered in services)

JSON Items (Metric information by query monitoring)

KEYTYPEDESCRIPTION
labelsobjectlabels of the metric e.g. { "http.method": "GET", "http.status_code": "200" }
namestringmetric name e.g. httpcheck.status

JSON items (alert information)

KEYTYPEDESCRIPTION
idstringalert ID
statusstringalert status (ok, warning, critical, unknown)
isOpenbooleanwhether or not the alert is open
triggerstringwhat triggered the notification (monitoring, manual, monitorDelete, hostRetire)
urlstringURL of the alert details
openedAtnumbertime the alert occurred (epoch seconds)
closedAtnumbertime the alert resolved (epoch seconds)
statusChangedAtnumbertime the alert status changed (epoch seconds)
createdAtnumbertime the alert occurred (epoch milliseconds). A deprecated item and not recommended. Please use openedAt
monitorNamestringname of the monitoring item that detected the alert
metricLabelstringtitle of the monitoring target’s metrics etc.
metricValuenumbermetric value at the time of detection
criticalThresholdnumberCRITICAL threshold
warningThresholdnumberWARNING threshold
monitorOperatorstring> or <
durationnumbermonitoring interval

※Alert information items fluctuate depending on the type of monitoring target (host metrics, service metrics, external monitoring, expression monitoring, query monitoring) and each configuration item. For example, if only the URL is configured with external monitoring, information for metrics, thresholds, etc. will not be included. The type of monitoring target and the output items correspond with possible input items from the monitoring configurations screen.

JSON items (AWS resource information)

EC2

When an alert occurs in an EC2 instance installed with mackerel-agent or AWS integration, the information that has already been acquired by Mackerel*1 will be returned with each field corresponding to ARN format.

KEYTYPEDESCRIPTION
servicestring[optional] service name ec2
regionstring[optional] region name
accountIdstring[optional] AWS account ID
resourceTypestring[optional] resource type instance
resourceIdstring[optional] resource ID (EC2 instance ID) i-12345...
[*1](#1) However, you cannot retrieve this information if `cloud_platform` is set to `none` in the mackerel-agent settings.