Input tags support

This commit is contained in:
Slawomir Skowron
2017-01-18 21:29:42 +01:00
parent 8fd9c2c9c9
commit f3f67f4f7a
2 changed files with 12 additions and 2 deletions

View File

@ -53,6 +53,8 @@ Specifying an output. The default is set to localhost, you'll have to specify th
config: config:
- urls = ["http://localhost:8086"] - urls = ["http://localhost:8086"]
- database = "telegraf" - database = "telegraf"
tagpass:
- diskmetrics = ["true"]
The config will be printed line by line into the configuration, so you could also use: The config will be printed line by line into the configuration, so you could also use:
@ -92,6 +94,7 @@ The 2nd parameter `telegraf_plugins_extra` can be used to add plugins specific t
Telegraf plugin options: 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. * `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. * `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. * `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.
@ -103,6 +106,8 @@ An example might look like this:
telegraf_plugins_default: telegraf_plugins_default:
- plugin: disk - plugin: disk
interval: 12 interval: 12
tags:
- diskmetrics = "true"
tagpass: tagpass:
- fstype = [ "ext4", "xfs" ] - fstype = [ "ext4", "xfs" ]
- path = [ "/opt", "/home" ] - path = [ "/opt", "/home" ]

View File

@ -54,6 +54,11 @@
{{ items }} {{ items }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if item.tags is defined and item.tags is iterable %}
[inputs.{{ item.plugin }}.tags]
{% for items in item.tags %}
{{ items }}
{% endfor %}
{% if item.tagpass is defined and item.tagpass is iterable %} {% if item.tagpass is defined and item.tagpass is iterable %}
[{{ item.plugin }}.tagpass] [{{ item.plugin }}.tagpass]
{% for items in item.tagpass %} {% for items in item.tagpass %}