Kevin Carter 5b93b9a2c2 Added nova quota plugin
This change adds a second plugin to the telegraf setup. A change is
being made to the telegraf config file to allow for more than one
external plugin to be executed and to allow for full plugin execution
between telegraf reporting intervals.

Each plugin will potentially account for up to 8 seconds of runtime with
the telegraf agent now using a dynamic reporting interval based on the
number of plugins a given agent is needing to execute.

Change-Id: I652e8e2f13bd4fb9135280b76f2344177a14eaf7
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-12-15 15:19:50 +00:00

89 lines
2.3 KiB
Django/Jinja

[global_tags]
{% if inventory_hostname in groups['all_containers'] %}
node_type = "container"
{% elif inventory_hostname in groups['hosts'] %}
node_type = "physical_host"
{% endif %}
{% set run_commands = [] %}
{% for key, value in command_plugins.items() %}
{% if value.when_group | bool and (value.group == inventory_hostname or inventory_hostname in value.group | default([])) %}
{% set _ = run_commands.extend(value.command) %}
{% endif %}
{% endfor %}
{# The run_int adds padding to the interval so that plugins being added to the system have #}
{# enough time to execute. Every added plugin will add 8 seconds to the interval with a #}
{# default of 24. This value is later used as the flush interval which needs to be 2x the agent. #}
{% set run_int = run_commands | length %}
{% set interval = (run_int < 1 | ternary(0, run_int * 8)) + 24 %}
[agent]
interval = "{{ interval }}s"
round_interval = false
metric_batch_size = 1024
metric_buffer_limit = 10240
collection_jitter = "8s"
flush_interval = "{{ interval * 2 }}s"
flush_jitter = "8s"
debug = false
quiet = true
{% if inventory_hostname in groups['all_containers'] %}
hostname = "{{ ansible_hostname }}"
{% else %}
hostname = "{{ inventory_hostname }}"
{% endif %}
omit_hostname = false
[[outputs.influxdb]]
urls = [{{ influx_telegraf_targets | map('quote') | join(',') }}]
database = "{{ influxdb_db_name }}"
precision = "s"
write_consistency = "any"
timeout = "5s"
[[inputs.processes]]
[[inputs.system]]
{% set run_commands = [] %}
{% for key, value in command_plugins.items() %}
{% if value.when_group | bool and (value.group == inventory_hostname or inventory_hostname in value.group | default([])) %}
{% set _ = run_commands.extend(value.command) %}
{% endif %}
{% endfor %}
{% if run_commands %}
[[inputs.exec]]
commands = [{{ run_commands | map('quote') | join(',') }}]
timeout = "{{ (run_commands | length) * 8 }}s"
data_format = "influx"
{% endif %}
{% if inventory_hostname in groups['all_containers'] %}
[[inputs.net]]
{% elif inventory_hostname in groups['hosts'] %}
[[inputs.cpu]]
percpu = true
totalcpu = true
fielddrop = ["time_*"]
[[inputs.net]]
[[inputs.netstat]]
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.swap]]
{% endif %}