The events API allows you to consume events generated by Metricly. You can either grab a list of events generated by Metricly or grab an individual event by its ID. To explore Metricly’s REST API and test some requests, go here.

Metricly CLI

The Metricly CLI provides a command-line interface to the Metricly API. See the GitHub page for installation steps.

Swagger

To explore Metricly’s REST API and test some requests, go here. Log in using your Metricly credentials.

Methods

Request Header for all Methods
Header Name Header Value
Content-Type application/json

POST to
/ingest/events/{apiId}
Creates an external event within Metricly.
[
  {
    "source": "My Custom Datasource",
    "title": "Server message 2",
    "tags": [
      {
        "name": "Event Tag",
        "value": "External"
      }
    ],
    "type": "INFO",
    "data": {
      "elementId": "us-east-1:i-123a4567",
      "level": "WARNING",
      "message": "WARNING: Event is triggering!"
    }
    
  }
]

This method utilizes the Ingest API endpoint.

Replace {apiId} in the above URL with the API key from your Custom integration. To access this key, click Integrations in the user account drop-down menu in the top right-hand corner of Metricly, then find the CUSTOM integration and copy the API key from the API Key column.

Parameters
Parameters Required/Optional Description
events Required Body parameter; see below
apiId Required URL (path) parameter; your API key.
X-Netuitive-Api-Options Optional Header parameter. Two values you can include:

  • The value SEND_RESPONSE_BODY if you desire a detailed “Success Response” body.
  • The value INJECT_TIMESTAMP if you want the custom ingest service to inject the current server timestamp into the element sample’s “timestamp” property.

    This will overwrite any passed-in timestamps if they exist.

Body Attributes
Attribute Required/Optional Description
type Required The type attribute tells Metricly what type of event this is; valid inputs are INFOWARNING, or CRITICAL.
tags Optional You can tag events to enable filtering in Metricly by passing in keys and values. The format for tags is [{“name”:”key1″, “value”:”value1″}, {“name”:”key2″, “value”:”value2″}, (etc.)]
data Required The data attribute provides Metricly with the content for the actual event. It contains three attributes:

  • elementId (required)
    • This should contain the fully qualified name (fqn) of the element you wish to generate an external event for.
  • level (optional)
    • The severity level of the event. Valid inputs are Info, Warning, or Critical.

      If values are set at both level and type, the level  value will take precedence since it’s closer to the message itself and more specific.

  • message (optional)
    • The message text generated for the event.
source Optional Source of the event. This is set to the ingested integration if the value is missing.
title Required Title of the event.
timestamp Optional You can define a timestamp, but it must be in the epoch format. If you do not define a timestamp, Metricly will create one for you.

If you do not include a timestamp, you must include X-Netuitive-Api-Options: INJECT_TIMESTAMP in the header.


GET from /events/delete/{eventID}

Returns an event based on the ID you pass into the URL.

Replace {eventId} in the above URL with the event ID from any of your events.

Parameters Required/Optional Description
eventId Required URL (path) parameter. Your event ID.

GET from /events

Returns a list of events, filtered by parameters passed into the call.
Parameters
Parameters Required/Optional Description
 duration Optional Query parameter. Gives Metricly an ISO 8601-formatted duration time frame to retrieve data. The duration ends at the current time and begins anytime in the past two weeks. The duration parameter will take precedence over startTime and endTime if all attributes are included in your request.
startTime Optional Query parameter. The start of the window of time from which events will be returned. The startTime must be in ISO 8601 format. The default startTime is 12:00 AM in the authenticating user’s specified time zone.
endTime Optional Query parameter. The end of the window of time from which events will be returned. The endTime must be in ISO 8601 format. The default endTime is the current time.
category Optional Query parameter. Array of categories assigned to the desired events.
elementId Optional Query parameter. Array of element IDs to which the desired events are associated.
elementName Optional Query parameter. Array of element names to which the desired events are associated.
elementType Optional Query parameter. Array of element types to which the desired events are associated.
elementTags Optional Query parameter. JSON-encoded map of element tags to which the desired events are associated.
policy Optional Query parameter. Array of Policy IDs to which the desired events are associated.
isExternal Optional Query parameter. Whether the event is external or not.
title Optional Query parameter. The title of the event.
type Optional Query parameter. The type of event.

DELETE from /events/delete/{policyId} 

Deletes events created by a policy.

Replace {policyId} in the above URL with the Policy ID from any of your policies.

Parameters Required/Optional Description
policyId Required URL (path) parameter. The ID of the policy.
capterra

Join other DevOps who love Metricly!

Sign up for a free, fully featured, 21-day trial. No credit card required!