Prometheus > Grafana Using Non-Numeric Variables

HFTobeason
Posts: 297
Joined: Fri Nov 07, 2003 8:01 pm

Prometheus > Grafana Using Non-Numeric Variables

Post by HFTobeason »

@ jheddings - I've had some success implementing your plugin - thanks!
Screen Shot 2020-12-27 at 13.25.24.png
Screen Shot 2020-12-27 at 13.25.24.png (118.01 KiB) Viewed 2910 times
I've run into an issue that is stumping me - the plugin appears to convert all variables into numeric values. For example, I have a variable which tracks the MODE of various thermostats - HEAT|COOL|OFF. I'm at a loss as to how to get those variables across into Grafana.

Any advice most appreciated.

Thanks.
User avatar
jheddings
Posts: 149
Joined: Sun Dec 01, 2013 10:26 pm
Location: Denver, CO

Re: Prometheus > Grafana Using Non-Numeric Variables

Post by jheddings »

Sorry for the delayed response here!!

Due to the way that Prometheus stores data, it is not possible to save strings directly and report in Grafana. Unfortunately, the only option would be to create another variable and trigger on status changes, converting them to a numeric value for Grafana to display.

That being said, it's an interesting use case. I will look into creating a custom metric type that does this mapping for you, at least on the Indigo side. You'll still have to set up a Grafana display that interprets numbers as state information (e.g. 0 = off, -1 = cool, +1 = heat or something).

Would that approach work for you?
HFTobeason
Posts: 297
Joined: Fri Nov 07, 2003 8:01 pm

Re: Prometheus > Grafana Using Non-Numeric Variables

Post by HFTobeason »

@jheddings Thank you for your response. No worries re tardiness!

In the interim, I found a Grafana plugin that solved my problem: https://grafana.com/grafana/plugins/nat ... ete-panel/. To be honest, it's been long enough since I got it working that I really don't even remember how I did it...but until it breaks, I'm good to go...
Post Reply

Return to “Prometheus Client”