Node-Red/InfluxDB/Grafana on Raspberry Pi 3

Well... at least I'm at the point to where all 3 are now running on the RPi.

1 Like

Now that you have those three running, the following link will help get you going. It's tailored to MySQL as a backend, but @dan.t did some amazing work getting the InfluxDB filter node working so you can use Influx as a backend.

2 Likes

Also, wrong syntax. You should be using the sudo systemctl start influxdb syntax. service will be going away in a future version of Linux (so the powers that be say).

1 Like

Bill,

I've read through that thread twice before ever posting for help here. I was hoping that someone had written a walk-through for themselves and could share it. I prefer to burn up a little less time if possible.

In the latest round of installs, I did use the systemctl syntax. Thanks for mentioning it.

Looking through a lot of web pages online, it appears that my original method should have been the correct repo for influxdb using this code:

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

I may save what I've got at the moment to an image file and try reinstalling influxdb again.

1 Like

I was actually going to do that at some point, but never got around to it. For me, the repo you posted did work. I think it was the service call that was messing you up.

One I get this up and running, I'd be more than willing to post my process as the setup is already documented. I've shutdown the RPi and am about to image what I have so far, restore an image of Buster installed and updated with my WD setup, and then try to reinstall the Node-Red/InfluxDB/Grafana again using the influx repo.

I re-read the Hubitat > NodeRed > MySQL > Grafana (LONG READ) thread and made a few notes on how to try and get it setup once the required components are installed and tested. How hard would that portion be to script out?

Script out meaning? As in a shell script or documentation? Trying to shell script the NR process would be a pain (if possible at all).

Poor choice of words on my part. Script as in providing the instructions necessary to complete the setup and have it feeding data into the database and a simple setup of data being graphed.

A bash script would be nice, but is far from necessary. I tend to write out Linux notes in a format where I can cut and paste them. I use comments with a hash mark so they can't be executed. But there are notes in the documentation that are strictly a manual process.

I had some permission issues with the default data directories, but since I was moving the data locations anyway I resolved them after creating the new folder. For me, the ~/data folder exists on a WD PiDrive (USB attached external HDD). But the same commands will work for any user.

To get influxdb installed:

#Install influxdb

#add the InfluxDB key
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -

#add the InfluxDB repository to the sources list
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

sudo apt-get update
sudo apt-get install influxdb

#OUTPUT of install
#Created symlink /etc/systemd/system/influxd.service → /lib/systemd/system/influxdb.service.
#Created symlink /etc/systemd/system/multi-user.target.wants/influxdb.service → /lib/systemd/system/influxdb.service.

#enable the InfluxDB service file
#The first command we use unmasks the influxdb service file. Unmasking the service ensures that we can enable and start the service as a masked service is unable to be started.
#The second command enables the influxdb service. This command will tell the service manager to keep an eye on the “influxdb.service” file and setup the service based on its contents.
sudo systemctl unmask influxdb
sudo systemctl enable influxdb


cd ~/data
mkdir influxdb
sudo chown -R influxdb:influxdb influxdb
#note - 776 is not adaquate
sudo chmod -R 777 influxdb/
cd ~

#edit the config file to use the data folder
sudo nano /etc/influxdb/influxdb.conf

###Change these values
#[meta]
# dir = "/var/lib/influxdb/meta"
#to 
# dir = "/home/pi/data/influxdb/meta"

#[data]
#dir = "/var/lib/influxdb/data"
#to
#dir = "/home/pi/data/influxdb/data"

#wal-dir = "/var/lib/influxdb/wal"
#to
#wal-dir = "/home/pi/data/influxdb/wal"

#test
influxd

###IN A NEW SEPERATE TERMINAL
influx
#if you get the shell (not quick), close by:
exit
#close terminal

sudo apt-get install lsof
sudo lsof -i tcp:8088
#results should be:
#COMMAND PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
#influxd 762 influxdb    3u  IPv4  15008      0t0  TCP localhost:omniorb (LISTEN)
sudo lsof -i tcp:8086
#results should be:
#COMMAND PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
#influxd 762 influxdb    5u  IPv6  15012      0t0  TCP *:8086 (LISTEN)


###in the terminal where influxd is running
CRTL+C

#start up the InfluxDB server
sudo systemctl start influxdb

#WAIT A FEW MOMENTS
#make sure it's running 
systemctl

#scroll up and down using the arrow keys looking for:
# influxdb.service              loaded active running
# type the letter Q to exit

sudo lsof -i tcp:8088
sudo lsof -i tcp:8086
#you should get the same results as above

#run the command line tool in terminal
influx
#if you get to the shell, it's working
quit

#Proceed to grafana install

I'll eventually go back through the entire Node-Red/InfluxDB/Grafana install and clean up the documentation/instructions to where it's clearer and maybe a little more precise.

That syntax is still correct and always will be. What is wrong syntax is the old /etc/init.d/program action that debian has been pushing to remove.

1 Like

service runs both the old init.d script plus the new systemd scripts.

/etc/init.d
       The directory containing System V init scripts.

/{lib,run,etc}/systemd/system
       The directories containing systemd units.

It's in the man service

1 Like

Huh, I remember reading awhile ago (I think it was when Ubuntu 15.10 launched?) that service was going to eventually be deprecated since systemd released. Since then, I've been forcing myself to use systemctl and such in case they ever follow through with that.

1 Like

Ubuntu might do that but debian won't

1 Like

Ahhh, gotcha. I often forget there are other distros besides Ubuntu (kidding). :wink:

1 Like

LOL -- Ubuntu is geared toward desktop users where-as debian is foremost a server OS. So yes Ubuntu will always do things that are geared toward GUI people.

I'm not dissing Ubuntu at all... it's just that debian is Ubuntu's OS base.

Ok. A dumb newbie question as I've burned up too much time trying to figure this out. Where can I download the flow json by Dan shown in:

The link provided leads to:

https://raw.githubusercontent.com/danTapps/node-red/master/HE2Influx.json

...which only provides the 3rd element in the flow when I import it.

I didn’t bother with learning and installing NodeRed, this is much simpler:

2 Likes

Thank Paul,

I've gone through enough getting all the software installed (correctly) that I really prefer to get it working through NodeRed. Eventually I want to learn even more about how to use NodeRed for other purposes.

@billmeek,

sorry for the delay. I couldn't get close to a computer yesterday.

Take a look here:

Thank you Dan!