I’m trying to change data in my rrd4j database using the rrdinspector as been written here.
I copied the rrd file in question onto my windows maschine and did run the “java -cp rrd4j-2.1.1.jar org.rrd4j.inspector.RrdInspector”. The Inspector started and I could open the database, however when trying to Edit any archive I get an error stating that the database is “not mapped for I/O”.
Sounds like the same that the REST API does tell me.
Reading the post above I understood it would be possible to manipulate an .rrd file.
Guess windows/permissions are in your way or the “copied” (over) file is actually empty due to the same restriction. Ensure you copy the file while openHAB is shutdown.
Furthermore, try to execute the (dos/cmd box) command as/with Administrator privileges.
I run & do things on Linux without any problem.
To bring back the modified rrd4j file, one should do this while OH is stopped, then replace the faulty with the corrected rrd4j and (re)start openHAB. I’m still looking for a method doing things online…while OH is active.
If things still fail, compare the copied-file with the original and optionally try if you can edit it with (any other, don’t care) hex-editor in order to check/test windows-level accessibility.
While the database is loaded into the inspector utility, can you view “info”-properties tabs ?
Update: Just verified things (using Linux), I get ‘your’ not-mapped I/O error if the file is actual empty or cannot read (0/zero bytes) . One will get a sync-error if the file is “In-use” and “Permission” error if file is not accessible due security. Again: check file properties > 0 bytes.
It was the missing admin privileges.
When opening the copied file on windows without those privileges I ended up with a file with 0 bytes.
I moved all to windows because on the raspi the X Server was missing.
Copied the changed file back, all looking good now.
This would be my suggestion for a tutorial (@vzorglub, @PtrO comments are welcome). I will publish that in seperate thread afterwards:
HowTo: Changing values in a rrd4j database.
Note: Due to the setup of rrd4j databases a wrong value saved in archive 1 will also affect corresponding values in further archives. The way the other archives are effected depends on the consolidation function used. One should consider the check/update all archives when trying to remove a false value.
In order not to work on the database in question while it is written to openHAB should be stopped.
The file “rrd4j-2.1.1.jar” which is used by openHAB is needed. If you are running oenHAB on a headless raspberry, you should copy the .jar and the the .rrd file to another system that has Java installed.
Having both (the .jar and the .rrd) in the same directory the rrdInspector is started on the console with:
On windows the console has to be started as Adminstrator!
Select your .rrd file and open the Archive for editing.
Change all false values, finding the values is easy since DateTime is given in a readable format.
Close the inspector.
Copy the changed .rrd back to your openHAB system and restart openHAB.
Well written. Absolutely no problem if you (@opus) would like to take care of this (as more active member than myself) for the community… I would be happy to verify and/or contribute to your article.
The only challenge for ignorant users may to locate/get the “rrd4j-2.1.1.jar” java executable file that contains the inspector GUI program.
I did this by walking the openHAB “…/userdata/cache/” directory (via find | grep) and searching the “rrd4j-2.1.1.jar” file.