SOLVED Configuration of multiple templates in Influxdb graphite

scrool

Cadet
Joined
Apr 30, 2022
Messages
4
On TrueNAS-SCALE-22.02.3 I have installed official InfluxDB container image in version 1.8.x (1.8.10). I have enabled Graphite plugin (INFLUXDB_GRAPHITE_ENABLED=true). In TrueNAS I changed reporting to this server.

I would like to simplify queries with templates. I have enabled "Graphite Separate Instances" in a hope that it would match measurements easier. I have following measurements now:

Code:
SHOW MEASUREMENTS WITH MEASUREMENT =~ /disktemp.*.temperature*/'
name: measurements
name
----
servers.my_server.disktemp.sda.temperature
servers.my_server.disktemp.sdb.temperature
servers.my_server.disktemp.sdc.temperature
servers.my_server.disktemp.sdd.temperature
servers.my_server.disktemp.sde.temperature
servers.my_server.disktemp.sdf.temperature
servers.my_server.disktemp.sdg.temperature
servers.my_server.disktemp.sdh.temperature


I have found great resources how to configure InfluxDB https://www.truenas.com/community/threads/guide-to-setting-up-grafana-influxdb-metrics.88943/ , https://github.com/cucac/truenas-influxdb-grafana or other posts like https://www.truenas.com/community/t...cpu-disk-and-other-metrics.87107/#post-604023 that seem to work for cases where InfluxDB's configuration file can be edited directly.

In my case it would be config snippet like:

Code:
templates = [
  "*.*.disktemp.*" ".host.measurement.disk.field"
]


Since this is a container I need to set this value from environment variable. Container apparently accepts INFLUXDB_GRAPHITE_TEMPLATES. I was able to set one template entry, e.g.

Code:
*.*.disktemp.* .host.measurement.disk.field


and with that I ended up with just disktemp measurements.

But to add second template, which would be written in the config like this:
Code:
templates = [
  "*.*.disktemp.*" ".host.measurement.disk.field"
  "*.*.cputemp.*" ".host.measurement.cpu.field"
]


and my measurements matching these:

Code:
SHOW MEASUREMENTS WITH MEASUREMENT =~ /cputemp.*/' 
name: measurements
name
----
servers.my_server.cputemp.0.temperature
servers.my_server.cputemp.1.temperature
servers.my_server.cputemp.2.temperature
servers.my_server.cputemp.3.temperature


I have tried to quote values:
Code:
"*.*.disktemp.* .host.measurement.disk.field" "*.*.cputemp.* .host.measurement.cpu.field"


but that failed to start the server with error in logs:

Code:
run: invalid graphite config: invalid template format: '"*.*.disktemp.* .host.measurement.disk.field" "*.*.cputemp.* .host.measurement.cpu.field"'. To generate a valid configuration file run `influxd config > influxdb.generated.conf`


or:
Code:
*.*.disktemp.* .host.measurement.disk.field\n*.*.cputemp.* .host.measurement.cpu.field


(and other combination of DOS newlines) failed with:

Code:
run: invalid graphite config: invalid template tags: '.host.measurement.cpu.field'. To generate a valid configuration file run `influxd config > influxdb.generated.conf`


Could anybody help me with a way to represent this?
 

scrool

Cadet
Joined
Apr 30, 2022
Messages
4
Few hours later...

I have found the correct format - separate values by comma. So in my case it would be:

Code:
*.*.disktemp.* .host.measurement.disk.field,*.*.disktemp.* .host.measurement.disk.field
 
Top