Skip to end of banner
Go to start of banner

opCharts Latest Data API

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Latest Data API 

This opCharts API provides access to the Latest Data collection in a JSON format. The latest_data collection holds the raw values collected in the "data" section and all "stats" data in the "derived_data" section, the properties found in these sections are dynamic and are defined by the model used for the node. Each document in the collection has a link to its associated inventory_id and a subconcept array. Each entry in the subconcepts array holds a document with the subconcept name as well as a data and derived_data sub documents. There is a single record per inventory_id and the record holds the most recent readings/calculations for that piece of inventory.

The Latest Data API is available in opCharts from version 4.8.0

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

Public API for opCharts Latest Data "http[s]://server/omk/opCharts/v2/latest_data"

We can view opCharts Latest Data below using these endpoints - http[s]://server/omk/opCharts/v2/latest_data

API Routes

Request Method

Operation

URL Example

id required

Notes

GETread list /server/omk/opCharts/v2/latest_datan

Returns a list of all the latest_data records (latest_data id and node_uuid), use properties modifier to add more interesting information to the output

Paginated

GETread one /server/omk/opCharts/v2/latest_data/idyReturns the details of the latest_data with the given id. Use this to find what interesting properties can be added to a properties filter
GETread list

/server/omk/opCharts/v2/nodes/node_uuid/latest_data

y

Returns a list of all the latest data records (latest_data 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 per page, 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/latest_data for List

GET /omk/opCharts/v2/latest_data

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

Successful Response

HTTP Status

Body

Description

200 OKPossibly empty JSON arrayEach array element is a JSON string object with the subconcept name

Unsuccessful Response

HTTP Status

Body

Description

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/latest_data.json

Output:- List of first 25 latest_data 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/latest_data/id 

GET /omk/opCharts/v2/latest_data/id

You will get a single object for the given id 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 hashA JSON string object with the node_uuid, inventory_id and subconcepts array

Unsuccessful Response

HTTP Status

Body

Description

401 UnauthorizedJSON object with an error propertyYou are not authenticated.
403 ForbiddenJSON object with an error propertyYou are not authorized.

Example

http://server/omk/opCharts/v2/latest_data/64194dc7da587f6374d0396b.json

{
  "cluster_id": "2f4e78ab-3b96-4540-9184-e71b48fa8120",
  "configuration": {
    "group": "DC_Network"
  },
  "id": "64194dc7da587f6374d0396b",
  "inventory_id": "64194dabda587f6374cfcdc2",
  "node_uuid": "9ce8e534-25f7-4b0d-ba8d-49cc921952c4",
  "subconcepts": [
    {
      "subconcept": "interface",
      "data": {
        "ifInOctets": 0,
        "ifInOctets_raw": 0,
        "ifOperStatus": 100,
        "ifOutOctets": 716817,
        "ifOutOctets_raw": 33901301339
      },
      "derived_data": {
        "availability": 100,
        "inputBits": 0,
        "inputUtil": 0,
        "outputBits": 22215.42,
        "outputUtil": 0.02,
        "totalUtil": 0.01
      }
    },
    {
      "subconcept": "pkts_hc"
      "data": {
        "ifInBcastPkts": 0,
        "ifInBcastPkts_raw": 0,
        "ifInDiscards": 0,
        "ifInDiscards_raw": 0,
        "ifInErrors": 0,
        "ifInErrors_raw": 0,
        "ifInMcastPkts": 0,
        "ifInMcastPkts_raw": 0,
        "ifInOctets": 0,
        "ifInOctets_raw": 0,
        "ifInUcastPkts": 0,
        "ifInUcastPkts_raw": 0,
        "ifOutBcastPkts": 1823,
        "ifOutBcastPkts_raw": 320360615,
        "ifOutDiscards": 0,
        "ifOutDiscards_raw": 0,
        "ifOutErrors": 0,
        "ifOutErrors_raw": 0,
        "ifOutMcastPkts": 6713,
        "ifOutMcastPkts_raw": 135566792,
        "ifOutOctets": 716817,
        "ifOutOctets_raw": 33901301339,
        "ifOutUcastPkts": 120,
        "ifOutUcastPkts_raw": 2944557
      },
      "derived_data": {
        "ifInDiscards": 0,
        "ifInDiscardsProc": null,
        "ifInErrors": 0,
        "ifInErrorsProc": null,
        "ifInNUcastPkts": 0,
        "ifInUcastPkts": 0,
        "ifOutDiscards": 0,
        "ifOutDiscardsProc": 0,
        "ifOutErrors": 0,
        "ifOutErrorsProc": 0,
        "ifOutNUcastPkts": 11.7,
        "ifOutUcastPkts": 0.32414
      }
    }
  ],
  "time": 1731625953.55326
}


Property

Description

Example

id

A globally unique ID

"63576103ad794974594a1f11"

cluster_id

The id of the NMIS poller server for the associated node

"6678b17aca40037e1139cace"

inventory_id

The id of the associated inventory record


node_uuid

The uuid of the associated node

"8da86248-40f3-4c92-90b6-736bb66814aa"

subconcepts

Array of documents per subconcept, each array entry contains a document with the subconcept name, a hash of all "data" values and a hash of all "derived_data" values


time

The unix timestamp that the record was made. 

1687213025


  • No labels