Installing on a Raspberry Pi

Earlier today we got an email from a user attempting to install the TICK stack on a Raspberry Pi. I thought it might be useful for others so I’ll repost my answer here.

What you will need is to use the ARM architecture install instructions:

wget https://dl.influxdata.com/influxdb/releases/influxdb-1.3.4_linux_armhf.tar.gz tar xvfz influxdb-1.3.4_linux_armhf.tar.gz

The other 4 Linux binaries are for x86/x64 architecture and won’t run on a Raspberry Pi (ARM-based) machine.

That being said, that tar file is not actually a full package that you can then use a package manager to install from. I wrote up some instructions at https://davidgs.com/2017/influxdb-on-artik-520-redux/ for doing this on an ARTIK-520 which is also ARM-based, so the same instructions will work for the Raspberry Pi. Here are the important bits from that post:

All the downloads for InfluxDB, Chronograf, Telegraf and Kapacitor contain a directory structure with /usr, /var and /etc directories, so here’s what I did after I untar’ed all the downloads:

[root@localhost ~]# cd influxdb-1.2.4-1 ; cp -rp usr/* /usr ; cp -rp etc/* /etc ; cp -rp var/* /var

That gets everything in the right places for influxDB. Now just to the same thing for the kapacitor, telegraf, and chronograf directories.

Everything may be in the right place, but they won’t automatically start at boot time because raspian is a systemd based OS, so it’s important to get each one of those set up as a systemd service. Luckily, this isn’t hard. You just need to create the files in the /etc/systemd/system directory, and I’m going to make it even easier for you by giving you those files.

[root@localhost system]# cat influxdb.service
[Unit]
Description=InlfuxDB service
[Service]
ExecStart=/usr/bin/influxd
NotifyAccess=main
#WatchdogSec=10
Restart=on-failure
LimitNPROC=1
ProtectHome=true
ProtectSystem=full

I then created one for each of the other services as well:

[root@localhost system]# cat telegraf.service
[Unit]Description=Telegraf service

[Service]
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf
NotifyAccess=main
#WatchdogSec=10
Restart=on-failure
ProtectHome=true
ProtectSystem=full

[root@localhost system]# cat chronograf.service
[Unit]
Description=Chronograf service

[Service]
ExecStart=/usr/bin/chronograf -b /var/lib/chronograf/chronograf-v1.db >/dev/null 2>&1
NotifyAccess=main
#WatchdogSec=10
Restart=on-failure
ProtectHome=true
ProtectSystem=full

Finally, I just had to make sure that systemd knew about these new services, and start them:
[root@localhost system]# systemctl enable influxdb.service; systemctl start influxdb.service

[root@localhost system]# systemctl enable telegraf.service ; systemctl start telegraf.service

[root@localhost system]# systemctl enable chronograf.service ; systemctl start chronograf.service
Then a quick check with:
[root@localhost system]# systemctl

...

influxdb.service loaded active running InlfuxDB service

...

telegraf.service loaded active running Telegraf service

...

chronograf.service loaded active running Chronograf service

And I can see that they are all up and running, and that systemd will make sure that they stay that way, even across reboots.

That should get everything up and running, and recovering after a reboot.

Hey @davidgs,

Did the debian package not work?

https://dl.influxdata.com/telegraf/releases/telegraf_1.3.5-1_armhf.deb
https://dl.influxdata.com/chronograf/releases/chronograf_1.3.7.0_armhf.deb

Hi @davidgs,

I’m trying to install Telegraf (and then the full TICK stack) on a Raspberry Pi via resin.io

For @chris : the debian packages probably works if you are doing a manual install on raspbian, but if you are using resin .io, you can’t interact with systemd during Docker image build, you have to do it in a start .sh script in the CMD part of the Dockerfile.

About systemd, I’m really stuck at making it start my telegraf process, even if it says all is ok (I’m using the provided telegraf.service as is), I could use some help.

In my Dockerfile, I have :

# Install telegraf
 && wget -O /tmp/telegraf.deb https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}_armhf.deb \
 && dpkg -i /tmp/telegraf.deb \
 && rm /tmp/telegraf.deb \
 && cp /usr/lib/telegraf/scripts/telegraf.service /usr/lib/systemd/system/telegraf.service

When I try a manual start (as root), all is perfect :

root@d367deb:/# telegraf -config /etc/telegraf/telegraf.conf
2017-09-05T16:53:12Z I! Starting Telegraf (version 1.3.5)
2017-09-05T16:53:12Z I! Loaded outputs: file
2017-09-05T16:53:12Z I! Loaded inputs: inputs.cpu inputs.disk inputs.mem inputs.swap
2017-09-05T16:53:12Z I! Tags enabled: host=d367deb
2017-09-05T16:53:12Z I! Agent Config: Interval:10s, Quiet:false, Hostname:"d367deb", Flush Interval:10s

and then it writes my data to stdout and to /tmp/metrics.out every 10 seconds, as configured.

