[SOLVED] RRD4J no charts

Not directly the answer to your question: this is not persisting every 10 minutes, but every minute at 10 seconds after the minute. :sunglasses:

Have you tried it with a different period?

1 Like

@noppes123 I didn’t notice that,:upside_down_face: good eye.:wink:

@Selter Maybe try with a simple setup at first, then modify after you have it working.
Example:

Strategies {
	// for rrd chart cron strategy every minute
	everyMinute : "0 * * * * ?"
	// get data reduced for older values to keep database small
	everyHour : "0 0 * * * ?"
	everyDay : "0 0 0 * * ?"

	default = everyChange
}

Ok, I’ll try a simple setup without groups.

rrd4j.persist

Strategies {
	// for rrd chart cron strategy every minute
	everyMinute : "0 * * * * ?"
	// get data reduced for older values to keep database small
	everyHour : "0 0 * * * ?"
	everyDay : "0 0 0 * * ?"

	default = everyChange
}

Items {
    // gR* : strategy = everyUpdate, everyMinute
    SonoffS201_switch : strategy = everyUpdate, everyMinute
    EG_bad_x_tp1_switch : strategy = everyUpdate, everyMinute
    EG_bad_x_tp1_energyusage : strategy = everyUpdate, everyMinute

}

Items

Switch   EG_bad_x_tp1_switch         "Trockner - Switch"         <selfsocket>    (gM,gR,Gtplink,Gzstecker,Geg,Gbadeg)          {channel="tplinksmarthome:hs110:xcxcxc:switch"}
Number   EG_bad_x_tp1_energyusage    "Trockner - Energy Usage"   <selfsocket>    (gM,gR,Gtplink,Gzstecker,Geg,Gbadeg)          {channel="tplinksmarthome:hs110:xcxcxc:energyUsage"}

Sitemap

  Frame label="rrd4j" {
        Text item=Gcharts {
            Chart item=SonoffS201_switch refresh=600 period=h service="rrd4j" legend=true
            Chart item=EG_bad_x_tp1_switch refresh=600 period=h service="rrd4j" legend=true
            Chart item=EG_bad_x_tp1_energyusage refresh=600 period=h service="rrd4j" legend=true
            }
    }

Some thoughts:

  • I’m wondering what the purpose of Text item Gcharts in sitemap is…
  • The items are linked to mapDB (group: gM) and rrd4j - maybe this could cause problems?

I thought the unit is milliseconds?

It shouldn’t b/c mapdb is used for restore on startup.

Currently, I do not have a chart setup and I can’t seem to locate the old file that has it. What I did find is a recent topic was an example setup kinda similar to yours. Maybe this will help?

@Selter
In your initial post you are trying to persist and chart a string item with rrd4j, although rrd4j does persist numeric data only.
A check with REST API for that item could verify if it is that problem.

In the last example you are trying the same with two switches and a number item, my guess is that only the last will be persisted and show on a chart.

This is about switching the chart period - I don’t think it is related to my issue.

I’m quite sure that I did it with switches in some of my older setups. The goal was to monitor the behavior of a presence simulation which switches lights at random …
I’ll look for the backup on one of the old SD cards.

