Skip to content

Instantly share code, notes, and snippets.

@egeexyz
Created August 17, 2019 10:11
Show Gist options
  • Save egeexyz/7e6516ae69cfea1f2404ce42606c39ee to your computer and use it in GitHub Desktop.
Save egeexyz/7e6516ae69cfea1f2404ce42606c39ee to your computer and use it in GitHub Desktop.
#!/bin/bash
cd /tmp
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.11.4_linux_amd64.tar.gz
tar xf telegraf-1.11.4_linux_amd64.tar.gz
cp -r /tmp/telegraf/usr/lib/telegraf/ /usr/lib/
cp -r /tmp/telegraf/var/log/telegraf /var/log/
cp -r /tmp/telegraf/etc/telegraf/ /etc/
cp -r /tmp/telegraf/etc/logrotate.d/ /etc/
cp /tmp/telegraf/usr/bin/telegraf /usr/bin/telegraf
echo '[Unit]
After=network.target
Description=Telegraf as a daemon
[Install]
WantedBy=network.target
[Service]
Type=simple
Environment=INFLUX_TOKEN=
ExecStart=/usr/bin/telegraf --config
' > /etc/systemd/system/telegraf.service
echo "Telegraf installation complete. Remember to complete the configuration in the unit file located at: /etc/systemd/system/telegraf.service"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment