HowTo Change values in an rrd4j database

Note 1: 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 to check/update all archives when trying to remove a false value.

Note 2: In order not to work on the database in question while it is written too, openHAB should be stopped.

The file “rrd4j-2.1.1.jar” which is used by openHAB is needed ( on my openhabian installation to be found in folder “/var/lib/openhab2/cache/org.eclipse.osgi/222/.cp/lib”).
If openHAB is running on a headless raspberry, one 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 a windows system the console has to be started as Adminstrator!):

java -cp rrd4j-2.1.1.jar org.rrd4j.inspector.RrdInspector

Select your .rrd file and open the Archive for editing.
Change all false values by selecting the value under the “Archive Data” tab. 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.

[Edit:] The actually used rrd4j*.jar (atm version 3.1.1) doesn’t include the RrdInspector anymore, trying to start it as posted above would give this message: Fehler: Hauptklasse org.rrd4j.inspector.RrdInspector konnte nicht gefunden oder geladen werden (in english: Error: the main class org.rrd4j.inspector.RrdInspector could not be found or loaded).
Solution: Use Google to find a rrd4j*.jar including the rrdInspector (I used this)

4 Likes

I was not able to open my openhab2 rrdfile with rrd4j-2.1.1-inspector.jar.zip. (Nullpointer)

Used the 3.3.1 inspector from here: https://repo1.maven.org/maven2/org/rrd4j/rrd4j/3.3.1/

3 Likes

and now with OH 3.2.0 and rrd4j Version 3.4 you must use this:

https://repo1.maven.org/maven2/org/rrd4j/rrd4j/3.4/

1 Like

When I start the inspector and try to open an .rrd file from OH3, I am getting a “No valid RRD file specified” message. I have tried with multiple versions of the inspector (3.2, 3,4, etc…) and I always get the same message.
Java 17.0.2 SDK on macOS Catalina.
What am I doing wrong ?

I’d use the same java- version as your openhAB is running on.

Good point, just tried it.
Running 11.0.13 on the Openhab Synology virtual machine, I removed the Java 17 SDK and installed the 11.0.14 sdk on my Mac (can’t find the 11.0.13).
I stopped the OpenHab service, copied a temperature .rrd file, and opened the 3.4 and 3.2 inspectors but no luck, same message…

I managed to switch to the 11.0.13 jdk and ran from the terminal. When I open the .rrd file, I get this:

Philippe-Eth Downloads % java -cp rrd4j-3.4-inspector.jar org.rrd4j.inspector.RrdInspector
Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: org/rrd4j/core/RrdDb
at org.rrd4j.inspector.MainTreeModel.setFile(MainTreeModel.java:19)
at org.rrd4j.inspector.InspectorModel.setFile(InspectorModel.java:37)
at org.rrd4j.inspector.RrdInspector.loadFile(RrdInspector.java:394)
at org.rrd4j.inspector.RrdInspector.selectFile(RrdInspector.java:388)
at org.rrd4j.inspector.RrdInspector.access$100(RrdInspector.java:48)
at org.rrd4j.inspector.RrdInspector$2.actionPerformed(RrdInspector.java:105)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6400)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: org.rrd4j.core.RrdDb
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
… 41 more

I did hit the same wall (although I only got the NoClassDefFounderror). Reading here did help. I ADDED the

 rrd4j-3.4.jar

(without the inspector) to the directory and then the file was opened.

1 Like

Man, it worked ! Many thanks for the insight…