Table of Contents |
---|
opCore Integration (API version 2, Node config/info/status)
...
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 |
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","catchall.data.nodestatus": "reachable"] } (which is "configuration.group"="NMIS8" AND "catchall.data.nodestatus"="reachable" ) |
count | (int) 0 or 1, if set to 1 the results are returned paged including the link to the next paged document and the total results for the requested collection |
page | (int) Which page of the requested document to returned |
limit | (int) How many results are returned, defaults to 25 |
...
Code Block |
---|
GET HTTP://server/omk/opCharts/v2/nodes?limit=25&count=1&filter={"configuration.group" : "DataCentre", "catchall.data.nodestatus": "reachable" }&page=1&properties=["name","configuration.customer", "configuration.group"] |
This will query all nodes that are in the group NMIS8 and return their nodestatus':
Code Block |
---|
{ "nodes": [ { "configuration": { "customer": "Opmantek", "group": "DataCentre" }, "uuid": "3f49619e-b8ae-4e96-b56a-a7331baf71d3", "name": "monkeyRouter" } ], "total": 1 } |
Nodes (Config/Status/Info)
...
Retrieves a list of all node id's/names (limited to 25 use use the limit param to requst more), returns them as an an array with the key nodes. 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 uuid, along with any other info listed in properties.
...
Code Block |
---|
# no properties or query requested, limited to 25 nodes # GET /omk/opCharts/v2/nodes/ { "nodes": [ { "uuid": "44406ddf-8424-4f01-8314-9606911e5a05" }, { "uuid": "7949befd-c70e-4921-ad52-ced66489783b" }, { "uuid": "882d09cf-e0da-4153-a652-4ad1ea506d61" }, .... # Pagination page size set to {5 start at page 2 # GET /omk/opCharts/v2/nodes?limit=5&count=1&page=2 { "uuid@nextLink": "d89b4ade-8b6f-4df8-a7f9-e37132c64c85"/omk/opCharts/v2/nodes?limit=5&count=1&page=2&page=3", },"nodes": [ { "uuid": "fe09452b4c52b0f9-56462144-463849c9-acf38d4d-aa2e4a54d27711ab7c9dd814" }, .... # Pagination page size set to 5{ start at page 2 # GET /omk/opCharts/v2/nodes?limit=5&count=1&page=2 { "@nextLinkuuid": "/omk/opCharts/v2/nodes?limit=5&count=1&page=2&page=3",9c8ed1a9-b88a-4a53-9cd3-bf26c14d8322" "nodes": [ }, { "uuid": "4c52b0f9bdf1706a-21447694-49c9466c-8d4d9773-11ab7c9dd81470327a117af4" }, { "uuid": "9c8ed1a96c1ba844-b88ab7c1-4a534854-9cd3bef1-bf26c14d832288b0b77c6385" }, { "uuid": "bdf1706a3f0af422-76946100-466c4c8a-9773a7f4-70327a117af44634c116d499" }, ], { "total": 536 } #Filtered nodes by group and current status # "uuid": "6c1ba844-b7c1-4854-bef1-88b0b77c6385" GET/omk/opCharts/v2/nodes?filter=["configuration.group" : "DataCentre", "catchall.data.nodestatus": "degraded" ] { },"nodes": [ { "uuid": "3f0af422a18b705c-6100db8e-4c8a4aa6-a7f4b5d4-4634c116d499ff637d2adbbe" }, ], { "total": 536 } #Filtered nodes by group and current status # GET/omk/opCharts/{{version}}/nodes?filter={"configuration.group" : "DataCentre", "catchall.data.nodestatus": "degraded" } { "uuid": "1ef5e314-76ec-4f3a-84ab-f6d6f6460f86" "nodes": [}, { "uuid": "a18b705c058ef0de-db8ee6b8-4aa64475-b5d48c0b-ff637d2adbbec13712242919" }, ] } # {properties "uuid": "1ef5e314-76ec-4f3a-84ab-f6d6f6460f86" },only: ["name","configuration.active","configuration.customer", "configuration.group"] # GET /omk/opCharts/v2/nodes/?properties=["name","configuration.active","configuration.customer", "configuration.group"] { "nodes": [ { "uuidconfiguration": "058ef0de-e6b8-4475-8c0b-c13712242919"{ }, {"active": 1, "uuidcustomer": "a97ae784-fdb1-4fcf-a516-d844dc744846" }, Opmantek", { "uuidgroup": "1465e2fc-d781-4c70-a9e6-52fc714b4950NMIS9" }, }, { "uuid"name": "987cc9cbmaster-4c42-45db-b267-b6511003308a" }nine-local", { "uuid": "3224427c44406ddf-f06d8424-49154f01-ab088314-902ce620aef89606911e5a05" }, # query and { "uuid": "3d994eb5-dcba-46de-bb90-914b5dde822f" } ] } # properties only: properties: query=["node_name","asgard"]&properties=["config.group"] # GET /omk/opCharts/v2/nodes?filter=["configuration.group" : "DataCentre", "catchall.data.nodestatus": "degraded"]&properties=["name","configuration.active","configuration.customer", "configuration.group"] #{ GET /omk/opCharts/v2/nodes/?properties=["name","configuration.active","configuration.customer", "configuration.group"] { "nodes": "nodes": [ { "configuration": { "active": 1, "customer": "Opmantek", "group": "NMIS9DataCentre" }, "name": "master-nine-localeris", "uuid": "44406ddfa18b705c-8424db8e-4f014aa6-8314b5d4-9606911e5a05ff637d2adbbe" }, # query and properties: query=["node_name","asgard"]&properties=["config.group"] # GET /omk/opCharts/v1/nodes?filter={"configuration.group" : "DataCentre", "catchall.data.nodestatus": "degraded" }&properties=["name","configuration.active","configuration.customer", "configuration.group"] { "nodes": [ { |
Show (Get)
GET /nodes/#uuid
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
Code Block |
---|
# no properties specified, all data is returned, this will have some common data structures and some specific to the node / model # GET /omk/opCharts/v2/nodes/UUID1 { "uuid": "$UUID1", "name": "node1" "configuration": { ... data from this nodes configuration section ... }, "summary": { ... data from this nodes "active": 1, "customer": "", "group": "DataCentre" summary ... }, "cluster_id" : { ... uuid of which opHA server the node belongs to} ... } # properties=["configuration.services", "uuid", "catchall.data.last_poll", "catchall.data.nodestatus"] # GET /omk/opCharts/v2/nodes/UUID1?properties=["configuration.services", "uuid", "catchall.data.last_poll", "catchall.data.nodestatus"] { "catchall": { },"data": { "namelast_poll": "eris"1572835884.17908, "uuidnodestatus": "a18b705c-db8e-4aa6-b5d4-ff637d2adbbe"degraded" } }, |
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
Code Block |
---|
# no properties specified, all data is returned, this will have some common data structures and some specific to the node / model # GET /omk/opCharts/v1/nodes/UUID1 { "node_id": "$UUID1", "name": "node1" "config": { ... data from this nodes Nodes.nmis section ... }, "info": { ... data from this nodes "name-node.json" file ... }, "status": { ... data from this nodes nmis-nodesum.json section ... }, ... } # properties=["node_id","config.group","info.system.sysDescr"] # GET /omk/opCharts/v1/nodes/UUID1?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" } } } "configuration": { "services": [ "http_server", "nmis cgi", "port80" ] }, "uuid": "44406ddf-8424-4f01-8314-9606911e5a05" } |
Show Interface (Get)
GET /nodes/#uuid/interfaces/#index
Retrieves the specified node interface object (hash) and returns all known info about it (so it may be large).
Successful Response
Code Block |
---|
# GET /omk/opCharts/v2/nodes/UUID1/interfaces/IFINDEX
{
"@nodes_interface_url": "/en/omk/opCharts/nodes/NODEUUID/resources/interface/indicies/10",
"info": {
"Description": "Connection to ...",
"collect": "true",
"event": "true",
"ifAdminStatus": "up",
"ifDescr": "Tunnel100",
"ifHighSpeed": 0,
"ifIndex": 10,
"ifLastChange": "0:00:25",
"ifLastChangeSec": 25,
"ifOperStatus": "up",
"ifPhysAddress": "",
"ifSpeed": 9000,
"ifType": "tunnel",
"index": 10,
"interface": "tunnel100",
"ip": [
{
"ipAdEntAddr": "...",
"ipAdEntNetMask": "...",
"ipSubnet": "...",
"ipSubnetBits": 30
}
],
"ipAdEntAddr1": "...",
"ipAdEntNetMask1": "...",
"ipSubnet1": "...",
"ipSubnetBits1": 30,
"nocollect": "Collecting: Collection Policy",
"real": "true",
"setlimits": "normal",
"threshold": "true"
},
"name": "Eth1",
"node": {
"name": "nodeNAME",
"uuid": "NODEUUID"
},
"status": {
"discards_out": -1,
"errors_in": -1,
"util_in": 0,
"util_out": 0.45
}
}
|
Node Inventory, Status, Events
Node inventory is documented in the Inventory API
Node status is documented in the Status API
Node events is documented in the Events API
Postman Collection
A postman collection is available to test all this methods easily.
View file | ||||
---|---|---|---|---|
|
Don't forget to edit the variables to set all the properties related to the environment:
Perl Example
Attached a Perl example code that accesses opCharts API V2 and generates a json file with some of the obtained data.
To test, you should update the URL, user and password properties.
View file | ||||
---|---|---|---|---|
|