0

having a machine which sends (not regularly) its status values 0, 1, 2, we're storing it in Graphite. Now the status means:

  • 0 - stopped
  • 1 - working
  • 2 - stopped by anomaly

The requested KPIs to extract are the classical ones: how much time on status 0 or 1 or 2 in a day or a week? Before reinventing the wheel, we're looking at the best way to compute those PKIs and if in Graphite (or possible other time-series solution) there are already function which deal with summing the time where the data point value is just a condition. Clearly the time intervals to sum are not stored, it's the time elapsed between a data point and the next one.

Or should the data pre-processed to compute the time intervals and then store three data sets like: status.working, status.stopped, status.alarm and for each store when the specific "event" started and how much it lasted?

There are other KPIs, for example the number of alarms in a day. Receiving two status data points in a row both indicating status "2" is actually a single alarm condition and must count as 1.

So, is there a best way to store such data without pre-processing it? It sounds to be a common pattern but (shame on us?) we have not found this topic well explored.

Thanks.

1 Answers1

0

Graphite has a number of functions that could help you here. One that stands out is the summarize() function in which you can pass an aggregation method (in this case sum) and a duration in minutes/hours/days/weeks/etc), take a look here

isNonNull is another useful function: it can be used to determine the existence of a datapoint regardless of the value.

When you say that the machie reports a value 0 to indicate it has stopped - does it actually send that value or does it report nothing? This is an important detail and will have some bearing on the end result of your solution.

tony ennis
  • 91
  • 6
  • Hi, thank you for your answer. The machine reports a "real" 0 when it is stopped. If the operator stops it, the machine sends an MQTT message "every minute" reporting zero. I've quoted "every minute" since we noted that is not real, sometimes there are few minutes gaps without any value from the machine. Anyway I suspect I'm missing some basic of time-series data management in Graphite! :-) – user2753996 Oct 02 '19 at 18:33