BUT when I do :
systecmctl enable telegraf
systecmctl daemon-reload
systecmctl start telegraf
systecmctl status telegraf

It says :

root@d367deb:/# systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2017-09-05 17:52:33 CEST; 1h 3min ago
     Docs: https://github.com/influxdata/telegraf
   CGroup: /docker/6710270aa1d60c01a30b13143c3ff727785260ea52f51632fbf0c2811f696f41/system.slice/telegraf.service

Sep 05 17:52:32 d367deb systemd[1]: Starting LSB: Start telegraf at boot time...
Sep 05 17:52:32 d367deb telegraf[49]: Starting the process telegraf [ OK ]
Sep 05 17:52:33 d367deb telegraf[49]: telegraf process was started [ OK ]
Sep 05 17:52:33 d367deb systemd[1]: Started LSB: Start telegraf at boot time.

But despite all the “OK”, nothing is running and nothing is written in /tmp/metrics.out.

Where could I find logs about this issue ? systemd logs are empty and /var/log/telegraf logs are empty as well.

Should I configure something in the provided telegraf.service ?

I guess it’s some permission issue when running as user “telegraf”, but I’d really like to see some errors logged about this.

UPDATE :
Also I’d like to say permissions don’t seem to be an issue, so maybe it’s a pure systemd config problem :
sudo -u telegraf bash -c 'telegraf -config /etc/telegraf/telegraf.conf'
works perfectly.

What does your chronograf.service file look like?

You probably mean “your telegraf.service” right ? it’s not mine, it’s yours, the one you provide in the deb package.

@Tristan Can you check for these options in your config file?

[agent]
  debug = false
  quiet = false
  logfile = ""

If those are set correctly try running this and let me know what you get:

sudo journalctl -u telegraf

Thanks for your quick answers. After a few tries, I figured it out what was going on : when using the .deb install, some scripts where installed in /etc/init.d since systemd was not detected at build time, and then these scripts were kind of merged with my telegraf.service by systemd, it was using both.

Here is the final setup to avoid problems :

In Dockerfile :

# Install telegraf
 && wget -O /tmp/telegraf.deb https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}_armhf.deb \
 && dpkg -i /tmp/telegraf.deb \
 && rm /tmp/telegraf.deb \
 # We use systemd, not init.d services
 && rm -Rf /etc/init.d/telegraf \ 
 && cp /usr/lib/telegraf/scripts/telegraf.service /usr/lib/systemd/system/telegraf.service \

in startup script (CMD in Dockerfile) :

#!/bin/sh

# Maybe needed to take into account the new telegraf.service
systemctl daemon-reload

# Enable telegraf service boot loading
systemctl enable telegraf

# Start telegraf service
systemctl start telegraf

# To prevent Docker from exiting
journalctl -f

I think I see what is going on, the post-install.sh script does not detect the operating system and so it doesn’t setup the service file correctly. I opened a new issue on the Telegraf issue tracker for this

@daniel, maybe there is an issue in post-install.sh, but that was not my problem here : I’m building a docker image and systemd is not present at build time, there is no way you can detect it.

Oh, right. You might want to try using the tar.gz packages instead, though I guess it doesn’t matter much. I think I’ll still keep the issue open because I believe the, now theoretical, issue still exists.

Hi All,
My target system is a rpi3 and os is latest raspbian stretch from noobs install. I followed @davidgs instructions and got a number of errors on all 4 products when trying to start the services. I then got the *_armhf.deb packages for the TICK stack, thinking I’d done something wrong however the same errors occurred but on two only (telegraf and influxdb):

    pi@pi-05:~ $ sudo dpkg -i influxdb_1.3.6_armhf.deb 
