Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add iregex

This is a DRAFT Work In Progress - Contents subject to change.

Inventory API 

This opCharts API provides access to opCharts inventory data  in a JSON format.

...

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=["configuration.customer", "configuration.group"]

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

page(int) Which page of the requested document to returned, from 1 .. n
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: filter={"configuration.group":"NMIS8","data.index": "196609"} (which is "configuration.group"="NMIS8" AND "data.index"="196609" )

for a string, if it starts with regex: or iregex: then a case-sensitive or case-insensitive regular expression match is used.

eg filter={"node_name":"iregex:Switch"} to find all the nodes with switch or SWITCH in their name.

sort

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

redact

0 | 1 : redact the information in configuration.
** works only if you have MongoDB 4.2 and above and set db_use_v42_features => 1 in opCommon.json

...

Code Block
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"
]

...

Code Block
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"
	},   

...

RequestResponse
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

[
  {
    "data": {
      "ifDescr": "lo",
      "ifIndex": 1
    },
    "description": "lo",
    "id": "64250e8ef82d4b6e59e888d9",
    "node_name": "lab-primary1",
    "node_uuid": "f2163325-a2b6-4d9a-8705-0dc0397ee7e3"
  },
  {
    "data": {
      "ifDescr": "LOOPBACK",
      "ifIndex": 1
    },
    "description": "LOOPBACK",
    "id": "64cc4b8a5e13cceca7d030f7",
    "node_name": "SASINTEL_MARINA_PARK_P5_UPS01",
    "node_uuid": "9ac2e0ec-db2c-455a-9917-0471acaae231"
  },

 . . .
]



GET of opcharts/v2/inventory/id 

...