This is a DRAFT Work In Progress - Contents subject to change.
This opCharts API provides access to opCharts inventory data in a JSON format.
The Inventory 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 Inventory "http[s]://server/omk/opCharts/v2/inventory"
We can view opCharts Inventory below using these endpoints - http[s]://server/omk/opCharts/v2/inventory
API Routes
Request Method | Operation | URL Example | id required | Notes |
---|---|---|---|---|
GET | read list | /server/omk/opCharts/v2/inventory | n | CHANGED response: Returns a list of all the inventory ids. Paginated. |
GET | read one | /server/omk/opCharts/v2/inventory/id | y | Returns the details of the requested inventory record. |
GET | read list | /server/omk/opCharts/v2/inventory/subconcepts | n | CHANGED URI: Returns a list of all the inventory subconcepts. |
GET | read list | /server/omk/opCharts/v2/inventory/subconcepts/subconcept | y | CHANGED URI: Returns a list of all the inventory ids for the given subconcept. Paginated. |
GET | read list | /server/omk/opCharts/v2/nodes/node_uuid/inventory/subconcepts | n | CHANGED URI: Returns a list of all the inventory subconcepts for the given node_uuid. Paginated. |
GET | read list | /server/omk/opCharts/v2/nodes/node_uuid/inventory/subconcepts/s ubconcept | y | CHANGED URI: Returns the list of inventory data for the given node_uuid and subconcept. 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: By default the nodes UUID is returned by default if no properties are given |
page | (int) Which page of the requested document to be returned, from 1 .. n, defaults to 1 |
limit | (int) How many results are returned, 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: for a string, if it starts with regex: or iregex: then a case-sensitive or case-insensitive regular expression match is used. eg: |
sort | 1 | -1 : sort the response with id ascending or descending. |
redact | 0 | 1 : redact the information in configuration. |
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/inventory for List
GET /omk/opCharts/v2/inventory
You will get a list of all the Inventory subconcepts in your database.
Successful Response
HTTP Status | Body | Description |
---|---|---|
200 OK | Possibly empty JSON array of strings | Each array element is a JSON string object with the subconcept name |
Unsuccessful Response
HTTP Status | Body | Description |
---|---|---|
401 Unauthorized | JSON object with an error property | You are not authenticated. |
403 Forbidden | JSON object with an error property | You are not authorized. |
Example
GET HTTP://server/omk/opCharts/v2/inventory.json Output:- List of all the distinct subconcepts present in inventory [ "health", "Host_Health", "laload", "mib2ip", "systemStats", "tcp", . . . "WindowsProcessor", "hrwin", "nodehealth", "NetFlowStats", "RouteNumber", "Buffers" ]
GET of opcharts/v2/inventory/subconcept for List
GET /omk/opCharts/v2/inventory/subconcept
You will get a list of the first 25 inventory objects for the given subconcept in your database.
You can use Request Modifiers (see above) for filtering, pagination, and selecting properties.
Successful Response
HTTP Status | Body | Description |
---|---|---|
200 OK | Possibly empty JSON array of objects | Each array element is a JSON object with the properties selected by the Request Modifiers (see above). |
Unsuccessful Response
HTTP Status | Body | Description |
---|---|---|
400 Bad Request | JSON object with an error property | |
401 Unauthorized | JSON object with an error property | You are not authenticated. |
403 Forbidden | JSON object with an error property | You are not authorized. |
404 Not Found | JSON object with an error property | You are authenticated but not authorised to view this object. |
404 Not Found | JSON object with an error property | The |
Example
GET HTTP://server/omk/opCharts/v2/inventory/interface.json Output :- List of first 25 interface inventory objects ("id" and "node_uuid") sorted by node_name in ascending order. [ { "id": "63195a0341073d2dd339ce47", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce5d", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce74", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce82", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce90", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ceba", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" },
Similar requests and descriptions with subconcepts
Request | Response |
---|---|
GET http://server/omk/opCharts/v2/inventory/interface.json?limit=50 | First 50 elements sorted by node_name ("id" and "node_uuid") |
GET http://server/omk/opCharts/v2/inventory/interface.json?limit=50&page=2 | Next 50 elements sorted by node_name ("id" and "node_uuid") |
GET http://server/omk/opCharts/v2/inventory/interface.json?limit=50&properties=["node_name"] | First 50 elements sorted by node_name ("id" , "node_uuid", "node_name") |
GET http://server/omk/opCharts/v2/inventory/interface.json?limit=50&page=2&properties=["data"] | Next 50 elements sorted by node_name ("id" , "node_uuid", "data") |
GET http://server/omk/opCharts/v2/inventory/interface.json?limit=50&properties=["node_name"]&filter={"data.ifIndex":3} | First 50 elements sorted by node_name, filtered by inventory.data.ifIndex => 3 ("id" , "node_uuid", "node_name") |
GET http://server/en/omk/opCharts/v2/inventory/interface.json?properties=["data.ifIndex","data.ifDescr","node_name","description"]&filter={"data.ifIndex":1} | First 25 interfaces sorted by node_name displaying 6 properties [ . . . |
GET of opCharts/v2/inventory/id
GET /omk/opCharts/v2/inventory/id
You will get the details of the given inventory object.
Successful Response
HTTP Status | Body | Description |
---|---|---|
200 OK | JSON object | A record with the details of the Inventory |
Unsuccessful Response
HTTP Status | Body | Description |
---|---|---|
401 Unauthorized | JSON object with an error property | You are not authenticated. |
403 Forbidden | JSON object with an error property | You are not authorized. |
Properties
Property | Description | Example |
| A globally unique ID | 65a5b8b843c6b8c138bc9cab |
| The concept for this inventory | "device" |
| The |
|
| ||
| Some inventory data is stored in "data" |
|
| Some meta-data about "data" is stored in "data_info" | |
| Some meta-data about time-series data related to this inventory is stored in "dataset_info" | |
|
| |
| 0 or 1 | |
| ||
| 0 or 1 | |
| The unix timestamp that this inventory record was last updated. |
|
| The | "vrouter_host" |
| The |
|
| array | response |
| The | lab_poller1 |
| An array of the subconcepts for this inventory record | [ "hrsmpcpu" ] |
| Describes the storage for time-series data for this inventory item. |
Example
http://server/omk/opCharts/v2/inventory/65a5b8b843c6b8c138bc9cab.json
{
"cluster_id": "660f29ae-f150-4119-bf04-cd9296852449",
"concept": "device",
"configuration": {
"group": "Lab_Servers"
},
"data": {
"hrCpuLoad": 100,
"hrDeviceDescr": "GenuineIntel: Intel(R) Xeon(R) CPU @ 2.20GHz",
"hrDeviceType": "1.3.6.1.2.1.25.3.1.3",
"index": "196609"
},
"data_info": [
{
"display_keys": [],
"enabled": 0,
"subconcept": "hrsmpcpu"
}
],
"dataset_info": [
{
"datasets": [
"hrCpuLoad"
],
"subconcept": "hrsmpcpu"
}
],
"description": "GenuineIntel: Intel(R) Xeon(R) CPU @ 2.20GHz",
"enabled": 1,
"expire_at": "2024-03-27T02:25:01.445Z",
"historic": 0,
"id": "65a5b8b843c6b8c138bc9cab",
"lastupdate": 1705359544.17113,
"node_name": "vrouter_host",
"node_uuid": "a8ac3d79-aa7c-496f-ae19-f6df04c58a21",
"path": [
"660f29ae-f150-4119-bf04-cd9296852449",
"a8ac3d79-aa7c-496f-ae19-f6df04c58a21",
"device",
196609
],
"path_keys": [
"index"
],
"server_name": "localhost",
"storage": {
"hrsmpcpu": {
"rrd": "/nodes/vrouter_host/health/hrsmpcpu196609.rrd"
}
},
"subconcepts": [
"hrsmpcpu"
]
}
Similar requests and descriptions with inventory id
Request | Response |
---|---|
GET HTTP://server/omk/opCharts/v2/inventory/63195a0341073d2dd339ce82.json | Raw inventory element with given id |
GET HTTP://server/omk/opCharts/v2/inventory/63195a0341073d2dd339ce82.json?properties=["data"] | Raw inventory element with given id ("id", "node_uuid" and all the properties in "data") |
GET of opCharts/v2/nodes/node_uuid/
inventory/subconcepts for List
GET /omk/opCharts/v2/nodes/node_uuid/inventory/subconcepts
You will get a list of all the Inventory subconcepts for the node with node_uuid.
Successful Response
HTTP Status | Body | Description |
---|---|---|
200 OK | Possibly empty JSON array of objects | Each array element is a JSON object with the properties selected by the Request Modifiers (see above). |
Unsuccessful Response
HTTP Status | Body | Description |
---|---|---|
401 Unauthorized | JSON object with an error property | You are not authenticated. |
403 Forbidden | JSON object with an error property | You are not authorized. |
GET HTTP://server/omk/opCharts/v2/nodes/08098577-5d8c-11e9-9614-8a6323fe4840/inventory/subconcepts.json Output:- List of all the distinct subconcepts present in inventory [ "Cisco_CBQoS", "Memory-cpm", "addressTable", "bgpPeer", "cempMemPool", "ciscoMemoryPool", "ciscoNormalizedCPUMem", "cpu_cpm", "entityMib", "env-temp", "interface", "pkts", "pkts_hc", "ospfNbr", "powerSupply" ]
GET of opCharts/v2/nodes/node_uuid/
inventory/subconcepts/subconcept for List
GET /omk/opCharts/v2/nodes/node_uuid/inventory/subconcepts/subconcept
You will get a list of all the Inventory records with the node with node_uuid and the subconcept subconcept.
Successful Response
HTTP Status | Body | Description |
---|---|---|
200 OK | Possibly empty JSON array of objects | Each array element is a JSON object with the properties selected by the Request Modifiers (see above). |
Unsuccessful Response
HTTP Status | Body | Description |
---|---|---|
401 Unauthorized | JSON object with an error property | You are not authenticated. |
403 Forbidden | JSON object with an error property | You are not authorized. |
GET HTTP://server/omk/opCharts/v2/nodes/08098577-5d8c-11e9-9614-8a6323fe4840/inventory/subconcepts/interface.json Output:- List of first 25 node inventory objects ("id" and "node_uuid") sorted by id inside given subconcept. [ { "id": "63195a0341073d2dd339ce47", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce5d", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce74", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce82", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ce90", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ceba", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" }, { "id": "63195a0341073d2dd339ced0", "node_uuid": "08098577-5d8c-11e9-9614-8a6323fe4840" } ]
Similar requests and descriptions with node and subconcept