InfluxDB+Grafana persistence and graphing

I’m trying to get this setup on my OH 1.8 installation. I believe I’ve completed the install and configuration of InfluxDB as I can see the graph the Sine Wave script creates.

Any points of where I should look? Where’s the gotcha’s I need to look out for? As I’m at work at the moment I cant provide my config files, but can do so later on.

Thanks,

Garry

You need to provide a lot more detail about what you have done and what exactly isn’t working. You say you see the graph so presumably you have Grafana working. Are your charts not appearing on your sitemap? Are your Items you expect to see charted not showing up?

Trying to install InfluxDB on a Raspberry2. According to InfluxDB Docs Page it should be done by:

sudo apt-get install influxd

However runnig that command I only get

sudo apt-get install influxdb
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package influxdb

Am I missing something?

Installation on the Raspberry Pi is not as easy as on a normal x86 system as it’s based on an ARM architecture. However, here are the steps you have to follow: https://github.com/ThomDietrich/openhabian/blob/master/openhabian-setup.sh#L542-L563 (just ignore cond_redirect)

wget -O /tmp/download.tar.gz https://dl.influxdata.com/influxdb/releases/influxdb-1.0.0_linux_armhf.tar.gz
tar xvzf /tmp/download.tar.gz -C / --strip 2
cp /usr/lib/influxdb/scripts/influxdb.service /lib/systemd/system/influxdb.service
adduser --system --no-create-home --group --disabled-login influxdb
chown -R influxdb:influxdb /var/lib/influxdb
systemctl daemon-reload
systemctl enable influxdb.service
systemctl start influxdb.service
1 Like

Worked like a charm (adding sudo;-) )
Thanks!

1 Like

I just spent two hours on installing influxdb via apt-get on a Raspbery Pi 3 and got it working finally:

First thing you have to do is
sudo apt-get install apt-transport-https
because the repository is fetched via https and not http
More info: "method driver /usr/lib/apt/methods/https could not be found" update error - Ask Ubuntu

Then do an sudo apt-get update

For Raspbian Jessie:

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

More info: https://docs.influxdata.com/influxdb/v1/introduction/get-started/ (look for debian instructions)

sudo apt-get update && sudo apt-get install influxdb

Everything else (setup, config, getting started) works like the instructions in the first post (thanks @ThomDietrich)

Have fun.

3 Likes

I think those two posts should be referenced for other that are trying to install influxDB on a raspberry.
Due to the never ending effort of @rlkoshak to suggest this change, there will be coming more!

The influxDB is running now. however the Retention Policy doesn’t do, what it is expected to do.
I’ve create a Retention Policy for 1h, after I hsad stored values for an hour, no more values where persisted. So it kept the old values instead of persisting new ones and dropping older ones. Checked that using the REST API and direct on the DB with the CLI.

My other problem is installing Grafana.on my Raspberry
I tried to follow the path as decribed by @ThomDietrich for InfluxDB, i.e. using his openhabian code-lines. However that didn’t work for this line:

sudo apt -y install grafana || FAILED=2

I got the some error as with InfluxDB reported above

E: Unable to locate package grafana

Alternative: GitHub - fg2it/grafana-on-raspberry: Grafana packages for raspberry pi (armv6/armv7) and aarch64/arm64

Data from OpenHAB isn’t populating the InfluxDB. Here’s a the config details;

# The name of the default persistence service to use
persistence:default=influxdb

############################ InfluxDB Persistence Service #############################
#
# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
influxdb:url=http://192.168.10.6:8086

# The name of the database user, e.g. openhab.
# Defaults to: openhab
influxdb:user=openhab

# The password of the database user.
influxdb:password=MYPASSWORD

# The name of the database, e.g. openhab.
# Defaults to: openhab
influxdb:db=openhab_db

The data in the database is from the Sine Wave script. So I’m guessing I’ve got a config item wrong.

Here’s my persist details;

Strategies {
everyHour : “0 0 * * * ?”
}

Items {
HRT4_ZW_Temperature* : strategy = everyChange, everyHour
Weather_Temperature, SpeedtestResultDown : strategy = everyChange
}

Ah nice! I had no idea the arm binaries are now also available in the repository (were not before). Thanks for pointing that out! :wink: (@KjetilA: this may be interesting to you too)

As said a couple of times in this thread: Do not waste your time with retention policies. Even with a big openHAB setup the stored data will sum up to a few Megabytes per year…

That’s actually what is used in the openHABian steps. @opus obviously something went wrong while you worked through the steps. Can you check every step again?

The linked openHABian lines are by the way not yet part of the menu as I am still in he process of finishing them.

Your setup looks good. Please check your openhab.log and the log by influxdb for more details.

Wow I actually do pretty much prefer your solution! Very nice with quite a few benefits. I’ll link your answer in the first thread. Thanks :wink:
One request, could you edit the answer and remove the first few lines to only have the explanation of how to set up the Webview? If you prefer/agree I can also copy this part to the first thread.

I’ve read all those, thanks.
However, it did need “some” suggestions especialy by @rlkoshak to make me do the switch. I was using RRD4J intentionally and was glad to have understood the concept of archives. For that reason I’ll give it another shot! (wife away, you got to take the chance!)
Will report if (and only if) I get it working!

Installation on the Raspberry Pi 2 or 3

These are the special steps to install InfluxDB and Grafana on a Raspberry Pi 2 or 3, the older Raspberry Pi 1 is not suited due to it’s ARMv6 architecture.

The following steps expect a Debian/Raspbian Jessie based OS.

Before we can start, you need to install an apt extension for https capable repositories:

sudo apt-get update && sudo apt-get install apt-transport-https

InfluxDB

InfluxDB can be installed through the official repository. Add the key to your system, then add the repository as an apt source, then install influxdb:

wget -O - https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb

After the installation was successful you can enable (start on boot) and start influxdb as every other program:

sudo systemctl daemon-reload
sudo systemctl enable influxdb.service
sudo systemctl start influxdb.service

Continue with the setup instructions in the first posting.

Grafana

Grafana does not officially support the ARM architecture but binaries are provided by @fg2it. Thanks!

echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee /etc/apt/sources.list.d/grafana-fg2it.list 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
sudo apt-get update && sudo apt-get install grafana

Again, enable and start the program through systemctl:

sudo systemctl daemon-reload
sudo systemctl enable grafana-server.service
sudo systemctl start grafana-server.service

Continue with the setup steps in the first posting.

Good luck!

7 Likes

There isn’t anything in the openhab.log other than the usual. InfluxDB doesn’t seem to have created a log.

Sorry for chiming in again, but that are the steps I had done and left me with an unusable operating system: I was not able to do an apt-get anymore.
On a standard Raspbian Jessie I had to install apt-transport-https because the influxdb repos are https fetched and not via http.
I had to manually delete influxdb.list, do the apt-transport-https install and then was able to install the influxdb binaries.
Maybe there is a better solution, but sorry, I am not a Linux expert …

Arg, of course. You mentioned it above and it’s actually also needed for quite a few repositories, including the Grafana one as well. Just missed to mention it in the summary. Thanks for pointing it out. I’ve also changed apt to apt-get as more know apt-get…

I do not understand however, how the absence of this package would cripple your system. The only problem would be that the one repository can not be read while apt update till the package is installed.

I just couldn’t do any apt-<whatever> anymore as long as the influxdb.list was in place …I had to delete it and then was able to proceed.

1 Like

(moved to first posting)

3 Likes