Events

You can use the /events endpoint to create and retrieve events. Note: there is currently no available methods to update existing events. You will need an API token, represented in each example as <API_TOKEN>.

Create an Event

Creating custom events can be done with a request like the one below:

curl -X POST https://app.vividcortex.com/api/v2/events \
  -H 'Authorization: Bearer <API Token>' \
  -H 'Content-Type: application/json' \
  --data-binary \
  '{
      "start": 1341446430,
      "host": 132,
      "duration": 60,
      "type":  "Custom Event",
      "level": "info",
      "message": "Here is a custom event I created!"
}'

The above request will create a custom event with the given parameters:

  • start: The Unix timestamp to create the event at.
  • host: The ID of the host to associate the event with. If unspecified, a global event is created.
  • duration: The duration of the event in seconds. Defaults to 0.
  • type: The category to create the event under.
  • level: The severity of the event. This can be info, warn, or crit. Defaults to info.
  • message: A description explaining what the event is.

Note that host, duration, and level are all optional, so an event can be created as long as it has a start time, a type and a message.

Get a list of recent Events

Getting a list of recent events can be done with a request like the one below:

curl -X GET https://app.vividcortex.com/api/v2/events?from=-3600&until=0&host=100,101 \
  -H 'Authorization: Bearer <API Token>' \
  -H 'X-Indent: true'

You can specify:

  • from: The start of the timeframe to fetch Events for. This can be a relative time or a Unix timestamp.
  • until: The end of the timeframe to fetch Events for. This can also be relative or a Unix timestamp.
  • host: A host ID, or list of host IDs, to fetch Events for.
  • addGlobal: This should always be 1. This will also fetch Events which are not associated with any host (global events).

The response will look like the below:

{
  "data": [
    {
      "start": 1474999720,
      "uuid": "c3275df8f07d223fc260451b6b453365",
      "host": 100,
      "type": "Agent Startup",
      "duration": 0,
      "level": "info",
      "digest": "12999091233602395932",
      "message": "vc-os-metrics starting version 1.7.337",
}, {
      "start": 1475000395,
      "uuid": "4f03b88bd29188301e5ddaedf26b2428",
      "host": 101,
      "type": "Agent Startup",
      "duration": 0,
      "level": "info",
      "digest": "12999091233602395932",
      "message": "vc-mysql-query starting version 1.7.337",
  } ]
}