Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add opCore Integration API

...

A cookie is created and sent with the response.  This must be saved and passed with all requests below.  

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

opCore API provides access to all nodes -- their configuration, info and status.  Data for all nodes can be requested at one time, a subset of nodes or a specific node.

opCharts TopN API (

...

opCharts version 2.2.2+)

TopN data is created after every NMIS collect cycle and represents the top users of each resource type.  By default there are 6 topn documents created: cpuLoad, 

GET topn (fetch list of topn documents)

GET /omk/opCharts/topn/

Retrieves the topn documents available to opCharts.  No parameters are accepted.

Successful Response

Returns an array of hashes containing the id's of the TopN documents along with the url they can be accessed from. 

Code Block
[
  {
    "url": "/omk/opCharts/topn/cpuLoad",
    "topn_id": "cpuLoad"
  },
  {
    "url": "/omk/opCharts/topn/ifInErrorRates",
    "topn_id": "ifInErrorRates"
  },
  {
    "url": "/omk/opCharts/topn/ifOutDiscardRates",
    "topn_id": "ifOutDiscardRates"
  },
  {
    "url": "/omk/opCharts/topn/ifOutUtil",
    "topn_id": "ifOutUtil"
  },
  {
    "url": "/omk/opCharts/topn/ifInUtil",
    "topn_id": "ifInUtil"
  },
  {
    "url": "/omk/opCharts/topn/MemoryUsed",
    "topn_id": "MemoryUsed"
  }
]

GET topn document (fetch TopN document)

GET /omk/opCharts/topn/[topn_id][?count=X]

Retrieves the topn document.  Parameter topn_id is required and specifies the type of topn document to retrieve (which is generally a Resource). Also takes a query parameter named count which will limit the results to TopX.

Successful Response

Returns an array of hashes, each hash holds the current value of the resource, the last 12 data points (1h of 5 min data) of the resource along with various other info about the specific resource.  The array is in order from #1 topn user to #N topn resource. 

Code Block
[
  {
    "chart": "resource_id",
    "display_suffix": "",
    "value": 32.02,
    "data": [
      16.2295279333333,
      58.91759035,
      35.2548943,
      12.14511871,
      34.8192241666667,
      22.7064218466667,
      24.85018748,
      48.7659871666667,
      28.0707958966667,
      11.7892433066667,
      38.6264594666667,
      32.42676128
    ],
    "node": "cupid",
    "element": "cpuLoad",
    "index": "0",
    "resource_id": "systemStats",
    "property": "ssCpuRawIdle"
  },
  {
    "chart": "resource_id",
    "display_suffix": "%",
    "value": "13.02",
    "data": [
      12.04003358,
      10.0483504933333,
      10,
      10,
      10,
      10,
      12.87057157,
      13,
      13,
      13.9743139933333,
      14,
      11.07988942
    ],
    "node": "meatball",
    "element": "cpuLoad",
    "index": "0",
    "resource_id": "nodehealth",
    "property": "cpu"
  },
<snip>
]

Nodes

Nodes are gathered from the NMIS installation on the existing server.  Each node has a list of resources.  Each resource can either be indexed or non-indexed.  If non-indexed each resource contains a list of datasets (which are individual data points over time, eg. avgbusy5).  If indexed, the resource contains an array, each element in that array contains datasets.

GET nodes (fetch list of nodes)

GET /omk/opCharts/nodes/

Retrieves the nodes available to opCharts.  No parameters are accepted.

Successful Response

Returns an array of strings containing the node names 

Code Block
themeConfluence
[
  "odin",
  "sparkle",
  "maverick",
]

 

...

GET /omk/opCharts/nodes/[node]/resources/

Retrieves all resources for the specified node.  A resource is required when requesting specific datasets or indexed datasets.

Successful Response

Returns an array of resource objects. Each resource object has a value it can be identified by(which can be used in later requests) and a url that the resource value can be appended to in order to fetch information about this resource and it's name which can be displayed to users.

The resource block also contains an entry called "active_indexes", if this section is null the resource is not indexed, if it is an empty array the resource is indexed but no indexes exist.  If the entry contains array entries then these indexes are actively collected (to get a full list use the resource indicies below)

Code Block
[
  {
    "active_indexes": null,
    "value": "nodehealth",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "nodehealth"
  },
  {
    "active_indexes": [ "192.168.90.17" ],
    "value": "bgpPeer",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "bgpPeer"
  },
  {
    "active_indexes": null,
    "value": "mib2ip",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "mib2ip"
  },
  {
    "active_indexes": [ "2"],
    "value": "cbqos-out",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "cbqos-out"
  },
  {
    "active_indexes": [ "2", "1" ],
    "value": "pkts_hc",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "pkts_hc"
  },
  {
    "active_indexes": [ "2", "1" ],
    "value": "interface",
    "url": "/omk/opCharts/nodes/asgard/resources",
    "name": "interface"
  }
]

...

GET /omk/opCharts/nodes/[node]/resources/[resource]/

Retrieves all datasets for the specified node & resource.

Successful Response

An array of dataset objects. Each dataset object lists it's resource, the value it can be identified by, a url that the value can be appended to (if not ending in .json), tokens used for searching and it's name which can be used for displaying to users.

Non-indexed:

Code Block
[
  {
    indexed: "",
    resource_id: "mib2ip",
    value: "ipInAddrErrors",
    url: "/omk/opCharts/nodes/asgard/resources/mib2ip/datasets",
    tokens: [
      "ipInAddrErrors",
      "mib2ip"
    ],
    name: "ipInAddrErrors"
  },
  ...
]

