Multiple template variables postgresql

@daniellee – Thanks for your response. My problem is solved and I should have marked it as such.

Let me also start by saying that I’m a complete newbie trying to come up to speed with both Grafana and Postgresql but have lots of experience programming in general. So most of my issues are probably related to my newbieness.

And you are right, I did not explain my problem clearly as I left out a key fact that I was trying to use a templated variable for the location. So here is the problem I was trying to solve. The data is in a postgresql table with timescaledb extension installed.

Table is called temperature
There are 3 columns.
Column 1 is labelled time and is timestamp with timezone
Column 2 is labelled location and is an integer which represents various locations.
Column 3 is labelled value and is the temperature reading at that location and time.

I first created a variable called location in my dashboard. It takes on values from 1 to 8 corresponding to my various locations. I set it to be multi valued and with option to select all.

My first challenge was how to access the variable I had created with the quotes etc escaped properly. The templating document on grafana does explain all of this and it was a question of trying out the various ways. The (${location:csv}) worked for me.

The next issue was to be able to be able to plot the various locations in various colors. For that I got it to work by the location::text as metric by the tip given in this thread.

1 Like