Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: English / wording

Table of Contents

...

Code Block
{
  "success" : true,
  "data" : {
    "metrics" : ["jvm.files.open", "jvm.files.open.max", "jvm.files.open.percentage", "jvm.gc.collection.count", ... "solr.cache.doc.autowarm.count", "solr.cache.doc.evicted", "solr.cache.doc.hits", "solr.cache.doc.hits.percentage", "solr.cache.doc.lookups", ...]
  }
}

Returned metric keys can be used to obtain data points using metrics data API, or list of available filters using metrics filters API.

Metrics Data

For a particular SPM application, this API call will return data points for referenced metric(s) and time span, matching specified filters.

...

In case a metric group prefix is used instead of specific metric group, response will contain a property for each metric in a metric group. Example response for metric:"os.cpu.*":

Code Block
{
  "success" : true,
  "data" : {
    "start" : "2016-03-28 13:41:39",
    "end" : "2016-03-28 13:46:39",
    "granularityMillis" : 60000,
    "os.cpu.interrupt.soft" : [ {
      "values" : [ [ 1459129260000, 0.016619662452155185 ], [ 1459129320000, 0.033222591196565156 ], [ 1459129380000, 0.00828157572110189 ], [ 1459129440000, 0.008298066426549504 ], [ 1459129500000, 0.01664031773581799 ], [ 1459129560000, 0.008309790554097375 ] ]
    } ],
    "os.cpu.interrupt" : [ {
      "values" : [ [ 1459129260000, 0.0 ], [ 1459129320000, 0.0 ], [ 1459129380000, 0.0 ], [ 1459129440000, 0.0 ], [ 1459129500000, 0.0 ], [ 1459129560000, 0.0 ] ]
    } ],
    "os.cpu.idle" : [ {
      "values" : [ [ 1459129260000, 93.72611045572539 ], [ 1459129320000, 94.26910285247953 ], [ 1459129380000, 93.10986407254323 ], [ 1459129440000, 92.41556853084373 ], [ 1459129500000, 94.23412832370889 ], [ 1459129560000, 94.6568063356735 ] ]
    } ],
    "os.cpu.nice" : [ {
      "values" : [ [ 1459129260000, 1.0387233772495639 ], [ 1459129320000, 1.0382061410056171 ], [ 1459129380000, 0.9772391027954195 ], [ 1459129440000, 0.9376815891807583 ], [ 1459129500000, 1.0067393062185772 ], [ 1459129560000, 0.9223866684069032 ] ]
    } ],
    "os.cpu.user" : [ {
      "values" : [ [ 1459129260000, 1.1052019439602878 ], [ 1459129320000, 1.0714284830327485 ], [ 1459129380000, 1.5899928903997484 ], [ 1459129440000, 1.0040660376124901 ], [ 1459129500000, 0.9235379671442533 ], [ 1459129560000, 0.9306961265693783 ] ]
    } ],
    "os.cpu.wait" : [ {
      "values" : [ [ 1459129260000, 1.2630872830425686 ], [ 1459129320000, 0.7059800629270097 ], [ 1459129380000, 0.9026915879685913 ], [ 1459129440000, 2.6055916962072447 ], [ 1459129500000, 1.098261636176697 ], [ 1459129560000, 0.5152067650603207 ] ]
    } ],
    "os.cpu.steal" : [ {
      "values" : [ [ 1459129260000, 1.8281531472831476 ], [ 1459129320000, 1.893687698204214 ], [ 1459129380000, 2.451285461048852 ], [ 1459129440000, 1.9832378759453313 ], [ 1459129500000, 1.797154731476287 ], [ 1459129560000, 1.9278707437673468 ] ]
    } ],
    "os.cpu.system" : [ {
      "values" : [ [ 1459129260000, 1.0221041302868925 ], [ 1459129320000, 0.9883721711542914 ], [ 1459129380000, 0.9606453095230476 ], [ 1459129440000, 1.0455562037839088 ], [ 1459129500000, 0.9235377175394872 ], [ 1459129560000, 1.0387235699684552 ] ]
    } ]
  }
}

Note that wildcards can result in large number of series to be returned and it may return a large number of data series and can result in large responseresponses, especially if combined with long time interval and filtering without aggregation. In such cases, granularity may be adjusted in order to control the number of returned data points returned

Metric data is aggregated to a single data series by default, but the API allows filtering of data by all dimensions and/or aggregating aggregation using non-default aggregation function. List of filters' values (dimensions) for a specific metric and time span can be obtained using the metrics filters API. There is also a special value "all" that can be used.

...

In this case there are two hosts that are sending metrics to the same SPM app and , so in the response the metric property contains separate data series for each host. In case that a metric has more than one dimension, filters can be combined and the response will contain data series for each combination of values.

As noted before, by default, single, aggregated data series is returned. Aggregation is done on all data series, using default aggregation function (in case of os.cpu.* it is AVG). The API allows aggregating aggregation on only a subset of data series, using any aggregation function:

Code Block
# data point for last 5 min for metric os.cpu.user, using default granularity, separate data series for all hosts
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/spm-reports/api/v2/metrics/data" -d '
{
  "apiKey" : "a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken" : "262f66e5-0951-488b-9c92-379ba71a4299",
  "metric" : "os.cpu.user",
  "filters" : {
    "hostFilter": {"values":["test1.sematext", "test2.sematext"], "aggregation":"MAX"}
  }
}'
 

This call will result in a response similar to the one without filters, with the difference being that the MAX value is returned for each data point instead of AVG.

...

For a particular SPM application, this API call will return a list of available filters and their values for referenced metric(s) and time span, matching specified filters. Request The request format is similar to the one for returning metric data.

...

Response contains two filter types that can be used in metrics data API to filter data series or metrics filters API to limit filter values (e.g., to see what tags present are on host test1.sematext). In case of wildcards, there it is a chance possible to get a list of filters that cannot actually be applied to all metrics in a metric group, e.g. response for "metric":"os.*":

...