How to install telegraf on your Raspberry Pi 3 running Fedora

Posted on Mon 03 June 2019 in how-to

At the end of last year I've changed my observability approach from "grab all the data!" to "minimize the complexity and functionality". So when it came to refactoring my Infrastructure-As-Code reporitory with various obsrvability integrations I simply removed the ability to install telegraf on my Raspberry Pis. But some network issues require specific data points from within my apartment for further debugging.

How to find the download?

Fedora can be downloaded and installed on the Raspberry Pi 3 with little to not hurdles. When it comes to telegraf the installation and (especially) update process is not that smooth. Usually the official InfluxData repository can be used, but it doesn't provide pre-built packages for aarch64 architecture, which is being used by the Raspberry Pi 3.

Well, the Github release page is showing an "arm64" build, but this won't install due to an issue with the architecture of the rpm file:

# dnf install
telegraf-1.10.4-1.arm64.rpm                                    1.8 MB/s |  16 MB     00:08    
 Problem: conflicting requests
  - package telegraf-1.10.4-1.arm64 does not have a compatible architecture
(try to add '--skip-broken' to skip uninstallable packages)

This may only be an issue of the way dnf verifies the architecture, as the tar.gz builds show that the binary has been built for aarch64:

# file /usr/bin/telegraf 
/usr/bin/telegraf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=Po6b6WFsVMlgslwZWGiZ/WFyT1BWrJGT49NLGeUSq/sXAGORufzW7A2Pv-WCC8/gwHd7r9DGQUGXbAW1Lew, stripped

To me it seems like the tar.gz build is a good choice for this specific use case.

Download made easy

As I do own more than one Pi and the install process should be done automagically I've written a small script which can be found onm Github. It's utilising the Github API to get the description from the latest telegraf release on Github, extracts the download link and copies all the files to the system.

It might be broken, you need to install fish and jq beforehand and you should probably never use it.

What could possibly go wrong?

The download scripts will overwrite your telegraf configs within /etc/telegraf. Make sure you've a backup and config management in place to bring them back. Beside updates are not yet implemented. Comparing telegraf -version with the version from Github is an easy task, but I'm not sure how to implement such an update check into my config management. A simple systemd timer doesn't seem to do the job, but a check while deploying the latest code changes feels "wrong" too.

Enabling the service

To enable the telegraf systemd service manually the following commands are necessary:

# systemctl link /usr/lib/telegraf/scripts/telegraf.service 
# systemctl daemon-reload
# systemctl enable telegraf.service