A better way to run Telegraf on OpenBSD

       170 words, 1 minutes

Following Telegraf official README.md, I could compile and run Telegraf on OpenBSD . Due to my lack of knowledge on Go, this turned to be a quite instable method. Some Telegraf release would compile, some not. Anyway, thanks to Landry@, it is now possible to use Telegraf from OpenBSD ports.

Looks like 6.5-BETA already have Telegraf binary. So this will soon be straightforward. But I’m still running 6.4 on my servers. Guess why… Fortunately, the port compiles and runs ok on top of the 6.4 system and port tree.

On a 6.4 stock machine, download (or cvs sync) the STABLE ports tree. Download and install Landry’s port:

# ftp https://cdn.openbsd.org/pub/OpenBSD/6.4/ports.tar.gz
# tar xzpf ports.tar.gz -C /usr/

# echo "826 _telegraf _telegraf sysutils/telegraf" >> /usr/ports/infrastructure/db/user.list

# ftp -o telegraf-1.9.0.tgz 'https://marc.info/?l=openbsd-ports&m=154417907632646&q=p3'
# tar xzf telegraf-1.9.0.tgz -C /usr/ports/sysutils/
# cd /usr/ports/sysutils/telegraf

Apply patches from here and there . Then compile and install the package.

# make
# make package
# make install

Running the package is now the same as any OpenBSD package.