Best way to organize influx data coming from many iot sensors from many locations

Hi all
I’m new to influxdb… I installed a Tig stack and everything is going well. I’m receiving from my lorawan sensors and I have got my nice dashboard in grafana… But I don’t think I’m working in the best way. How to organize data and query to keep distinct different locations? Now I have 1 measurement for each sensor with many fields (temp humid pressure lux wind…) so I can have dashboard for each sensor… but sensors should be grouped by locations… I can pair location and lora application ID and store on different db based on application ID but it don’t seem to me very clean design… Suggestion?

@capodic A measurement per sensor seems unnecessary and can add a significant amount of system overhead depending on the number of sensors you have. I’d suggest storing all sensor data in a single measurement with multiple fields, but add a location tag to each point. I assume you’re using Telegraf to send sensor data to InfluxDB. If that’s the case, add a global tag in each Telegraf config unique to the sensor/location. To just reuse the same Telegraf config file, populate the global tag using an environment variable and just set the environment variable for each sensor.

Set the location evar
$ export LOCATION=some-location
Global tags in telegraf config file
[global_tags]
  location = "${LOCATION}"

This will give you a lot more flexibility with how you can use the data. You’ll be able to see correlation across locations in a single dashboard cell. You can have a single dashboard with a location template variable that will allow you to dynamically switch between locations. I think this would be the way to go.

1 Like

Hi scott, thanks for your suggestion…I think I’ll follow it. I only hope to set telegraf in the right way (telegraf documentations is a bit scarce)