Dynamic panels based on variable

Hello all!!

I’m Barney and this is my first post in this community.

I have been playing with grafana for a few days and I’m in a point where I don’t know how to continue after googling a lot:

I have a dashboard with two variables: DS (Prometheus datasource type) and Node (query type that selects the different node names in each Datasource). I have been able to include CPU, Memory, etc panels that will change when I modify this two variables in the dropdown menues. This panels are for common info that all hosts have, but I want to show especific information regarding each node in addition to the general graphs: for example if one node has a nginx running, I want to show some stats from nginx in addition to CPU, memory, etc, If the node has a tomcat, I want to show some stats from tomcat in addition to CPU. Memory, etc…

I can distinguish between the services in each node by it’s name, so I’m looking a way to only show some panels if a variable has an especific string or value. Is that possible?

Other way to solve this is hidding the panels that are empty… In this way I can define a lot of panels in the dashboard but will only show the relevant ones…

So much thanks for your help :wink:

1 Like

Can you explain your architecture?

Our service use: Nagios + Icinga + Grafana

Hello thachnv92.

There is a problem independent from the architecture. The question is more focussed in a grafana functionality regarding templated dashboards.

Thanks for your reply :wink:

Hello All.

I have been looking for other solutions to my problem. I’m playing with text panel trying to introduce JavaScript. The idea is to inclue JS code that will generate a link to other dashboard based on the value of variable “Node”. The problem I have found is to capture the onChange() event in the dropdown menu that shows the variable values for “Node”. Anyone know how this HTML element can be referred (it doesn’t have id tag) :frowning:

Any suggestions on this??

1 Like