Discussion:
[influxdb] Kapacitor retagging measurement using regex?
a***@gmail.com
2017-08-21 08:46:51 UTC
Permalink
I'm using InfluxDB as a Prometheus remote_storage_adapter provider,
which supports writes&reads, and using prometheus to scrape haproxy (I am aware of telegraf supporting Prometheus type scrapes, not using that atm)

Consider the following measurement:

Influx line protocol:
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver01 value=1
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver02 value=1

Prometheus:
hapoxy_server_up{backend="be_http_myproject_myapp",instance="myserver01"} value=1
hapoxy_server_up{backend="be_http_myproject_myapp",instance="myserver02"} value=1

I'd like to be able to add a tag to that datapoint by processing the 'backend' tag through regex, so that the end result would be:

Influx line protocol:
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver01,project=myproject,application=myapp value=1
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver02 value=1

Prometheus:
hapoxy_server_up{backend="be_http_myproject_myapp",instance="myserver01",project="myproject",application="myapp"} value=1
hapoxy_server_up{backend="be_http_myproject_myapp",instance="myserver02",project="myproject",application="myapp"} value=1

The regex would be like this: http://regexr.com/3gjf9 (/"be_.*http_(.*)_(.*)"/)
And using capture group $1 and $2 I can identify the projectname and applicationname of the haproxy backend..

Any suggestions on how to implement this in TICK Script syntax?
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/f21cdfc7-186c-43dc-bfa5-554e80092e34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...