Metric sum per day

Hello everyone,

I am totally new to Grafana and the world of programming in general. I am an Environmental Engineering student out of Germany and working in the laboratory of the University. I have a machine here I am kind of responsible for. In the last time i had the idea to improve the machine a bit in terms of data usage. So I setup a postgres instance on a local server here and configured an logical replication to have a fallback in case of dataloss. Now I want to use this fallback server to be monitored by grafana. Here not only the performance of the server but more importantly for me the values the machine is creating.

I am facing at the moment the following problem:

I have a column “Value5” which in which i can find the total gasproduction of one reactor. Every five minutes the machine is saving this value and it’s a sum. I added a picture of that so you can better understand what I mean.

For me its interesting to see how much gas was produced in one day ore in one week. So I created the following query with the build in query builder of grafana.

As you can see here I am looking for the max per day and then the delta. So I will get how much Litre was produced in one day.

My Problem now is that sometimes the machine has a problem and reboots. When this happens the Gascounter “Value5” will get a reset. So it will start again with 0. With the query at the moment I will get a big negative value displayed. Do you know a solution for that problem? What can I write into the query that he will know and don’t give out a negative value?

I use Grafana v 6.0.2 and Postgres 10

Best regards

Harm Wilken