This puppet module installs and manages the configuration of InfluxData's Telegraf. A metrics collection agent.
Use this puppet module with Telegraf version 0.13.1 and newer.
This puppet module was designed and tested with Puppet 3.8.
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with telegraf
- Development - Guide for contributing to the module
- Testing - Guide to test the module
- License
The module installs the telegraf package from the provided repositories and installs the basic configuration file and reconfigures this setup based on your whishes.
Supported Linux distributions are Debian based (Ubuntu, Debian) and RedHat based (CentOS, RHEL).
Tests have also be run on an raspberry pi 2 with raspbian (jessie).
puppet-telegraf requires these third party puppet modules
- puppet-stdlibs
- wget module when the parameter
download_package
is set to true. - apt module when the
parameter
manage_repo
is set to true on Debian or Ubuntu.
Include the class and set the necessary Telegraf and InfluxDB parameters.
class { '::telegraf':
version => '0.13.1',
manage_repo => true,
config_template => 'telegraf/telegraf.conf.erb',
# [[outputs.influxdb]] section of telegraf.conf
outputs_influxdb_enabled => true,
outputs_influxdb_urls => ['http://influxdb-01.mydomain.com:8086', 'http://influxdb-02.mydomain.com:8086'],
outputs_influxdb_database => 'telegraf',
outputs_influxdb_username => 'telegraf',
outputs_influxdb_password => 'metricsmetricsmetricsmetrics',
}
This puppet-telegraf module supports the following configuration options:
class { '::telegraf':
ensure => 'installed',
version => '0.13.1',
download_package => false,
manage_repo => false,
config_template => 'telegraf/telegraf.conf.erb',
config_base_file => '/etc/telegraf/telegraf.conf',
config_directory => '/etc/telegraf/telegraf.d',
# [[outputs.influxdb]] section of telegraf.conf
outputs_influxdb_enabled => true,
outputs_influxdb_urls => ['http://localhost:8086'],
outputs_influxdb_database => 'telegraf',
outputs_influxdb_username => 'telegraf',
outputs_influxdb_password => 'metricsmetricsmetricsmetrics',
# [tags] section of telegraf.conf
tags => {
virtual => $::virtual,
lsbdistdescription => $::lsbdistdescription,
environment => $::my_own_facter_environment,
location => $::my_own_facter_location,
}
# [agent]
agent_hostname => $::hostname,
agent_interval => '10s',
# [[plugins.cpu]]
cpu_percpu => true,
cpu_totalcpu => true,
cpu_drop => ["cpu_time"],
# [[plugins.disk]]
disk_mountpoints => ["/","/home"],
}
The following plugins have been prepared for input / output configuration of Telegraf.
- OpenTSDB
class { '::telegraf::plugins::outputs::opentsdb':
opentsdb_server => 'my.opentsdb.server.domain.com',
opentsdb_port => 4242,
opentsdb_prefix => 'my.metrics.telegraf.',
}
- MySQL
include '::telegraf::plugins::inputs::mysql'
- PostgreSQL
include '::telegraf::plugins::inputs::postgresql'
- PuppetAgent
include '::telegraf::plugins::inputs::puppetagent'
- Elasticsearch
class { '::telegraf::plugins::inputs::elasticsearch': }
- Procstats
class { '::telegraf::plugins::inputs::procstats': }
- PowerDNS
class { '::telegraf::plugins::inputs::powerdns': }
- Fork it (https://github.com/rplessl/puppet-telegraf/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Wish: Make sure your Pull Requests passes the Rspec tests.
Testing is done with rspec.
Install and setup vagrant [https://docs.vagrantup.com/v2/installation/index.html](as described here).
Fetch virtual machines:
vagrant box add puppetlabs/ubuntu-16.04-64-puppet --insecure
vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure
vagrant box add puppetlabs/debian-7.8-64-puppet --insecure
vagrant box add puppetlabs/debian-8.2-64-puppet --insecure
vagrant box add puppetlabs/centos-7.2-64-puppet --insecure
vagrant box add puppetlabs/centos-6.6-64-puppet --insecure
Add vagrant puppet support and run tests:
bundle install
bundle exec librarian-puppet install
vagrant up
Licensed under the MIT License.
Copyright (c) 2015-2016 Roman Plessl (@rplessl), Nine Internet Solutions AG and
Copyright (c) 2015-2016 Roman Plessl (@rplessl), Plessl + Burkhardt GmbH
See LICENSE File