Rrd4j remembers old settings for rrd files (except in rrd4j.cfg)?

Hello Everyone,

I have been playing around a bit with the rrd4j persistence and different settings, and everything works fine now. I have created rrd files with different settings from rrd4j.cfg, but now want to have all rrd-files use the same configuration/archive settings.

So I set my config in rrd4j.cfg:

rrd-1min.def=GAUGE,900,U,U,60
rrd-1min.archives=AVERAGE,0.5,1,1440:AVERAGE,0.5,10,1008:AVERAGE,0.5,60,720:AVERAGE,0.5,180,720:AVERAGE,0.5,1440,365:AVERAGE,0.5,10080,3650

Everything else is commented out. However, upon deleting all of the old rrd-files, they are re-created with different file sizes corresponding to old rrd4j-settings:

-rw-r--r-- 1 openhab openhab  25616 Aug 18 14:04 Sensor_Multi_Hallway_Garage_Humidity.rrd
-rw-r--r-- 1 openhab openhab  25616 Aug 18 14:04 Sensor_Multi_Hallway_Office_Humidity.rrd
-rw-r--r-- 1 openhab openhab  25616 Aug 18 14:04 Sensor_Multi_Master_Bathroom_Humidity.rrd
-rw-r--r-- 1 openhab openhab 116408 Aug 18 14:04 Switch_ap2_online.rrd
-rw-r--r-- 1 openhab openhab 116408 Aug 18 14:04 Switch_ap3_online.rrd
-rw-r--r-- 1 openhab openhab 116408 Aug 18 14:04 Switch_Fan_Light_Master_Bathroom_Fan.rrd
-rw-r--r-- 1 openhab openhab  63872 Aug 18 14:04 Switch_Phone_Christina_online.rrd
-rw-r--r-- 1 openhab openhab 116408 Aug 18 14:04 Switch_Phone_Michael_online.rrd

Filesize 63872 is what I expect all of them to be, 25616 is from an earlier attempt and 116408 is the default configuration.
So, Openhab somewhere stores which settings to apply to rrd-files for some items it already knows. Where could that be stored?
Thanks!

Edit:

calling “config:list” from the karaf console (after deleting config/org/openhab/rrd4j.config) now gives me:

Pid:            org.openhab.rrd4j
BundleLocation: null
Properties:
   rrd-1min.archives = AVERAGE,0.5,1,1440:AVERAGE,0.5,10,1008:AVERAGE,0.5,60,720:AVERAGE,0.5,180,720:AVERAGE,0.5,1440,365:AVERAGE,0.5,10080,3650
   rrd-1min.def = GAUGE,900,U,U,60
   rrd-1min.items = *
   service.pid = org.openhab.rrd4j

Which is what I want, but they are still re-created to some old configurations.

I might add that I am trying to have ALL items on that rrd config.
To do that, do I need to omit the “rrd-1min.items” entirely or set it to “*”? Neither seems to do the right thing…and I want to avoid having to insert a comma-separate list of all the items I want to have persisted there…

Which items do you have set for a persist strategy in the rrd4j.persist file?
Only for those items any config will be used.

All of them:

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

Items {
        Sensor_Multi_Master_Bathroom_Humidity   : strategy = everyChange, everyMinute
        Sensor_Multi_Hallway_Office_Humidity    : strategy = everyChange, everyMinute
        Sensor_Multi_Hallway_Garage_Humidity    : strategy = everyChange, everyMinute
        Switch_ap2_online                       : strategy = everyChange, everyMinute
        Switch_ap3_online                       : strategy = everyChange, everyMinute
        Switch_Phone_Michael_online             : strategy = everyChange, everyMinute  
        Switch_Phone_Christina_online           : strategy = everyChange, everyMinute
        Switch_Fan_Light_Master_Bathroom_Fan    : strategy = everyChange, everyMinute
}

They are persisted, and the rrd-files are created for them. Just with the wrong configuration (which I deduct from the file size).

Have you tried clearing the cache and tmp files?

sudo service openhab2 stop
# change rrd4j config
# delete old rrd4j data files
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo service openhab2 start
1 Like

persistence services are essentially version 1.x
If you search you will find a rrd4j.config file - note the extension. See if your mystery settings are cached in there.

I already found the rrd4j.config file and renamed it, it was then re-created with the correct information.

Stopping Openhab2, clearing the cache and starting it up again did not change anything.

I may have to resolve to put every item into the rrd4j-config twice, once in the rrd4j.persist and then again in the rrd4j.cfg.

That worked when I put a long string of items into the rrd4j.cfg.

So the question remains, how can one apply a rrd4j-strategy to all items? Which items are to be persisted is regulated in rrd4j.persist, after all.

The naming of the persited items suggests that only the “Sensor***” items do store numerical data.

Quoting the documentation: “NOTE: rrd4j is for storing numerical data only. Attempting to use rrd4j to store complex datatypes (e.g. for restore-on-startup) will not work.”

That’s correct, the Sensor-items store numerical data, while the Switch-items store their on/off states. Which works well with rrd4j, I recently had a look at the rrd-files with the REST API, and they are storing their states as they should.

I only use rrd4j for select items, additionally, I am using MapDB to store the state of all items for a restore-on-startup.

I now searched through what feels like half of the community posts, but yet have to find how to tell rrd4j.cfg to apply my custom setting to all items. If I list them one by one on the .items option, it works as expected.