Installing and Configuring Telegraf
The installation instructions at the download page for Telegraf are limited. Much better installation instructions are in the Telegraf documentation, where it provides instructions for adding the InfluxData repository to apt. I just upgraded my ProxMox installation to v6, which moves from Debian Stretch to Debian Buster. As such, I had to manually upgrade each of my LXC containers, so I took the opportunity to document and validate the steps I went through to make sure Telegraf was able to function as envisaged.
I realised that none of my containers had sudo installed in them. I also discovered that fail2ban was running on each of them. I downloaded all the container imaged from turnkey linux, and I didn't alter the configurations much, so I thought it best to update my running containers appropriately.
This is a smartctl entry (along with some hddtemp entries)
This is a fail2ban visualization of me typing the wrong password into my influxdata server.
I realised that none of my containers had sudo installed in them. I also discovered that fail2ban was running on each of them. I downloaded all the container imaged from turnkey linux, and I didn't alter the configurations much, so I thought it best to update my running containers appropriately.
- Follow the instructions in the Telegraf documentation to install Telegraf with apt updates
- Configure sudo (done as root)
- apt-get install sudo
- usermod -a -G sudo telegraf
- Create a file called /etc/sudoers.d/telegraf, with the following:
## Allow telegraf to run root-only monitoring utilities through sudo
## without a password.
##
## CAUTION: Any syntax error introduced here will break sudo.
##
## Cmnd alias specification
Cmnd_Alias PLUGINS = \
/usr/sbin/smartctl *,\
/usr/bin/fail2ban-client status, /usr/bin/fail2ban-client status *
telegraf ALL = (ALL:ALL) NOPASSWD: PLUGINS
Telegraf is now configured to be able to collect stats from
fail2ban and smartctl if appropriate. If you want to collect stats from other applications that require root access, add the command lines to that file.This is a smartctl entry (along with some hddtemp entries)
This is a fail2ban visualization of me typing the wrong password into my influxdata server.
Comments
Post a Comment