I first mentioned Telegraf in the My Monitoring Journey: Cacti, Graphite, Grafana & Chronograf post and then covered its installation and setup in the Installing & Setting up InfluxDB, Telegraf & Grafana post. Let’s now delve a little deeper, shall we?
The good news is that there’s a lot less to Telegraf’s configuration than what there is to InfluxDB so you’ll likely find this post easier to follow than the Getting to know InfluxDB and article.
What is it?
Before diving into configurations, it would be best to first cover off what Telegraf actually is. To quote the Telegraf GitHub page:
Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
Design goals are to have a minimal memory footprint with a plugin system so that developers in the community can easily add support for collecting metrics from well known services (like Hadoop, Postgres, or Redis) and third party APIs (like Mailchimp, AWS CloudWatch, or Google Analytics).
Telegraf is plugin-driven and has the concept of 4 distinct plugins:
- Input Plugins collect metrics from the system, services, or 3rd party APIs
- Processor Plugins transform, decorate, and/or filter metrics
- Aggregator Plugins create aggregate metrics (e.g. mean, min, max, quantiles, etc.)
- Output Plugins write metrics to various destinations
A list of plugins can be found on the GitHub page linked to above.
Default Configuration File
Telegraf comes with quite a large configuration file, however only the following are enabled by default:
- influxdb (output)
- cpu (input)
- disk (input)
- diskio (input)
- kernel (input)
- mem (input)
- processes (input)
- swap (input)
- system (input)
If you do not want these plugins enabled and/or if you want to greatly reduce the size of your configuration file, you can create a new configuration file that contains only the plugins your interested in using the following command:
telegraf --config telegraf.conf -input-filter cpu:disk:diskio:kernel:mem:processes:swap:system:snmp -output-filter influxdb config > telegraf.conf
That wasn’t too painful now was it? :) See the Telegraf: SNMP Input Plugin post for information on how to use the SNMP plugin.
As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at email@example.com, or drop me a message on Reddit (OzNetNerd).
Note: The opinions expressed in this blog are my own and not those of my employer.