Skip to content

Monitor#

Links to grafana, InfluxDB, Kibana and elasticsearch.

You need to provide authentication parameters for all queries. To learn more, see API Introduction.

For more info visit

Select, filter and delete value in influxDB#

Code samples

curl -X GET {server}/influxdb/query \
  -H 'Authorization: Basic {access-token}'

GET /influxdb/query

Show measurement#

$ curl -X GET {server}/influxdb/query \
  -H 'Authorization: Basic {access-token}' \

Get value from a measurement#

$ curl -X GET "{server}/influxdb/query?q=SELECT%20%2A%20from%20ifTable%20where%20time%20%3E%20now%28%29%20-%201h&db=telegraf" \
  -H  "accept: */*" \
  -H  "Authorization: Basic {access-token}"

The data after the q parameter is url encoded. If I decode it, it will look like this.

SELECT * from ifTable where time > now() - 1h

Get alerts#

$ curl -X GET "{server}/influxdb/query?q=SELECT%20%2A%20FROM%20alerts%20WHERE%20time%20%3E%20now%28%29%20-%2024h&db=telegraf" \
  -H  "accept: */*" \
  -H  "Authorization: Basic {access-token}"

Delete value#

$ curl -X GET "{server}/influxdb/query?q=DROP%20SERIES%20FROM%20%22ifTable%22%20WHERE%20%22resource%22%3D%27docker%27&db=telegraf" \
  -H  "accept: */*" \
  -H  "Authorization: Basic {access-token}"

Parameters

Name In Type Required Description
q query string false none
db query string false none

Responses

Status Meaning Description Schema
200 OK Action on influxDB None

Write data in influxdb#

Code samples

curl -X POST {server}/influxdb/write \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic {access-token}'

POST /influxdb/write

Create value#

$ curl -X POST "{server}/influxdb/write?db=telegraf" \
  -H  "accept: */*" \
  -H  "Authorization: Basic {access-token}" \
  -H  "Content-Type: application/json" \
  -d "ifTable,resource=docker temperature=42 160873958000000000"

Body parameter

The timestamps need 8 zero after the unixtimestamp(00000000).

"ifTable,resource=docker temperature=42 160873958000000000"

Parameters

Name In Type Required Description
db query string false none
body body string(binary) false Write data in influxdb

Example responses

400 Response

{
  "error": "0=i': missing fields"
}

Responses

Status Meaning Description Schema
204 No Content Success None
400 Bad Request Unable to understand the query Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
ยป error string false none none

Get dashboard by uid#

Code samples

curl -X GET {server}/g/api/dashboards/uid/{uid} \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic {access-token}'

GET /g/api/dashboards/uid/{uid}

Will return the dashboard given the dashboard unique identifier (uid).

Parameters

Name In Type Required Description
uid path string true none

Example responses

200 Response

{
  "value": {
    "uid": "string",
    "title": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK Get a single dashboards Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
ยป value object false none none
ยปยป uid string false none none
ยปยป title string false none none

Get a single kibana saved object#

Code samples

curl -X GET {server}/kibana/api/saved_objects/{type}/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic {access-token}'

GET /kibana/api/saved_objects/{type}/{id}

Retrieve a single Kibana saved specified by the ID

Parameters

Name In Type Required Description
id path string true none
type path string true none

Enumerated Values#

Parameter Value
type visualization
type dashboard
type search
type index-pattern
type config
type timelion-sheet

Example responses

200 Response

{
  "value": {
    "page": 0,
    "per_page": 0,
    "total": 0,
    "saved_objects": [
      {
        "uid": "string",
        "title": "string"
      }
    ]
  }
}

Responses

Status Meaning Description Schema
200 OK Structure of a Saved object Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
ยป value object false none none
ยปยป page integer false none none
ยปยป per_page integer false none none
ยปยป total integer false none none
ยปยป saved_objects [object] false none none
ยปยปยป uid string false none none
ยปยปยป title string false none none

Elasticsearch Search API#

Code samples

curl -X GET {server}/elasticsearch/{index}/_doc/{doc_id} \
  -H 'Authorization: Basic {access-token}'

GET /elasticsearch/{index}/_doc/{doc_id}

Get one document#

  $ curl -X GET {server}/elasticsearch/fluentd-default-000001/_doc/0 \
    -H 'Authorization: Basic {access-token}' \

For more info on Search query, you can visit

Parameters

Name In Type Required Description
index path string true none
doc_id path string true none

Responses

Status Meaning Description Schema
200 OK Content of a document None

Elasticsearch Match API#

Code samples

curl -X GET {server}/elasticsearch/_search \
  -H 'Authorization: Basic {access-token}'

GET /elasticsearch/_search

Get document from a datetime range#

  $ curl -X GET {server}/elasticsearch/_search \
    -H 'Authorization: Basic {access-token}' \
    -H 'content-type: application/json' \
    --data '{"query": {"bool": {"must": [],"filter": [{"match_all": {}},{"range": {"@timestamp": {"gte": "2021-03-30T16:52:10.115Z","lte": "2021-04-13T16:52:10.115Z","format": "strict_date_optional_time"}}}],"should": [],"must_not": []}}}'

This query will match all the document present in the timestamp range.

Get error from a datetime range#

curl --request GET \
  --url {server}/elasticsearch/_search \
  -H 'authorization: Basic  YWRtaW46dW5yeTBwYXNz' \
  -H 'content-type: application/json' \
  --data '{"query": {"bool": {"must": [],"filter": [{"bool": {"should": [{"match_phrase": {"level": "Error"}}],"minimum_should_match": 1}},{"range": {"@timestamp": {"gte": "2021-03-30T17:02:56.186Z","lte": "2021-04-13T17:02:56.186Z","format": "strict_date_optional_time"}}}],"should": [],"must_not": []}}}'

For more info on match query, you can visit

Responses

Status Meaning Description Schema
200 OK Value of the matching request None