[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) | int + 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" {% if outputs_prometheus_client is defined %} [[outputs.prometheus_client]] listen = "{{ outputs_prometheus_client_listen | default(':9126') }}" expiration_interval = "{{ outputs_prometheus_client_expiration_interval | default('60s') }}" {% endif %} [[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 %} [[inputs.conntrack]] files = ["ip_conntrack_count","ip_conntrack_max", "nf_conntrack_count","nf_conntrack_max"] dirs = ["/proc/sys/net/ipv4/netfilter","/proc/sys/net/netfilter"] {% if inventory_hostname in groups['swift-proxy_containers'] %} [[inputs.statsd]] service_address = ":8125" metric_separator = "." templates = [ "*.swift.proxy-server.*.*.*.* host.measurement.measurement.measurement.method.returncode.field*", "*.swift.proxy-server.*.policy.*.*.*.* host.measurement.measurement.measurement.measurement.measurement.method.returncode.field*", ] {% 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 %}