Gauge with dynamic maximum

Hi,

I have use case where I would like to use the Gauge visualisation to display the currently running number of pods on a node inside a Kubernetes cluster. A node can have a maximum number of pods running at any given time. Said maximum can change based on different factors, but suffice to say that I can retrieve it on a per node basis. Also, the number of nodes is dynamic, I can have more or fewer nodes based on scaling, nodes terminating prematurely etc.

The idea is to have each individual Gauge with its own maximum and then the current number of pods.

Is this something that can be achieved?

What I have right now are two Gauge visualisations that need to be mixed together.

Hi @cosmincatalin and welcome to the Grafana Community Forum.

Yes, it can be achieved using the transformation Config from Query Results.

In this setup below, the “max” value on the gauge comes from a separate query (“B”) (it’s not hard-coded). So if TotalUnitsPurchased were increased to, say, 5000, the gauge would reflect that.


1 Like

Thank you for the response, it does seem like it’s a step in the right direction, but I cannot get this to be applied in a general purpose way. I basically get rid of a maximum that gets applied as maximum, but I cannot get the rest to their corresponding values. Your approach I think works great for a single gauge, but I have a situation where I have grouped data and the groupping values are dynamic (IPs can change, machines die)

Hi,

I’m not sure you can use this transformation for multiple gauges that way. Have you tried creating a variable with possible hosts and then using this variable in Repeat for option in the gauge? That way you would have as many visualizations as there are nodes and each would use Config from query correctly (the same as Grant showed).

1 Like

check this out

Indeed, the default Gauge does not seem to do it. As for Business Text, that’s going to be an uphill battle :slight_smile:

1 Like