Event integrations: Custom Events

Sysdig Monitor can ingest any custom event you want, including code deploys, auto-scaling activities, business level actions, etc. Sysdig Monitor will automatically overlay these events on charts and graphs, for easy correlation with your performance data.

There are many ways to send custom events to Sysdig Monitor:

  1. Application integrations
  2. Sysdigbot 
  3. Prebuilt python script 
  4. Python API
  5. REST API

 

1. Application integrations

Sysdig Monitor supports event integrations with certain applications by default. The Sysdig agent will automatically discover these services and begin collecting event data from them. For more information see the documentation on application event integrations

 

2. Sysdig Monitor Slackbot

Sysdigbot, the Sysdig Monitor Slackbot, allows you to post custom events directly to Sysdig Cloud through chats with a Slack bot. 

 

3. Prebuilt python script

The post_event.py example script offers an easy way to send events to Sysdig Monitor directly from the command line:

python post_event.py <sysdig-token> <name> [-d DESCRIPTION] [-s SEVERITY] [-c SCOPE] [-t TAGS] [-h]

 

4. Python sample client

The Sysdig Monitor python client acts as a wrapper around the Sysdig Monitor REST API. It exposes most of the REST API functionality as an easy to use and easy to install python interface.

Use the post_event() function to send events to Sysdig Monitor from any custom script. Here's a quick example:

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '..'))

from sdcclient import SdcClient

# Parse arguments
sdc_token = sys.argv[1]
name = sys.argv[2]

# Instantiate the SDC client
sdclient = SdcClient(sdc_token)

# Post the event using post_event(self, name, description=None, severity=None, event_filter=None, tags=None)
res = sdclient.post_event(name)

 

5. Curl sample client

The Sysdig Monitor REST API offers the full functionality of the Sysdig Monitor app over API. If you don't want to use the Python wrapper (described above) you can send custom events directly to Sysdig Cloud over the REST API.

Here is a curl example request to send: 


#!/bin/bash
SDC_ACCESS_TOKEN='626abc7-YOUR-TOKEN-HERE-3a3ghj432'
ENDPOINT='app.sysdigcloud.com'

curl -X POST -s 'https://'"${ENDPOINT}"'/api/events' \
-H 'Content-Type: application/json; charset=UTF-8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Authorization: Bearer '"${SDC_ACCESS_TOKEN}"'' \
--data-binary '{"event":{"name":"Jenkins - start wordpress deploy","description":"deploy","severity":"6","tags":{"build":"89"}}}' --compressed
sleep 5s

 

 

Have more questions? Submit a request