Aggregate data from multiple databases into a single one

Dear all,

I’m new to InfluxDB and searched the Internet multiple times, but I didn’t find a working solution… I hope you can help:
I have three identical Equipments storing their data into Influx databases with the same parameters (identical structure and names). I use Grafana to visualize the data and everything works well. Now I want to display the aggregated values. To reuse the existing dashboard I want to store the aggregated values into a new one.

Example: Each equipment is recording the power consumed:
Equipment 1 -> 300W -> stored in DB1
Equipment 2 -> 150W -> stored in DB2
Equipment 3 -> 200W -> stored in DB3

Sum up all values -> 650W -> stored in DB4. This shall be done automatically with all values so that DB4 has the same structure as the other three.

Thanks for your help in advance.

Hello @Payback2,
Welcome!
Please note you can’t join across buckets (which are databases + retention policies in 1.7+)–you can only join across measurements. If you’re looking to perform math across measurements you’ll have to enable Flux (v1.7+) or use 2.x (Flux is the default). You’ll want to join your data and then perform a sum.
I recommend doing this downsampling with a task.

For your consideration/future reference, ideally it would have been nice if your schema looked like like:
bucket: “my-bucket”
measurement: “equipment”
{tag_key: tag_value}: {equipment: 1, equipment: 2, equipment: 3}

This way you wouldn’t even need to perform any joins.

Please let me know if you are able to and decide to change your schema (either to write your data to the same bucket with different equipment measurements or, preferably, different tags). If you get to that point, I can help you with the task. :slight_smile:

Otherwise you’ll have to create a task to copy that data two the same bucket, and then create a task on top of that to perform the downsampling you’re interested in.

Thanks!

Hello @Anaisdg,

thank you for your answer! I will lookup the links you provided. One remark: unfortunately I can’t change the schema, as it’s programmed into the solution I use (It’s a tool to display data from photovoltaik equipment. Originally it supported only one equipment in parallel. I’ll assume they just copied the code when they added the support for 6 equipments in parallel.)

1 Like

Hello @Payback2,
I understand. It was just a thought in case you could. Let me know how you get along :slight_smile: