Rr4dj documentation suggestions

I have been trying to get rrd4j working (so far without success) but as I am trying to do that I noticed a few things in the docs that might be worth elaborating on.

One is that the docs say that “This service can be configured in the file services/rrd4j.cfg.” AFIK, the service MUST be configured in the file services/rrd4j.cfg. If you skip that step assuming you can accept the defaults it will not work, as there are no defaults.

Another is that the docs say “See Heartbeat, MIN, MAX for an explanation of , , and U.” There is no explanation of U further on in the documentation.

Finally, many Openhab users are noobs like me trying to record temperature readings. The example at the end of the doc is for a counter, not a gauge. It would be helpful to have a gauge example in there as well, for charting temps over a day, a week, a month and a year

If installing rrd4j through Paper UI, addons.cfg, REST API or karaf console, there should be absolutely no need to configure any value in rrd4j.cfg as there are default values. At least rrd4j works for me without extra configuration.
The only thing to do is, to set up rrd4j.persist correctly and if using persisted values, to refer to rrd4j.

rrd4j.persist:

Strategies {
        // for rrd4j, we need a cron strategy
        everyMinute : "0 * * * * ?"
}

Items {
        // let's store Wheater_Chart values in rrd4j
        Weather_Chart* : strategy = everyMinute, everyUpdate
}

.items

Number Temperature      "Temperatur [%.1f °C]"    <temperature> (Weather_Chart) {weather="locationId=darmstadt, type=temperature, property=current"}
Number Weather_Temp_Max "Maximum heute [%.1f °C]" <temperature> (Weather_Chart)	
Number Weather_Temp_Min "Minimum heute [%.1f °C]" <temperature> (Weather_Chart)	

rules

rule "Update max and min temperatures"
when
    Item Temperature changed or
    Time cron "0 0 0 * * ?"
then
    Weather_Temp_Max.postUpdate(Temperature.maximumSince(now.withTimeAtStartOfDay,"rrd4j").state)
    Weather_Temp_Min.postUpdate(Temperature.minimumSince(now.withTimeAtStartOfDay,"rrd4j").state)
end

sitemap

Chart item=Weather_Chart period=2W refresh=10000 

Result:

It’s really straight forward :wink:

Thanks very much for that. I did install through paper UI but never got it to work so I started playing around with the rrd4j.cfg file. In your installation, is there anything in that file? I am thinking of uninstalling rrd4j and reinstalling it to see if I can get it working

Well, the file was created through installation process, so there are some lines of comments:

rrd4j.cfg:

# please note that currently the first archive in each RRD defines the consolidation
# function (e.g. AVERAGE) used by OpenHAB, thus only one consolidation function is
# fully supported
#
# default_numeric and default_other are internally defined defnames and are used as
# defaults when no other defname applies

#<defname>.def=[ABSOLUTE|COUNTER|DERIVE|GAUGE],<heartbeat>,[<min>|U],[<max>|U],<step>
#<defname>.archives=[AVERAGE|MIN|MAX|LAST|FIRST|TOTAL],<xff>,<steps>,<rows>
#<defname>.items=<list of items for this defname> 

Thanks - the whole file is commented out, which was the case with mine as well. I did not realize that rrd4j would operate with an empty rrd4j.cfg file.

BTW, I am pleased to report that I have it working now. My issue was a poor definition of everyMinute. I had everyMinute : “0 0 0 * * ?” instead of everyMinute : “0 * * * * ?”