opCharts Events API

Events API 

This opCharts API provides access to NMIS Event collection data in a JSON format.

The Events API is available in opCharts from version 4.7.0

Authentication is required to access all methods below. See opCharts REST API Reference.

Public API for opCharts Events "http[s]://server/omk/opCharts/v2/events"

We can view opCharts Inventory below using these endpoints - http[s]://server/omk/opCharts/v2/events

API Routes

Request Method

Operation

URL Example

id required

Notes

GETread list /server/omk/opCharts/v2/eventsn

Returns a list of all the event records (event id and node_uuid)

Paginated

GETread one

/server/omk/opCharts/v2/events/id

y

Returns the detail of the requested event record

GETread list

/server/omk/opCharts/v2/nodes/node_uuid/events

y

Returns a list of all the event records (event id and node_uuid), matching given node_uuid

Paginated

Request Modifiers (query parameters)

The properties request modifier tells opCharts which properties you would like listed, query limits the requested resources to only those that match all criteria given. This collection can paginated, it is also limited to 25 results by default (this could be subject to change in future opCharts versions) use the limit query parameter to request more nodes

Not all requests will use all request modifiers.

Query Parameter

Possible Values

properties

Array of property names. If provided only the properties specified will be returned (instead of the whole document).

eg: properties=["event","lastupdate"]

By default the nodes UUID is returned by default if no properties are given

page(int) Which page of the requested document to return, defaults to 1
limit(int) How many results to return, defaults to 25
filter

Array of key=value pairs, but coded in an array. Applied to the list of results in the order they are given. If an application key is provided that will be applied first.

eg: filter={"level":"Normal"}

sort

-1 | 1 : sort the response with id ascending or descending.

Examples of how to use the request modifiers can be found in the response blocks below.  In general, the queries will look something like this: 

GET of opcharts/v2/events for List

GET /omk/opCharts/v2/events

You will get a list of all the Event records in your database.

Successful Response

HTTP Status

Body

Description

200 OKPossibly empty JSON array of stringsEach array element is a JSON Hash with event attributes

Unsuccessful Response

HTTP Status

Body

Description

400 Bad RequestJSON object with an error propertyInvalid inputs, eg. malformed properties or filter
401 UnauthorizedJSON object with an error propertyYou are not authenticated.
403 ForbiddenJSON object with an error propertyYou are not authorized.

Example

GET HTTP://server/omk/opCharts/v2/events.json

Output:- List of first 25 event objects, sorted by id
[
	{
		"id": "648a0e4ca44a3ab377278383",
		"node_uuid": "8da86248-40f3-4c92-90b6-736bb66814aa"
	},
	{
		"id": "648a0e4ca44a3ab377278389",
		"node_uuid": "8da86248-40f3-4c92-90b6-736bb66814aa"
	},
	{
		"id": "648a0e4ca44a3ab37727838c",
		"node_uuid": "8da86248-40f3-4c92-90b6-736bb66814aa"
	},
	{
		"id": "648a0e4ca44a3ab377278542",
		"node_uuid": "8da86248-40f3-4c92-90b6-736bb66814aa"
	},
    . . .
]

GET of opCharts/v2/events/id 

GET /omk/opCharts/v2/events/id

You will get the details of the given event object.

Successful Response

200 OKJSON objectA record with the details of the Inventory

Unsuccessful Response

400 Bad Request 
JSON object with an error propertyevent with given id could not be found
401 UnauthorizedJSON object with an error propertyYou are not authenticated.
403 ForbiddenJSON object with an error propertyYou are not authorized.

GET of /opcharts/v2/nodes/node_uuid/events for List

GET /omk/opCharts/v2/nodes/node_uuid/events

You will get a list of the first 25 event objects for the given node_uuid in your database.

You can use Request Modifiers (see above) for filtering, pagination, and selecting properties.

Successful Response

HTTP Status

Body

Description

200 OKPossibly empty JSON array of stringsEach array element is a JSON object with all event attributes

Unsuccessful Response

HTTP Status

Body

Description

400 Bad Request
JSON object with an error propertyInvalid inputs, eg. malformed properties or filter, or node not found
401 UnauthorizedJSON object with an error propertyYou are not authenticated.
403 ForbiddenJSON object with an error propertyYou are not authorized to view the node

Example

GET HTTP://server/omk/opCharts/v2/events.json  

[
  {
    "ack": 0,
    "active": 1,
    "cluster_id": "f6faeac3-2282-465c-99fe-4ecc306a96fd",
    "configuration": {
      "group": "loadtest"
    },
    "context": {
      "class": null,
      "index": null,
      "name": "response",
      "source": "snmp",
      "thresholdtype": "health",
      "type": "threshold"
    },
    "details": "Value=155 Threshold=150",
    "element": null,
    "escalate": 10,
    "event": "Proactive Response Time",
    "historic": 0,
    "id": "66026a0b366e1f1c310be917",
    "lastupdate": 1711520710.86831,
    "level": "Warning",
    "level_previous": "Normal",
    "logged": 1,
    "node_name": "shire_500",
    "node_uuid": "1f7a4702-3b4d-4d51-9a4c-2e29dd97b74a",
    "notify": "email:contact1",
    "startdate": 1711434251,
    "stateless": 0
  },
  ...
]