Telegraf

Telegraf is an easy to use monitoring client compatible with many operating systems that has a Graphite output plugin, and many useful input plugins for collecting a wide variety of system metrics.

Contents

Linux Systems

  1. Download Telegraf and unzip it (see the telegraf docs for up-to-date versions and installation commands for many operating systems). Packages and files are generally installed at /etc/telegraf/.

Ubuntu/Debian

wget https://dl.influxdata.com/telegraf/releases/telegraf_1.21.2-1_amd64.deb
sudo dpkg -i telegraf_1.21.2-1_amd64.deb

RedHat/CentOS

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.21.4-1.x86_64.rpm
sudo yum localinstall telegraf-1.21.4-1.x86_64.rpm
  1. Locate the configuration file at /etc/telegraf/telegraf.conf and open it in your preferred text editor, or a VIM shell. Make the following changes to the telegraf.conf file:

    • comment out the line:

      [[outputs.influxdb]]

    • uncomment the line:

      [[outputs.graphite]]

    • uncomment and edit the servers line to:

      servers = ["carbon.hostedgraphite.com:2003"]

    • uncomment and edit the prefix line to:

      prefix = "YOUR_API_KEY.telegraf"

    • alternatively, you can download a preconfigured telegraf.conf file from the Agents => Telegraf as mentioned above. Download the preconfigured file, move it to /etc/telegraf, and replace the original.

  2. Save changes and start telegraf services: sudo service telegraf start or sudo systemctl start telegraf.

  3. Within minutes, telegraf will start sending metrics into your Hosted Graphite account (with the ‘telegraf’ prefix).

  4. Troubleshoot errors by running telegraf in the root directory of the telegraf.conf file: telegraf --config telegraf.conf. Note: with older versions of telegraf, the influxdb output plugin is enabled by default and this will cause an error message that’s visible in the output when you ‘serve’ telegraf. To clear this error, comment out the [[outputs.influxdb]] line in the telegraf.conf file.

Macos

  1. Install Telegraf: brew install telegraf. Packages are usually installed at /usr/local/etc/

  2. Similar to the Linux steps listed above, locate the configuration file and open it in your preferred text editor. Make the following changes to the telegraf.conf file:

  • comment out the [[outputs.influxdb]] line

  • uncomment the [[outputs.graphite]] line

  • uncomment and edit the ‘servers’ line to:

    servers = ["carbon.hostedgraphite.com:2003"]

  • uncomment and edit the ‘prefix’ line to:

    prefix = "YOUR_API_KEY.telegraf"

  1. Restart telegraf: brew services restart telegraf. Metrics usually take about 3-5 minutes to appear in your Hosted Graphite account and will include the ‘telegraf’ prefix in the name.

  2. Additionally, you can ‘serve’ the telegraf.conf file which can be helpful for troubleshooting any configuration issues: telegraf --config telegraf.conf

Windows (via Powershell)

  1. Download Telegraf using the wget command (an alias for Invoke-Webrequest) and unzip it:

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.5.2_windows_amd64.zip -O telegraf-1.5.2_windows_amd64.zip
Expand-Archive .\telegraf-1.5.2_windows_amd64.zip

Note: The link for the most up-to-date version of the config file can be found on the Telegraf downloads page.

  1. Create a directory in Program Files, move the two telegraf files into it, and change the directory to the same location:

mkdir 'C:\Program Files\Telegraf'
mv .\telegraf-1.5.2_windows_amd64\telegraf\*.* 'C:\Program Files\Telegraf'
cd 'C:\Program Files\Telegraf'
  1. Create a new configuration file that includes the Graphite output-filter.

./telegraf.exe --output-filter graphite config > telegraf.conf
  1. Open the telegraf.conf file using your preferred text editor. Uncomment the section titled [[outputs.graphite]] and uncomment/update the servers and prefix options:

[[outputs.graphite]]
   servers = ["carbon.hostedgraphite.com:2003"]
   prefix = "YOUR_API_KEY.telegraf"
  1. Install telegraf to your services, and start it up:

./telegraf.exe -service install -config 'C:\Program Files\telegraf\telegraf.conf'
net start telegraf

Metrics will now appear in your Hosted Graphite account with the ‘telegraf’ prefix. More options for collecting Windows metrics include using the Windows Performance Counters plugin, which you can read more about in the win_perf_counters docs).

Once telegraf is installed, you can download a custom telegraf config in your Hosted Graphite account if you navigate to Agents => Telegraf. Then install telegraf using the steps below, and replace the default config with the custom config at the path that telegraf is installed at.

Telegraf Input Plugins

We love the Telegraf agent because it offers a wide variety of easy-to-install input plugins that allow you to collect additional metrics from a range of popular services and technologies like:

If you need help or advice on configuring the telegraf agent to include some input plugins, send us a message at support@hostedgraphite.com and we would be happy to walk you through the process.

Last updated