IBM Support

Map Prometheus cloud private events (or any event types) to Cloud Event Management

Technical Blog Post


Abstract

Map Prometheus cloud private events (or any event types) to Cloud Event Management

Body

 

Cloud Event Management provides DevOps (& Ops) teams with pre-configured event correlation, incident prioritization, notifications and runbooks (automated and manual) in a seamless experience suitable for any skill level.  You can subscribe to Cloud Event Management here.

 

This blog outlines how to send events to Cloud Event Management using the Event Management sample application. If you have an event source that posts a JSON payload to a webhook, you can use the following example to ingest events into Cloud Event Management.

 

Our working example accepts Prometheus cloud private events. However, you can alter the mapping to accept other JSON formats. And if necessary, change the API endpoint name as well.

 

Public GitHub containing the Sample Application repository

Use this link to obtain the sample application: https://github.com/IBM-Bluemix/cloud-event-management-sample

Once you have the sample application repository in your GitHub, open and follow the instructions in the README.md file starting with "Running the app on Bluemix".

You will need to update the config.js and manifest.yml files as instructed. The Prometheus mapping is performed in the app.js file.  The app.js file can be customized to support events of any format.

 

Once configured and bound to your Cloud Event Management service instance

Post your events to the following Restful API endpoint: https://{your_app_name}-imperative-moreness.mybluemix.net/api/prometheus

The URL shown is generated by Bluemix when any application is pushed, the resourcepath "/api/prometheus/ is set in app.js for our example.

In the  README file, follow the "Using the app" step #2. Also, use the "Configure a webhook receiver" link to find out more about how to configure Prometheus.

Prometheus events are included in the sample repository in the sample-events folder.

 

To send Prometheus events manually issue the following commands

curl -H 'Content-Type: application/json' -X POST  https://{your_app_name}-imperative-moreness.mybluemix.net/api/prometheus -d "$(cat ./sample-events/prometheus-firing.json)"

 

Or include the event JSON in the curl request as follows:

 

curl -H 'Content-Type: application/json' -X POST https://{your_app_name}-imperative-moreness.mybluemix.net/api/prometheus -d '{
"receiver": "webhook",
"status": "firing",
"alerts": [{
"status": "firing",
"labels": {
"alertname": "monitor_service_down",
"instance": "nodeexporter:9100",
"job": "nodeexporter",
"monitor": "docker-host-alpha",
"severity": "critical"
},
"annotations": {
"description": "Service nodeexporter:9100 is down.",
"summary": "Monitor service non-operational"
},
"startsAt": "2017-08-23T11:26:20.84Z",
"endsAt": "0001-01-01T00:00:00Z",
}],
"groupLabels": {
"alertname": "monitor_service_down"
},
"commonLabels": {
"alertname": "monitor_service_down",
"instance": "nodeexporter:9100",
"job": "nodeexporter",
"monitor": "docker-host-alpha",
"severity": "critical"
},
"commonAnnotations": {
"description": "Service nodeexporter:9100 is down.",
"summary": "Monitor service non-operational"
},
"externalURL": "http://1ac7f53fffea:9093"
}'

 

Incident Details view for the event sent above using the curl command:image

 

 

What was demonstrated

For any JSON payload with some simple JSON mapping, you can convert events from any existing or custom source into the Cloud Event Management event format. Installing the publicly available sample application, enables you to configure and then send Prometheus cloud private events to Cloud Event Management.

 

Authors:

Adam Archambault

Phil Riedel

Sudhakar Chellam

 

 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11080045