RRD4J - Logging

I don’t think so: there is no need to change anything in openhab.cfg.

I found a logging section in openhab.cfg which could have something to do with your problem:

######################### Logging Persistence Service #################################
#
# the logback encoder pattern to use to write log entries
# see http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout for all options
# the item name is available as the "logger" name, the state as the "msg"
logging:pattern=%date{ISO8601} - %-25logger: %msg%n

But this is also default in openhab_default.cfg, so if you didn’t change anything it should be already in your openhab.cfg.
And it should only have to do something with logging, not with persisting your items values.

the wiki says that i have to change 3 lines in the openhab.cfg

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

i guess:
the .def part defines how the graph is shown.
the . items part needs to have my “BMP_temp” in it.

i dont understand what i need to do with the .archives part.

No, you MAY configure that, you don’t HAVE TO:

As of Openhab 1.7 it is **possible** to configure the later described values.

I did not change anything in openhab.cfg and my rrd4j persistence is working fine.

ok well then i’ve got no idea why it’s not working…

Take a look in your events.log and see if you are actually getting values for your item:

2016-03-02 19:03:22 - BMP_temp state updated to xx.x

If not, start oh in debug mode and you may see whats wrong.

my events.log /var/log/openhab/events.logends with 2016-03-03.
how can that be ?

It seems somehow oh stopped working …

oh is working just fine… i get all my data shown.

but rrd4j is not working although its like 3 steps to make it work…

I guess if you have nothing in your events.log there is something basically going wrong. You need to find that out before you start looking for your rrd4j problem. Start in debug mode and see if you can find the problem.

< gesendet von Samsung Smartphone >

i still got this problem.
could give you guys log files now.

Yes, post it!

here you go.

openhab_log.xml (54.2 KB)

that filde had 80 MB befor i cut it. maybe i deleted importend stuff…

Okay, there is something going wrong … not only with rrd4j persistence.

Did you use a tutorial to install openhab? If yes, which one?

Or let’s say it the other way around:

hey !

i used the official tutorial for linux on the wiki.
since i had massive problems getting mqtt to work i was very happy that it worked with this.

i will reinstall… but then i mqtt wont work again.

Sure it will work :grinning:
Are you using mosquitto on your pi as broker?
If yes I will write a short tutorial to set it up, but not today, it’s late …

yes i used mosquitto.
thanks for your help so fare

This discussion was continued over private message, for future reference: the system (Raspbian Jessie) was set up from scratch using the following tutorial and now works fine with mosquitto and mqtt:

Login via ssh

pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get upgrade

install mosquitto:

pi@raspberrypi:~ $ wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
pi@raspberrypi:~ $ sudo apt-key add mosquitto-repo.gpg.key
pi@raspberrypi:~ $ cd /etc/apt/sources.list.d/
pi@raspberrypi:~ $ sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install mosquitto mosquitto-clients python-mosquitto

test mosquitto:

open two putty windows, in the first one:
pi@raspberrypi:~ $ mosquitto_sub -h 127.0.0.1 -t myTopic/#

in the second one:
pi@raspberrypi:~ $ mosquitto_pub -h 127.0.0.1 -t myTopic/Temp -m "test1"

Now you should see “test1” in the first window.

Install openhab:

pi@raspberrypi:~ $ wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
pi@raspberrypi:~ $ echo "deb http://dl.bintray.com/openhab/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/openhab.list
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install openhab-runtime
pi@raspberrypi:~ $ sudo systemctl daemon-reload
pi@raspberrypi:~ $ sudo systemctl enable openhab
pi@raspberrypi:~ $ sudo reboot

install mqtt and rrd4j binding:

pi@raspberrypi:~ $ sudo apt-get install openhab-addon-binding-mqtt
pi@raspberrypi:~ $ sudo apt-get install openhab-addon-persistence-rrd4j

Configuration files:

copy openhab_default.cfg to openhab.cfg:
pi@raspberrypi:~ $ sudo cp /etc/openhab/configurations/openhab_default.cfg /etc/openhab/configurations/openhab.cfg

edit openhab.cfg:
pi@raspberrypi:~ $ sudo nano /etc/openhab/configurations/openhab.cfg

replace
#mqtt:<broker>.url=tcp://<host>:1883

with
mqtt:mosquitto.url=tcp://localhost:1883

define items:
pi@raspberrypi:~ $ sudo nano /etc/openhab/configurations/items/mqtt.items

Switch    Test_Switch1    "Testswitch 1" {<see wiki>}
Switch    Test_Switch2    "Testswitch 2" {<see wiki>}

define sitemap:
pi@raspberrypi:~ $ sudo nano /etc/openhab/configurations/sitemaps/default.sitemap

sitemap default label="MQTT"
{
Switch item=Test_Switch1
Switch item=Test_Switch2
}

config for rrd4j persistence:
pi@raspberrypi:~ $ sudo nano /etc/openhab/configurations/persistence/rrd4j.persist

// Persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
everyMinute    : "0 * * * * ?"

// If no strategy is specified for an item entry below, the default list will be used.
default = everyChange 
}

/*
* Each line in this section defines for which item(s) which strategy(ies) should be applied.
* You can list single items, use "*" for all items or "groupitem*" for all members of a group
* item (excl. the group item itself).
*/
Items {
* : strategy = everyMinute, restoreOnStartup
}

reboot system
pi@raspberrypi:~ $ sudo reboot

call in browser:
http://<your_ip_Pi>:8080/ oder
http://raspberrypi:8080/

2 Likes

can confirm this worked.

awesome tutorial.

THX !

1 Like