Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Cosmetics only

Table of Contents

...

For a particular SPM application, this API call will return a list of all available metrics for referenced the specified app token. Returned metric names are used in other API calls to reference metrics.

...

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/spm-reports/api/v2/metrics/list" -d '
{
  "apiKey": "a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken": "262f66e5-0951-488b-9c92-379ba71a4299"
}'

...

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.

...

Code Block
# data point for last 5 min for metric os.cpu.user, using default granularity
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"
}'
 
# data point for last hour, for all os.cpu metrics, using 5 min granularity
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.*",
  "interval" : "1h",
  "granularity" : "FIVE_MINUTES",
}'

# data point for specified interval, for all os.cpu.user metrics, using 1 min granularity
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",
  "start" : "2016-03-25 15:26:36",
  "end" : "2016-03-25 15:31:36",
  "granularity": "ONE_MINUTE",
}'

...

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":["all"]}
  }
}'

...

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"}
  }
}'
 

...

Code Block
# filters and their values for last 5 min for metric os.cpu.user
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/spm-reports/api/v2/metrics/filters" -d '
{
  "apiKey" : "a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken" : "262f66e5-0951-488b-9c92-379ba71a4299",
  "metric" : "os.cpu.user"
}'
 
# filters and their values for last hour, for all os.cpu metrics
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/spm-reports/api/v2/metrics/filters" -d '
{
  "apiKey" : "a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken"  :"262f66e5-0951-488b-9c92-379ba71a4299",
  "metric" : "os.*",
  "interval" : "1h"
}'

# filters and their values for specified interval, for all solr metrics, that are reported from test1.sematext
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/spm-reports/api/v2/metrics/filters" -d '
{
  "apiKey" : "a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken" : "262f66e5-0951-488b-9c92-379ba71a4299",
  "metric" : "solr.*",
  "start" : "2016-03-25 15:26:36",
  "end" : "2016-03-25 15:31:36",
  "filters" : ["hostFilter": {"values": ["test1.sematext"]}]
}'

...