{"id":15014029,"url":"https://github.com/voxpupuli/puppet-telegraf","last_synced_at":"2025-12-11T21:24:03.833Z","repository":{"id":4970010,"uuid":"52617957","full_name":"voxpupuli/puppet-telegraf","owner":"voxpupuli","description":"A Puppet module for installing and configuring InfluxData's Telegraf","archived":false,"fork":false,"pushed_at":"2024-09-20T10:02:27.000Z","size":418,"stargazers_count":24,"open_issues_count":16,"forks_count":98,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-10-29T14:22:43.613Z","etag":null,"topics":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","hacktoberfest","influxdata-telegraf","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","sles-puppet-module","telegraf","ubuntu-puppet-module","windows-puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/puppet/telegraf","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2016-02-26T16:38:49.000Z","updated_at":"2024-09-20T10:02:31.000Z","dependencies_parsed_at":"2024-04-15T07:15:19.816Z","dependency_job_id":"313812e7-9a14-4aa0-8b59-1c8af811e4d5","html_url":"https://github.com/voxpupuli/puppet-telegraf","commit_stats":{"total_commits":258,"total_committers":62,"mean_commits":4.161290322580645,"dds":0.7403100775193798,"last_synced_commit":"e164eaec339326a70eaf1d2e837e9e3881e113da"},"previous_names":["datacentred/puppet-telegraf","yankcrime/puppet-telegraf"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-telegraf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-telegraf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-telegraf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-telegraf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-telegraf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953600,"owners_count":21024040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","hacktoberfest","influxdata-telegraf","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","sles-puppet-module","telegraf","ubuntu-puppet-module","windows-puppet-module"],"created_at":"2024-09-24T19:45:04.674Z","updated_at":"2025-12-11T21:23:58.479Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# telegraf puppet module\n\n[![Build Status](https://github.com/voxpupuli/puppet-telegraf/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-telegraf/actions?query=workflow%3ACI)\n[![Release](https://github.com/voxpupuli/puppet-telegraf/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-telegraf/actions/workflows/release.yml)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/telegraf.svg)](https://forge.puppetlabs.com/puppet/telegraf)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/telegraf.svg)](https://forge.puppetlabs.com/puppet/telegraf)\n[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/telegraf.svg)](https://forge.puppetlabs.com/puppet/telegraf)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/telegraf.svg)](https://forge.puppetlabs.com/puppet/telegraf)\n[![puppetmodule.info docs](http://www.puppetmodule.info/images/badge.png)](http://www.puppetmodule.info/m/puppet-telegraf)\n[![GPL v3 License](https://img.shields.io/github/license/voxpupuli/puppet-telegraf.svg)](LICENSE)\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Setup](#setup)\n3. [Usage](#usage)\n4. [Limitations](#limitations)\n5. [Development](#development)\n\n## Overview\n\nA reasonably simple yet flexible Puppet module to manage configuration of\n[InfluxData's Telegraf](https://influxdata.com/time-series-platform/telegraf/) metrics collection agent.\n\n## Setup\n\nThis module has the following dependencies:\n\n* https://github.com/puppetlabs/puppetlabs-stdlib\n* https://github.com/puppetlabs/puppetlabs-apt (on Debian / Ubuntu)\n\n*NB:* On some apt-based distributions you'll need to ensure you have support\nfor TLS-enabled repos in place.  This can be achieved by installing the\n`apt-transport-https` package.\n\n**Up to version v4.3.1** this module **requires** the [toml-rb](https://github.com/eMancu/toml-rb) gem. Either install the gem using puppet's native gem provider, [puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/puppetserver_gem), [pe_gem](https://forge.puppetlabs.com/puppetlabs/pe_gem), [pe_puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/pe_puppetserver_gem), or manually using one of the following methods:\n```\n  # apply or puppet-master\n  gem install toml-rb\n  # PE apply\n  /opt/puppetlabs/puppet/bin/gem install toml-rb\n  # AIO or PE puppetserver\n  /opt/puppet/bin/puppetserver gem install toml-rb\n```\n\nThe toml-rb gem got replaced with `stdlib::to_toml`. This requires puppetlabs/stdlib 9.\n\nIn addition, for Windows, the following dependencies must be met:\n\n* Chocolatey installed\n* [`chocolatey/chocolatey`](https://forge.puppet.com/chocolatey/chocolatey) OR [`puppetlabs/chocolatey`](https://forge.puppet.com/puppetlabs/chocolatey)\n  * **Note:** either or both of these modules can handle ensuring the install of Chocolatey.\n\n### Usage\n\nTelegraf's configuration is split into four main sections - global tags,\noptions specific to the agent, input plugins, and output plugins.  The\ndocumentation for these sections is [here](https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md),\nand this module aims to be flexible enough to handle configuration of any of\nthese stanzas.\n\nTo get started, Telegraf can be installed with a very basic configuration by\njust including the class:\n\n```puppet\ninclude telegraf\n```\n\nHowever, to customise your configuration you'll want to do something like the following:\n\n```puppet\nclass { 'telegraf':\n    hostname =\u003e $facts['hostname'],\n    outputs  =\u003e {\n        'influxdb' =\u003e [\n            {\n                'urls'     =\u003e [ \"http://influxdb0.${facts['domain']}:8086\", \"http://influxdb1.${facts['domain']}:8086\" ],\n                'database' =\u003e 'telegraf',\n                'username' =\u003e 'telegraf',\n                'password' =\u003e 'metricsmetricsmetrics',\n            }\n        ]\n    },\n    inputs   =\u003e {\n        'cpu' =\u003e [\n            {\n                'percpu'   =\u003e true,\n                'totalcpu' =\u003e true,\n            }\n        ]\n    }\n}\n```\n\nOr here's a Hiera-based example (which is the recommended approach):\n\n```yaml\n---\ntelegraf::global_tags:\n  role: \"%{::role}\"\n  hostgroup: \"%{::hostgroup}\"\n  domain: \"%{::domain}\"\ntelegraf::inputs:\n  cpu:\n    - percpu: true\n      totalcpu: true\n  exec:\n    - commands:\n        - who | wc -l\n    - commands:\n        - cat /proc/uptime | awk '{print $1}'\n  mem: [{}]\n  io: [{}]\n  net: [{}]\n  disk: [{}]\n  swap: [{}]\n  system: [{}]\ntelegraf::outputs:\n  influxdb:\n    - urls:\n        - \"http://influxdb0.%{::domain}:8086\"\n        - \"http://influxdb1.%{::domain}:8086\"\n      database: 'influxdb'\n      username: 'telegraf'\n      password: 'telegraf'\ntelegraf::processors:\n  replace_disk_type:\n    plugin_type: regex\n    options:\n      - namepass: ['diskio']\n        order: 1\n        tags:\n          - key: 'disk_type'\n            pattern: '^dos$'\n            replacement: 'FAT'\n```\n\n`telegraf::inputs` accepts a hash of any inputs that you'd like to configure. However, you can also optionally define individual inputs using the `telegraf::input` type - this suits installations where, for example, a core module sets the defaults and other modules import it.\n\nExample 1:\n\n```puppet\ntelegraf::input { 'my_exec':\n  plugin_type =\u003e 'exec',\n  options     =\u003e [\n    {\n      'commands'    =\u003e ['/usr/local/bin/my_input.py',],\n      'name_suffix' =\u003e '_my_input',\n      'data_format' =\u003e 'json',\n    }\n  ],\n  require     =\u003e File['/usr/local/bin/my_input.py'],\n}\n```\n\nWill create the file `/etc/telegraf/telegraf.d/my_exec.conf`:\n\n    [[inputs.exec]]\n    commands = [\"/usr/local/bin/my_input.py\"]\n    data_format = \"json\"\n    name_suffix = \"_my_input\"\n\nExample 2:\n\n```puppet\ntelegraf::input { 'influxdb-dc':\n  plugin_type =\u003e 'influxdb',\n  options     =\u003e [\n    {\n      'urls' =\u003e ['http://remote-dc:8086',],\n    }\n  ],\n}\n```\n\nWill create the file `/etc/telegraf/telegraf.d/influxdb-dc.conf`:\n\n```\n[[inputs.influxdb]]\nurls = [\"http://remote-dc:8086\"]\n```\n\nExample 3:\n\n```puppet\ntelegraf::input { 'my_snmp':\n  plugin_type    =\u003e 'snmp',\n  options        =\u003e [\n    {\n      'interval' =\u003e '60s',\n      'host' =\u003e [\n        {\n          'address'   =\u003e 'snmp_host1:161',\n          'community' =\u003e 'read_only',\n          'version'   =\u003e 2,\n          'get_oids'  =\u003e ['1.3.6.1.2.1.1.5',],\n        }\n      ],\n      'tags' =\u003e {\n        'environment' =\u003e 'development',\n      },\n    }\n  ],\n}\n```\n\nWill create the file `/etc/telegraf/telegraf.d/snmp.conf`:\n\n    [[inputs.snmp]]\n    interval = \"60s\"\n    [inputs.snmp.tags]\n    environment = \"development\"\n    [[inputs.snmp.host]]\n    address = \"snmp_host1:161\"\n    community = \"read_only\"\n    get_oids = [\"1.3.6.1.2.1.1.5\"]\n    version = 2\n\nExample 4:\n\nOutputs, Processors and Aggregators are available in the same way:\n\n```puppet\ntelegraf::output { 'my_influxdb':\n  plugin_type =\u003e 'influxdb',\n  options     =\u003e [\n    {\n      'urls'     =\u003e [ \"http://influxdb.example.come:8086\"],\n      'database' =\u003e 'telegraf',\n      'username' =\u003e 'telegraf',\n      'password' =\u003e 'metricsmetricsmetrics',\n    }\n  ],\n}\n\ntelegraf::processor { 'my_regex':\n  plugin_type =\u003e 'regex',\n  options     =\u003e [\n    {\n      tags =\u003e [\n        {\n          key         =\u003e 'foo',\n          pattern     =\u003e String(/^a*b+\\d$/),\n          replacement =\u003e 'c${1}d',\n        }\n      ],\n    }\n  ],\n}\n\ntelegraf::aggregator { 'my_basicstats':\n  plugin_type =\u003e 'basicstats',\n  options     =\u003e [\n    {\n      period        =\u003e '30s',\n      drop_original =\u003e false,\n    }\n  ],\n}\n\n```\n\nExample 5:\n\n```puppet\nclass { 'telegraf':\n    ensure              =\u003e '1.0.1',\n    hostname            =\u003e $facts['hostname'],\n    windows_package_url =\u003e 'http://internal_repo:8080/chocolatey',\n}\n```\n\nWill install telegraf version 1.0.1 on Windows using an internal chocolatey repo\n\n## Hierarchical configuration from multiple files\n\nHiera YAML and JSON backends support [deep hash merging](https://docs.puppet.com/hiera/3.1/configuring.html#mergebehavior) which is needed for inheriting configuration from multiple files.\n\nFirst of all, make sure that the `deep_merge` gem is installed on your Puppet Master.\n\nAn example of `hiera.yaml`:\n\n```yaml\n---\n:hierarchy:\n    - \"roles/%{role}\"\n    - \"type/%{virtual}\"\n    - \"domain/%{domain}\"\n    - \"os/%{osfamily}\"\n    - \"common\"\n:backends:\n    - yaml\n:yaml:\n    :datadir: /etc/puppet/hiera\n:merge_behavior: deeper\n```\n\nThen you can define configuration shared for all `physical` servers and place it into `type/physical.yaml`:\n\n```yaml\ntelegraf::inputs:\n  cpu:\n    - percpu: true\n      totalcpu: true\n  mem: [{}]\n  io: [{}]\n  net: [{}]\n  disk: [{}]\n```\n\nSpecific roles will include some extra plugins, e.g. `role/frontend.yaml`:\n\n```yaml\ntelegraf::inputs:\n  nginx:\n    - urls: [\"http://localhost/server_status\"]\n```\n\n## Limitations\n\nThe latest version (2.0) of this module requires Puppet 4 or newer.  If you're looking for support under Puppet 3.x, then you'll want to make use of [an older release](https://github.com/yankcrime/puppet-telegraf/releases/tag/1.5.0).\n\nFurthermore, the introduction of toml-rb means that Ruby 1.9 or newer is also a requirement.\n\nThis module has been developed and tested against the operating systems and their version in [metadata.json](metadata.json)\n\nSupport for other distributions / operating systems is planned.  Feel free to assist with development in this regard!\n\nThe configuration generated with this module is only compatible with newer releases of Telegraf, i.e 0.11.x.  It won't work with the 0.2.x series.\n\n## Development\n\nPlease fork this repository, hack away on your branch, run the tests:\n\n```shell\n$ bundle exec rake beaker\n```\n\nAnd then submit a pull request.  [Succinct, well-described and atomic commits preferred](http://chris.beams.io/posts/git-commit/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-telegraf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-telegraf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-telegraf/lists"}