Skip to end of banner
Go to start of banner

opCore API V1

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 2 Next »

opCore Integration (API version 1, Node config/info/status)

opCore provides access to common data shared through all Opmantek applications.  Not all applications expose or use all parts of opCore, opCharts allows access to the functionality below. 

When listing resources (viewing the index) the default behaviour is to show only what has been asked for, by default only showing the ID's and modifiers will build up the info requested.  When an individual resource is requested (show) all info is provided by default and modifiers will pair down the info provided.

Authentication is required to access all methods below.

API Endpoint

All requests are made under the following base URL: 

http[s]://server/omk/opCharts/v1/

Request Modifiers (query parameters)

The properties request modifier tells opCore which properties you would like listed, query limits the requested resources to only those that match all criteria given.

Not all requests will use all request modifiers. Arrays / KVP's are url encoded JSON. E.G.  javascript: urlencode(JSON.stringify(array)); perl: URI::Escape::uri_escape(encode_json($array));

Query ParameterPossible Values
properties

Array of property names. If provided only the properties specified will be returned (instead of the whole document), special property of opcore_all_properties will return all known properties.

eg: properties=["status.nodeModel","info.system.cbqos"]

query

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: query=["config.group","NMIS8","status.nodestatus","reachable"] (which is "config.group"="NMIS8" AND "status.nodestatus"="reachable" )

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 HTTP://server/omk/opCharts/v1/nodes?query=["config.group","NMIS8"]&properties=["status.nodestatus"]

This will query all nodes that are in the group NMIS8 and return their nodestatus': 

[
  {
    "node_id": "C1135FBE-9AE1-11E4-A17D-1794FCA8A343",
    "status": {
      "nodestatus": "reachable"
    }
  },
  ...
]

Nodes (Config/Status/Info)

opCore provides access to all known nodes in the system. Nodes can be listed or viewed individually.

node_id

node_id is a UUID, assigned by NMIS, it will be in this form:

"node_id": "C1135FBE-9AE1-11E4-A17D-1794FCA8A343"

Index (List)

GET /nodes/

Retrieves a list of all node id's/names, returns them as an array.  Accepts all modifiers.  If property modifier is set, the results will be an array of objects (hashes) with the properties requested found inside the object (hash).  This request will always return the node_id, along with any other info listed in properties.

Successful response

# no properties or query requested
[
	"$UUID1", # node1
	"$UUID2", # node2,
	...
	"$UUIDn"
]
 
# query only: query=["config.group","group_1","summary.roleType","core"]
[
	"$UUID2",
	"$UUD142"
]
 
# properties only: properties=["name","server_name"]
[
	{
		"node_id": "$UUID1",
		"name": "node_name_1",
		"server_name": "server_name"
	},
	...
]

 
# query and properties: query=["node_name","asgard"]&properties=["config.group"]
[
  {
    "node_id": "C1135780-9AE1-11E4-A17D-1794FCA8A343",
    "config": {
      "group": "Branches"
    }
  }
]

Show (Get)

GET /nodes/#node_id

Retrieves the specified node object (hash) and returns all known info about it (so it may be large), accepts properties request modifier.  It is recommended to use the properties query modifier to narrow down the data returned to only the data required.

Successful Response 

# no properties specified, all data is returned, this will have some common data structures and some specific to the node / model
{
	"node_id": "$UUID1",
	"name": "node1"
	"config": { ... full of info ... },
	"info": { ... full of info ... },
	"status": { ... full of info ... },
	...
}
# properties=["node_id","config.group","info.system.sysDescr"]
{
	"node_id": "$UUID1",
	"config": {
		group: "group1"
	},
	info: {
		system: {
			sysDescr: "something really long and full of great info"
		}
	}
}
  • No labels