Rrd4j setup and limitations

Hi All!

I have a couple of quick questions on rrd4j setup, i read the tutorials, but couldn’t find the answer or interpret the answer from what was there:

#1— is the fastest you can record data points every 60 seconds? Or can you go shorter? I would like to save a unique value every 20 seconds. I setup my configuration as below, but it doesn’t seem to work (data is recorded as the default):

pv.def=GAUGE,600,0,U,20
pv.archives=AVERAGE,0.5,1,180:AVERAGE,0.5,3,720:AVERAGE,0.5,15,288:AVERAGE,0.5,30,1008:AVERAGE,0.5,180,720:AVERAGE,0.5,1080,720
pv.items=PVInputW,PVLoadW

My sample interval there, should be (i think), every 20 seconds? yes?

The data source i’m recording updates every 5 seconds and i have the strategy set to ‘everyChange’:
PVLoadW : strategy = everyChange, everyMinute
PVInputW : strategy = everyChange, everyMinute

#2---- Second question on rrd4j: I would like to capture a single value for an item, every day at 11:59pm. Use case: My solar charge unit has a reported value of ‘energy generated daily’, which resets at midnight each day. I’d like to record a history of the final value each day and chart it… any ideas how i could set this up? Maybe a cron strategy with that time? (But i read that for charting you HAVE to have everyMinute strategy?).

Thanks!

  1. Every minute is the slowest. You can record faster than that. You do not need to change any of the settings in rrd4j to achieve this. Just set up your .persist file to save every 20 seconds. By changing rrd4j’s config, you are forcing the DB to require an entry every 20 seconds for all your Items. And you still need to change the strategy in the .persist file to actually save every 20 seconds.

tl;dr, leave the rrd4j settings at the default. Make sure the .persist file strategy saves at least every 20 seconds.

Your .persit strategy is every change, not every update. It may report every five seconds but only changes will be recorded. And you changed the RRD4J config to require data every 20 seconds so it’s very possible not enough data points are being saved often enough.

#2 with rrd4j yes, you have* to have a value recorded every minute, unless you change the config in which case you need to save everything at that changed rate.

RRD4J is fundamentally designed such that it does not easily support the use case of saving just one value at midnight. Furthermore, if you plan on charting this value, charting software in general is not designed to chart just one value stored at midnight unless you are looking at a chart period larger than a day. For example, in Graphana you can configure it to just use the last value to draw the line when there isn’t a value for that time, but the last value has to be within the time window being charted. It won’t go back further to find the previous value outside of the current chart time period.

So if you want to chart the daily value, you need to resave it to the database periodically anyway.

But to answer the question, you can trigger a rule at midnight and call MyItem.persist() and it will save the current value to the default database. If rrd4j isn’t the default, you can pass it as an argument. Myitem.persist(“rrd4j”).

Bear in mind you can persist any Item with everyMinute strategy, even if you choose to only update it once a day.

You’ll probably need to think about what happens on a reboot. I should think a mapdb+restore on that Item would be useful.

In addition to what @rlkoshak said about #2, I’m using a database for something like that. I do update my value once a day but it is persisted every minute.
I tweaked the database to keep those minute-wise values for 24 houres but only a single value per day for my desired timeframe.
Charting this is no problem with the standard chart, just never request a timeframe below 24 houres.

Thanks! Great idea, i’ll setup another ‘item’ and then run a rule at 23:59 each day to update it, great idea!

Thank you! I will have a play and update and see what i can achieve.