Skip to end of banner
Go to start of banner

opCharts TopN API

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

Version 1 Next »

TopN (v 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. 

[
  {
    "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. 

[
  {
    "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>
]
  • No labels