Unfortunately not - no charts at all.
Only error messages 3 times:
[WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

Could it be that the database is somehow defective? Is it possible to reset/delete it?

The persistence viewer delivers the following output:
http://openhabianpi:8080/static/PersistenceViewer/?rrd4j

There is no EG_bad_x_tp1_energyusage at all …

That looks as if there isn’t anything persisted, at least for this item.
A check in the folder /var/ lib/openhab2/ persistence/rrd4j would show all .rrd files. If there is none with the item name and ending .rrd, then there hasn’t been anything for that item persisted.

Could be a good moment to shutdown OH, delete the rrd4j (make a copy if you like), cache and temp directories and start OH again…?

As noted by @opus, RRD4J can only store numbers, but strings are converted by RRD4J using a BigDecimal(String) function.

What is known to cause problems, is if at any point in the past the Item to presist was of a different type.

1 Like

Ok - seems we’re getting closer …
There are some more .rrd files:


According to “last modified” there must be access to these items.

Just to make sure: Do you mean deleting all .rdd files in /var/lib/openhab2/persistence/rrd4j/ ?

For cache it’s sudo openhab-cli clean-cache, right?
But how/where to delete the temp directory?

I don’t use openhabian, but I think both the cache and the temp directory are in /var/lib/openhab2/. So:

ls /var/lib/openhab2                 <=== to verify the directory
rm -rf /var/lib/openhab2/temp

should work.

Yes, but first make a copy of it so you can restore other data later if this issue is solved:

In this case I would check the contents with the REST API ( although I think the result would be no different then from the PersistenceViewer).
Having the files, but it seems to be not working, I would assume the file or better the database to be corrupt. I would do as @noppes123 suggested, stop openhab, remove the .rrd files and start over again.

Thanks a lot!

This is the content of tmp:
image

I’m in a hurry now - but will try to delete the files as suggested in a few days. I’ll let you know whether it’s working then.

Looked into the PersistenceViewer again, did you show the items in the gR group?
This viewer will show them sorted into the groups ( groups are shown in green, click on them to show the items).

I’m back … and have cleaned the cache / temp and deleted all files in /rrd4j

Unfortunately the charts still don’t work :frowning:
I’m getting the same error as before:

 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

Now there are only 3 files in /var/lib/openhab2/persistence/rrd4j/ folder

image

This fits to the rrd4j.persist file:

Strategies {
	// for rrd chart cron strategy every minute
	everyMinute : "0 * * * * ?"

	default = everyChange
}

Items {
    // gR* : strategy = everyUpdate, everyMinute
    SonoffS201_switch : strategy = everyUpdate, everyMinute
    EG_bad_x_tp1_switch : strategy = everyUpdate, everyMinute
    EG_bad_x_tp1_energyusage : strategy = everyUpdate, everyMinute

}

The persistence viewer for http://openhabianpi:8080/static/PersistenceViewer/?rrd4j shows exactly the same items as for http://openhabianpi:8080/static/PersistenceViewer/?mapdb (in a new private browser instance)

The different size of your .rrd files is odd. Did you customized the setup of rrd4j? If yes, please show the contents of the file.
Have you checked with the PersistenceViewer if there are chartable values in the rrd file?

Should all files have the same size?
I didn’t customize the rrd4j setup. The only thing I did is to do the openHAB setup via textfiles - the persistence services in addons.cfg:

# A comma-separated list of persistence services to install (e.g. "persistence = rrd4j,jpa")
persistence = mapdb,rrd4j

I just did a new install of RRD4J persistence from paper UI - but with the same outcome.

It’s crazy that the persistence viewer shows so many items (maybe an issue of the viewer …) - in contrast to the rrd4j folder:

When I click on a random item in the persistence viewer - it creates a new file in the rrd4j folder.
Each file has either 27 or 113 KB size.

According to the PersitenceViewer there are no (usable) values in the files.

Although there were values before I did the new install:

Each .rrd file using the same archive setup has the same size, which will never change. In your case the different size has to be caused by the different types stored. Please verify that the larger size is always coresponding to a non numerical item.
The actually used size for a numerical value stored is really low, I do not use the standard setup, so I can’t say what the size should be. If you had seen values for an item, did you try to chart exactly this item? In your initial post you tried that with an *rssi item, which has the larger .rrd file. Note that it may take some time for values to show up after you have deleted the files, also note that the values stored for each minute will show only if you request a timeframe less then the last eight houres! (the screenshot in the last post shows a request covering the LAST MONTH, therefore showing a value for each 12 houre timestep!).
The fact that the PersistenceViewer creates files is odd and should be looked on.Reporting this one. In my customized setup of rrd4j such files are not created (I think). My rrd4j.cfg states the items to be stored, so the Default of all items isn’t used.
[Edit:] I had to take the last part back, I also see “self-created” .rrd files.

Thanks for the explanation.

This seems to be ok.

I’m (almost) quite sure.

Which screenshot do you mean?

Thanks for creating an issue ticket.

Is there another option to have charts in the sitemap (e.g. influxdb)?

The very last one showing the PersistenceViewer with the item “EG_bad_x_tp1_energyusage” selected.

Charts can be created by nearly all persistence services ( not by mapdb).
I would not change the service and I still think that you would get a chart from a correctly persited numeric value. The reported issue should be of no concern, stick to the numeric items you are persisting and try to chart them (like a Chart for the item “EG_bad_x_tp1_energyusage”).
If I remember correctly there were some posts about the former ability of rrd4j to convert on/off or true/false items to numeric ones, but this is said to be gone.