If a dataset is indexed it must be accessed through one of the indexes provided by the resource.  This list can be found using the url listed in the dataset object.

Indexed: 

Code Block
[
  {
    indexed: "1",
    resource_id: "interface",
    value: "ifInOctets",
    url: "/omk/opCharts/nodes/asgard/resources/interface/indicies.json",
    tokens: [
      "ifInOctets",
      "interface"
    ],
    name: "ifInOctets"
  },
  ...
]

...

GET /omk/opCharts/nodes/[node]/resources/[resource]/indicies.json

Retrieve all indexes available from a resource.  This is only required if the dataset you wish to load is indexed.

Successful Response

Returns a hash, with the name of the resource.  A datum array of index objects, these hold the data you are likely looking for.  The value attribute holds the identifier for this object.  Name is the attribute which can be displayed to users.  The "active" property tells you if this index is being collected.

The list of datasets available for the specified resource along with the list of indexes create an N x M matrix of possible datasets.

Code Block
{
  name: "interface",
  datum: [
    {
      resource_id: "interface",
      value: "2",
      url: "/omk/opCharts/nodes/asgard/resources/interface/datasets",
      "active": 1,
      tokens: [
        "WAN/DSL",
        "FastEthernet0/1",
        "2"
      ],
      name: "WAN/DSL -- FastEthernet0/1 -- 2"
    }
  ],
  header: "interface"
}

If the resource is CBQoS and the index holds CBQoS data there will be an array of classes available from this index.

Another example, with CBQoS data: 

Code Block
{
  "name": "cbqos-out",
  "datum": [
    {
      "classes": [
        "InternetControl",
        "class-default",
        "Interactive",
        "Voice",
        "VPN",
        "WebTraffic"
      ],
      "resource_id": "cbqos-out",
      "value": "2",
      "active": 1,
      "url": "/omk/opCharts/nodes/asgard/resources/cbqos-out/datasets",
      "tokens": [
        "WAN/DSL",
        "FastEthernet0/1",
        2
      ],
      "name": "WAN/DSL -- FastEthernet0/1 -- 2"
    }
  ],
  "header": "cbqos-out"
}

 

Data

GET/POST node resource dataset (fetch data for a single dataset from a node resource)

GET /omk/opCharts/data_model_view/new?requestData=[JSON object]
POST /omk/opCharts/data_model_view/new 
  BODY WITH JSON OBJECT = { requestData: { contents listed below } }

Request data from a dataset.  There are 2 basic ways to request data.

  1. Request NMIS dataset information for a specific dataset from an RRD file (nmis_rrd)
  2. Request NMIS graph information, this provides the same data that is displayed in NMIS graphs and are defined by nmis Graph-*.nmis files (nmis_graph)

 

 The request structure is not simple. The required inputs are resource, dataset, possibly index.  

Required Parameters

...

requestData (struct)

 

...

If using nmis_rrd: maps to a resource found using Get Node Resources (value attribute, which is the ID).

If using nmis_graph: maps to the name of the graph if not indexed, maps to the same as nmis_rrd if indexed

...

Only used if the resource is indexed:

 nmis_rrd: same as graph_type

nmis_graph: the name of the graph

...

opCharts Node Resource API

Access resources available for each node, like interface data, health data, CBQoS data (and more).  The data available will vary per node, this API allows you to determine what each node offers and also how to access the performance data associated with that resource

...

 

Request  Example

Code Block
{
  "requestData": {
    "model": "nmis_rrd",
    "model_view": "graph",
    "data_source": "local_nmis",
    "parameters": {      
      "start_date_raw": 1401346748,
      "end_date_raw": 1401951548,
      "node": "asgard",
      "graph_type": "nodehealth",
      "field": "avgBusy5",
      "resource_index": "",      
      "index_graph_type": "",
      "axis": "0"      
    },
    "options": {      
    }   
  }
}

Successful Response

A successful response will be a hash with 2 objects.  The requestObject that was submitted along with a responseObject : 

Code Block
{
  "requestData": {
    ... <snip, same as above >...
  },
  "replyData": {
    "options": {
      "subtitleText": null,
      "titleText": null,
      "yAxis1TitleText": null,
      "plotBands": [],
      "yAxis0TitleText": null
    },
    "min": null,
    "stacking": null,
    "max": null,
    "meta_data": {
      "time_start": 1400206204,
      "start_date_input": "2014-05-16 12:10:04",
      "end_date_input": "2014-05-23 12:10:04"
    },
    "data": [
      {
        "yAxis": 0,
        "color": null,
        "stack": null,
        "name": "avgBusy5",
        "type": null,
        "data": [
          [
            1400206500000,
            null
          ],
          [
            1400206800000,
            null
          ],
          [
            1400571000000,
            6
          ],
          [
            1400571300000,
            6.99308580333333
          ],
          [
            1400571600000,
            9.98057514
          ],
          [
            1400571900000,
            8.00908836666667
          ],
          [
            1400572200000,
            6.01230244666667
          ],
          [
            1400572500000,
            3.02188843
          ],
          [
            1400572800000,
            2.00550849666667
          ],
        ]
      }
    ]
  }
}

For nmis_rrd, the important data is held in replyData->data->[0]->data, this is an array holding [ time, value ].  Time is in Javascript time format (and not unix epoch, to get this simply divide by 1000 ).

For nmis_graph, the data is almost the same but there may be more than 1 entry in replyData->data.  There will be one per dataset that is on the graph, for example avgbusy1, avgbusy5.  

If there is no data for that time in NMIS null will be returned.