Selecting previously unselected package influxdb.
(Reading database ... 122746 files and directories currently installed.)
Preparing to unpack influxdb_1.3.6_armhf.deb ...
Unpacking influxdb (1.3.6-1) ...
Setting up influxdb (1.3.6-1) ...
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
pi@pi-05:~ $ sudo dpkg -i telegraf
telegraf/                   telegraf_1.4.3-1_armhf.deb
pi@pi-05:~ $ sudo dpkg -i telegraf_1.4.3-1_armhf.deb 
Selecting previously unselected package telegraf.
(Reading database ... 122762 files and directories currently installed.)
Preparing to unpack telegraf_1.4.3-1_armhf.deb ...
Unpacking telegraf (1.4.3-1) ...
Setting up telegraf (1.4.3-1) ...
Failed to enable unit: File telegraf.service: Bad message
Failed to restart telegraf.service: Unit telegraf.service is not loaded properly: Bad message.
See system logs and 'systemctl status telegraf.service' for details.
WARNING: systemd not running.
pi@pi-05:~ $ sudo dpkg -i chronograf
chronograf-1.3.9.0-1/         chronograf_1.3.9.0_armhf.deb
pi@pi-05:~ $ sudo dpkg -i chronograf_1.3.9.0_armhf.deb 
Selecting previously unselected package chronograf.
(Reading database ... 122774 files and directories currently installed.)
Preparing to unpack chronograf_1.3.9.0_armhf.deb ...
Unpacking chronograf (1.3.9.0-1) ...
Setting up chronograf (1.3.9.0-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/chronograf.service → /lib/systemd/system/chronograf.service.
pi@pi-05:~ $ sudo dpkg -i kapacitor_1.3.1_armhf.deb 
Selecting previously unselected package kapacitor.
(Reading database ... 122836 files and directories currently installed.)
Preparing to unpack kapacitor_1.3.1_armhf.deb ...
Unpacking kapacitor (1.3.1-1) ...
Setting up kapacitor (1.3.1-1) ...
Created symlink /etc/systemd/system/kapacitor.service → /lib/systemd/system/kapacitor.service.
Created symlink /etc/systemd/system/multi-user.target.wants/kapacitor.service → /lib/systemd/system/kapacitor.service.
pi@pi-05:~ $ 

The fix was to manually create the symlinks for influxdb.service and the telegraf.service from the /etc/systemd/system/multi-user.target.wants/ directory

When the influxdb.service service was enabled it automatically created another symlink in the …/system dir called influxd.service. The system required a reboot and all services are running. I have yet to test. However my data stream is stepped. I am currently using Oracle and Postgresql and I want to track the time in a particular state. The simplest case is two states and two transitions. I’m looking forward to testing but I am digressing!

Thanks for a very informative community thread,
Regards,
Steve

@Dowster Thanks for the report, if you have time to debug this with me it would be much appreciated. I’m curious does the error appears again when you run (warning: I believe this deletes your telegraf config file):

sudo dpkg -P telegraf
sudo dpkg -i telegraf_1.4.3-1_armhf.deb

If the error still occurs can you run:

systemctl status telegraf.service

@daniel Thanks for responding. It appears the failure to create the symlinks only occurs if the .service file exist (which they did when I followed @davidgs instructions above and did not rm them prior to installing the packages). Here is a copy from a ‘clean’ rpi3 install of TICK from the *.deb packages:
pi@pi-04:~ $ ls
chronograf_1.3.9.0_armhf.deb kapacitor_1.3.1_armhf.deb
hardcopy.1 telegraf_1.4.3-1_armhf.deb
influxdb_1.3.6_armhf.deb
pi@pi-04:~ $ sudo dpkg -i influxdb_1.3.6_armhf.deb
Selecting previously unselected package influxdb.
(Reading database … 38580 files and directories currently installed.)
Preparing to unpack influxdb_1.3.6_armhf.deb …
Unpacking influxdb (1.3.6-1) …
Setting up influxdb (1.3.6-1) …
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.
pi@pi-04:~ $ sudo dpkg -i telegraf_1.4.3-1_armhf.deb
Selecting previously unselected package telegraf.
(Reading database … 38596 files and directories currently installed.)
Preparing to unpack telegraf_1.4.3-1_armhf.deb …
Unpacking telegraf (1.4.3-1) …
Setting up telegraf (1.4.3-1) …
Created symlink /etc/systemd/system/multi-user.target.wants/telegraf.service → /lib/systemd/system/telegraf.service.
pi@pi-04:~ $ sudo dpkg -i chronograf_1.3.9.0_armhf.deb
Selecting previously unselected package chronograf.
(Reading database … 38608 files and directories currently installed.)
Preparing to unpack chronograf_1.3.9.0_armhf.deb …
Unpacking chronograf (1.3.9.0-1) …
Setting up chronograf (1.3.9.0-1) …
Created symlink /etc/systemd/system/multi-user.target.wants/chronograf.service → /lib/systemd/system/chronograf.service.
pi@pi-04:~ $ sudo dpkg -i kapacitor_1.3.1_armhf.deb
Selecting previously unselected package kapacitor.
(Reading database … 38670 files and directories currently installed.)
Preparing to unpack kapacitor_1.3.1_armhf.deb …
Unpacking kapacitor (1.3.1-1) …
Setting up kapacitor (1.3.1-1) …
Created symlink /etc/systemd/system/kapacitor.service → /lib/systemd/system/kapacitor.service.
Created symlink /etc/systemd/system/multi-user.target.wants/kapacitor.service → /lib/systemd/system/kapacitor.service.
pi@pi-04:~ $
Note this install (on pi-04 with no pre-existing .service files) went flawlessly. I haven’t compared the file contents and I didn’t try it out but I think the trick would be for the manual install from the *.tar.gz files would be to make sure that the service files were in the multi-user.target.wants dir (at least on a rpi3 with stretch).

1 Like

I followed the instuctions in this blog. However I got the same error when enabling the service files. But it was easily solved by adding the following lines.

[Install]
WantedBy=multi-user.target

Hey All,

The instructions for installing on a Raspberry Pi in this post are out of date.

I’m working on a new post with updated instructions that should be ready on Monday, so keep an eye out!

3 Likes