This service provides functionality to query metrics data. At this moment, it just provides query service for raw-data only. Query for rolledup data is not built yet.
- Method:
GET - parameters
db- value for this parameter is the "db_" bucket routed for the tenant,measurementq- this parameter contains the query string
Call from REST client:
curl --request GET \
--url 'http://localhost:8080/query?db=db_0&q=select%20*%20from%20MAAS_cpu%20where%20time%20%3C%3D%20now()'
{
"results": [
{
"series": [
{
"name": "MAAS_cpu",
"tags": null,
"columns": [
"time",
"account",
"accountId",
"accountType",
"checkId",
"collectionLabel",
"collectionName",
"device",
"deviceLabel",
"entityId",
"monitoringSystem",
"monitoringZone",
"percentage_idle",
"percentage_system_usage",
"percentage_user_usage",
"tenantId"
],
"values": [
[
1574815565000,
"MAAS-account-name-0",
"\"dummy-account-id-id-0\"",
"CORE",
"\"dummy-check-id-id-0\"",
"\"cpu-collection-label\"",
"\"cpu\"",
"\"id-0\"",
"\"dummy-device-label-id-0\"",
"\"dummy-entity-id-id-0\"",
"\"MAAS\"",
"\"\"",
12091.0,
30076.0,
8622.0,
"CORE-MAAS-account-name-0"
],
[
1574815565000,
"MAAS-account-name-0",
"\"dummy-account-id-id-0\"",
"ENCORE",
"\"dummy-check-id-id-0\"",
"\"cpu-collection-label\"",
"\"cpu\"",
"\"id-0\"",
"\"dummy-device-label-id-0\"",
"\"dummy-entity-id-id-0\"",
"\"MAAS\"",
"\"\"",
10062.0,
7331.0,
27967.0,
"ENCORE-MAAS-account-name-0"
],
[
1574815565000,
"MAAS-account-name-0",
"\"dummy-account-id-id-1\"",
"CORE",
"\"dummy-check-id-id-1\"",
"\"cpu-collection-label\"",
"\"cpu\"",
"\"id-1\"",
"\"dummy-device-label-id-1\"",
"\"dummy-entity-id-id-1\"",
"\"MAAS\"",
"\"\"",
42874.0,
12361.0,
37602.0,
"CORE-MAAS-account-name-0"
]
]
}
],
"error": null
}
],
"error": null
}
- Method:
GET
- Method:
GET - Query parameters
measurement
- Method:
GET - Query parameters
measurement
- Method:
GET - Query parameters
measurementbegin: ISO Date Format yyyy-MM-ddThh:mm:ssV (2020-05-08T22:01:35Z)end: ISO Date Format yyyy-MM-ddThh:mm:ssV (2020-05-09T12:01:35Z)
Refer to the ceres-bundle to get the "main" Docker infrastructure containers running. The query service requires access to at least the InfluxDB container with the development profile.
- Generate some test data into Kafka by running the
test/data-generatormodule in the test directory of the bundle by usingmvn spring-boot-:run - In the apps directory of the bundle go into the
ingestion-serviceand run it usingmvn spring-boot:run.
Now, you should have some data to play with.
- On terminal window, run command
docker exec -it influxdb influxto access theinflux-cli - Run
use db_0to use databasedb-0 - Run
select * from MAAS_cpu limit 10to get some records, so that we can gettenantIdto query - When you have some results showing up for the query, look for the column
tenantIdand grab onetenantIdfrom the rows. For example:MAAS-account-name-0
When accessing the /v1.0/tenant APIs in a local development environment, you can simulate the behavior of Repose or make the invocation via Repose.
To simulate the behavior of Repose, access the query service directly at port 8080 and pass the headers:
X-Tenant-IdX-Roles, where development and test profiles default to allow "compute:default"
To access the tenant APIs via Repose, ensure the repose service is started from the test/instructure bundle module and access the API via port 8180. The following header needs to be set:
X-Auth-Token: a valid Identity token