How can I fetch a datapoint at certain time every day in Graphite? - graphite

I have a series of data that increases by time and resets to zero at 18:00 every day. How can I make a Graphite plot that only contains datapoints at 17:59 in the last 30 days?
I have tried summarize(1d, max, false), but it by default bins data into buckets that are calculated by rounding to the nearest interval to current time. So I cannot specify the beginning time of each bucket to be 18:00.

I couldn't find anything that exactly matches what you want. There are functions like timeSlice and timeStack but they do not really fit.
An alternative is to use the graphite function nonNegativeDerivative. It ignores when counters are reset to zero and only shows counter increments.

Related

How in opentsdb do I add up all datapoints in a specified time range?

I'm using opentsdb. I have ONE time series, with values at 10-minute intervals. I want to specify a start time and an end time, and get back a single number that is the sum of all the values in the specified time range. I tried what I thought to be correct
...start=<start>&end=<end>&m=sum...
but got back all the individual values rather than their sum.
Add the element downsample="0all-sum"; apparently, the "0all" is interpreted as "the interval containing all timestamps".

A difference between startof and firstof values of indexAt parameter in to.period

According to the documentation:
To adjust the final indexing style, it is possible to set indexAt to
one of the following: ‘yearmon’, ‘yearqtr’, ‘firstof’, ‘lastof’,
‘startof’, or ‘endof’. The final index will then be yearmon, yearqtr,
the first time of the period, the last time of the period, the
starting time in the data for that period, or the ending time in the
data for that period, respectively.
Now I try to do to.hourly for my minute data. I see that all values by default is set to the last minute in data. I want to set to the first minute. It seems indexAt is parameter exactly for that. I have one hour that starts at 09:30. As I understand from description 'firstof' should set it to 09:00 (first minute of hourly period) and 'startof' should set it to 09:30 (first available minute in hour data). 'startof' seems to work for me but 'firstof' does not work and still returns 09:59! Am I missing something?
If you look at the Usage section of ?to.period, you will see that only to.monthly and to.quarterly have indexAt arguments. That is why to.hourly ignores the indexAt argument.
Issue #158 briefly discusses the possibility of adding indexAt support for periods other than monthly and quarterly.

Show total number of points in Grafana

I store time period of a certain operation in Graphite. In my Grafana dashboard I show all the points which are greater than 15 minutes. I also want to show the count of such incidents daily. Is it possible to do so in Graphite/Grafana without adding a new metric?
To only show points that have a value > 15 minutes ( 15 min = 900,000ms )
removeBelowValue(test.a.b.c, 900000)
To get a running count of hits from the above:
A: removeBelowValue(test.a.b.c, 900000)
B: integral(divideSeries(removeBelowValue(test.a.b.c, 900000), #A))
Once you have both series queries entered, you can click the eyeball next to the A series to hide it, as the value we care about is going to come from B.
The value of this series will be the number of instances the A query has been above 900000.

RRDTOOL one second logging, values missing

I spent more than two months with RRDTOOL to find out how to store and visualize data on graph. I'm very close now to my goal, but for some reason I don't understand why it is happening that some data are considered to be NaN in my case.
I counting lines in gigabytes sized of log files and have feeding the result to an rrd database to visualize events occurrence. The stepping of the database is 60 seconds, the data is inserted in seconds base whenever it is available, so no guarantee the the next timestamp will be withing the heartbeat or within the stepping. Sometimes no data for minutes.
If have such big distance mostly my data is considered to be NaN.
b1_5D.rrd
1420068436:1
1420069461:1
1420073558:1
1420074583:1
1420076632:1
1420077656:1
1420079707:1
1420080732:1
1420082782:1
1420083807:1
1420086881:1
1420087907:1
1420089959:1
1420090983:1
1420094055:1
1420095080:1
1420097132:1
1420098158:1
1420103284:1
1420104308:1
1420107380:1
1420108403:1
1420117622:1
1420118646:1
1420121717:1
1420122743:1
1420124792:1
1420125815:1
1420131960:1
1420134007:1
1420147326:1
1420148352:1
rrdtool create b1_4A.rrd --start 1420066799 --step 60 DS:Value:GAUGE:120:0:U RRA:AVERAGE:0.5:1:1440 RRA:AVERAGE:0.5:10:1008 RRA:AVERAGE:0.5:30:1440 RRA:AVERAGE:0.5:360:1460
The above gives me an empty graph for the input above.
If I extend the heart beat, than it will fill the time gaps with the same data. I've tried to insert zero values, but that will average out the counts and bring results in mils.
Maybe I taking something wrong regarding RRDTool.
It would be great if someone could explain what I doing wrong.
Thank you.
It sounds as if your data - which is event-based at irregular timings - is not suitable for an RRD structure. RRD prefers to have its data at constant, regular intervals, and will coerce the incoming data to match its requirements.
Your RRD is defined to have a 60s step, and a 120s heartbeat. This means that it expects one sample every 60s, and no further apart than 120s.
Your DS is a gauge, and so the values you enter (all of them '1' in your example) will be the values stored, after any time normalisation.
If you increase the heartbeat, then a value received within this time will be used to make a linear approximation to fill in all samples since the last one. This is why doing so fills the gaps with the same data.
Since your step is 60s, the smallest sample time sidth will be 1 minute.
Since you are always storing '1's, your graph will therefore either show '1' (when the sample was received in the heartbeart window) or Unknown (when the heartbeat expired).
In other words, your graph is showing exactly what you gave it. You data are being coerced into a regular set of numerical values at a 1-minute step, each being 1 or Unknown.

Graphite: append a "current time" point to the end of a series

I have a "succeeded" metric that is just the timestamp. I want to see the time between successive successes (this is how long the data is stale for). I have
derivative(Success)
but I also want to know how long between the last success time and the current time. since derivative transforms xs[n] to xs[n+1] - xs[n], the "last" delta doesn't exist. How can I do this? Something like:
derivative(append(Success, now()))
I don't see any graphite functions for appending series, and I don't see any user-defined graphite functions.
The general problem is to be alerted when the data is stale, via graphite monitoring. There may be a better solution than the one I'm thinking about.
identity is a function whose value at any given time is the timestamp of that time.
keepLastValue is a function that takes a series and replicates data points forward over gaps in the data.
So then diffSeries(identity("now"), keepLastValue(Success)) will be a "sawtooth" series that climbs steadily while Success isn't updated, and jumps down to zero (or close to it — there might be some time skew) every time Success has a data point. If you use graphite monitoring to get the current value of that expression and compare it to some threshold, it will probably do what you want.

Resources