Skip to content

Commit

Permalink
Merge pull request dj-wasabi#20 from szibis/input_tags
Browse files Browse the repository at this point in the history
Input tags support
  • Loading branch information
dj-wasabi authored Jan 20, 2017
2 parents e37cd4e + e9cb4b5 commit 4e6da1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Role Variables
The following parameters can be set for the Telegraf agent:

* `telegraf_agent_version`: The version of Telegraf to install. Default: `1.0.0`
* `telegraf_agent_rpm_url`: The full path to the RPM file located on a webserver.
* `telegraf_agent_rpm_url`: The full path to the RPM file located on a webserver.
* `telegraf_agent_deb_url`: The full path to the DEB file located on a webserver.
* `telegraf_agent_interval`: The interval configured for sending data to the server. Default: `10`
* `telegraf_agent_debug`: Run Telegraf in debug mode. Default: `False`
Expand Down Expand Up @@ -53,6 +53,8 @@ Specifying an output. The default is set to localhost, you'll have to specify th
config:
- urls = ["http://localhost:8086"]
- database = "telegraf"
tagpass:
- diskmetrics = ["true"]

The config will be printed line by line into the configuration, so you could also use:

Expand Down Expand Up @@ -80,7 +82,7 @@ With the property `telegraf_plugins_default` it is set to use the default set of
- plugin: netstat

Every telegraf agent has these as an default configuration.

The 2nd parameter `telegraf_plugins_extra` can be used to add plugins specific to the servers goal. Following is an example for using this parameter for MySQL database servers:

cat group_vars/mysql_database
Expand All @@ -92,6 +94,7 @@ The 2nd parameter `telegraf_plugins_extra` can be used to add plugins specific t

Telegraf plugin options:

* `tags` An k/v tags to apply to a specific input's measurements. Can be used on any stage for better filtering for example in outputs.
* `pass`: An array of strings that is used to filter metrics generated by the current plugin. Each string in the array is tested as a prefix against metric names and if it matches, the metric is emitted.
* `drop`: The inverse of pass, if a metric name matches, it is not emitted.
* `tagpass`: (added in Telegraf 0.1.5) tag names and arrays of strings that are used to filter metrics by the current plugin. Each string in the array is tested as an exact match against the tag name, and if it matches the metric is emitted.
Expand All @@ -103,6 +106,8 @@ An example might look like this:
telegraf_plugins_default:
- plugin: disk
interval: 12
tags:
- diskmetrics = "true"
tagpass:
- fstype = [ "ext4", "xfs" ]
- path = [ "/opt", "/home" ]
Expand Down
6 changes: 6 additions & 0 deletions templates/telegraf.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
{{ items }}
{% endfor %}
{% endif %}
{% if item.tags is defined and item.tags is iterable %}
[inputs.{{ item.plugin }}.tags]
{% for items in item.tags %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.tagpass is defined and item.tagpass is iterable %}
[{{ item.plugin }}.tagpass]
{% for items in item.tagpass %}
Expand Down

0 comments on commit 4e6da1b

Please sign in to comment.