Using grafana counter to visualize weather data


I’m trying to visualize my weather data using grafana. I’ve already made the prometheus part and now I face an issue that hunts me for quite a while.

I created an counter that adds temperature indoor every five minutes.

var tempIn = prometheus.NewCounter(prometheus.CounterOpts{
    Name: "tempin",
    Help: "Temperature indoor",

for {

How can I now visualize this data that it shows current temperature and stores it for unlimited time so I can look at it even 1 year later like an normal graph?

tempin{instance="localhost:9999"} will only display added up temperature so its useless for me. I need the current temperature not the added up one. I also tried rate(tempin{instance="localhost:9999"}[5m])

How to solve this issue?


Although a counter is not the best solution for this use case, you can use the operator increase.


This will tell you how much the counter increased in the last five minutes

Answered By – Sergio Santiago

Answer Checked By – Katrina (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.