Use Warp 10™
Get an overview on how to use Warp 10™ for Metrics
Get an overview on how to use Warp 10™ for Metrics
Last updated 23rd August, 2019
The Warp 10 Platform is designed to collect, store and manipulate sensor data. In this guide, you will learn how to use Warp10 protocol with Metrics.
Being based on Warp10, we are first class citizens for it. All functions and calls are supported:
API | Method | Supported |
---|---|---|
/api/v0/update | POST | |
/api/v0/fetch | GET | |
/api/v0/exec | POST | |
/api/v0/delete | GET |
To push data to the platform, you will need a WRITE TOKEN. Warp10 supports authentification through X-Warp10-Token
.
The full documentation is available at https://www.warp10.io/content/03_Documentation/03_Interacting_with_Warp_10/03_Ingesting_data/01_Ingress/.
Write a file called warp.data
with this included:
1380475081000000// foo{label0=val0,label1=val1} 42
You can now push it to the platform using curl:
$ curl -H 'X-Warp10-Token: WRITE_TOKEN' -H 'Transfer-Encoding: chunked' \
--data-binary @warp.data 'https://warp10.gra1.metrics.ovh.net/api/v0/update'
or
$ curl -H 'X-Warp10-Token: WRITE_TOKEN' --data-binary "1380475081000000// foo{label0=val0,label1=val1} 42" \
'https://warp10.gra1.metrics.ovh.net/api/v0/update'
Don't forget to replace WRITE_TOKEN
by your own write token.
You can also use Python to push some data.
>>> import requests
>>> url = 'https://warp10.gra1.metrics.ovh.net/api/v0/update'
>>> headers = {'X-Warp10-Token': 'WRITE_TOKEN', 'content-type':'text/plain'}
>>> payload = "1380475081000000// foo{label0=val0,label1=val1} 42"
>>> r = requests.post(url, headers=headers, data=payload)
>>> r.status_code
Don't forget to replace WRITE_TOKEN
by your own write token.
Warp10 is providing a Query Language called WarpScript, designed to manipulate time series. It features:
Here's a WarpScript example:
'TOKEN_READ' 'token' STORE // Stocking token
[ $token ‘consumption’ {} NOW 1 h ] FETCH // Fetch all values from now to 1 hour ago
[ SWAP bucketizer.max 0 1 m 0 ] BUCKETIZE // Get max value for each minute
[ SWAP [ 'room' ] reducer.sum ] REDUCE // Aggregate all consumptions by room
[ SWAP mapper.rate 1 0 0 ] MAP // Consumption being a counter, compute the rate
To help you get started, we've created a "Tour" available at https://tour.warp10.io/.
The full documentation is available at https://www.warp10.io/doc/reference.
Write a file called script.mc2
with this content:
// Egress token to use
'TOKEN_READ' 'token' STORE
[ $token '~class.*' { 'foo' '=bar' } NOW 1 h ] FETCH // fetch from date (here NOW) to 1 hour ago.
Then, you can execute the query using curl
:
$ curl -X POST --data-binary @script.mc2 'https://warp10.gra1.metrics.ovh.net/api/v0/exec'
To delete all completely a series you can use the simple Warp 10 delete command used below replacing SERIES_NAME by your own series selector. Once the data are deleted you will not be able to retrieve them! Deleting data will not reduce your number of points per day pushed.
$ curl -H 'X-Warp10-Token: WRITE_TOKEN' 'https://warp10.gra1.metrics.ovh.net/api/v0/delete?deleteall&selector=sys.cpu.nice\{\}'
N’hésitez pas à nous proposer des suggestions d’amélioration afin de faire évoluer cette documentation.
Images, contenu, structure… N’hésitez pas à nous dire pourquoi afin de la faire évoluer ensemble !
Vos demandes d’assistance ne seront pas traitées par ce formulaire. Pour cela, utilisez le formulaire "Créer un ticket" .
Merci beaucoup pour votre aide ! Vos retours seront étudiés au plus vite par nos équipes..
Accedez à votre espace communautaire. Posez des questions, recherchez des informations, publiez du contenu et interagissez avec d’autres membres d'OVHcloud Community.
Echanger sur OVHcloud Community