mirror of
https://github.com/natelandau/ansible-homelab-config.git
synced 2025-11-18 09:53:41 -05:00
Initial commit
This commit is contained in:
96
templates/telegraf/base_config.conf.j2
Normal file
96
templates/telegraf/base_config.conf.j2
Normal file
@@ -0,0 +1,96 @@
|
||||
# Telegraf Configuration
|
||||
#
|
||||
# Telegraf is entirely plugin driven. All metrics are gathered from the
|
||||
# declared inputs, and sent to the declared outputs.
|
||||
#
|
||||
# Plugins must be declared in here to be active.
|
||||
# To deactivate a plugin, comment out the name and any variables.
|
||||
#
|
||||
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
|
||||
# file would generate.
|
||||
#
|
||||
# Environment variables can be used anywhere in this config file, simply surround
|
||||
# them with ${}. For strings the variable must be within quotes (ie, "${STR_VAR}"),
|
||||
# for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR})
|
||||
|
||||
|
||||
# Global tags can be specified here in key="value" format.
|
||||
[global_tags]
|
||||
dc = "{{ datacenter_name }}"
|
||||
ip = "{{ ansible_host }}"
|
||||
|
||||
# Configuration for telegraf agent
|
||||
[agent]
|
||||
|
||||
interval = "10s" ## Default data collection interval for all inputs
|
||||
round_interval = true ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
|
||||
metric_batch_size = 1000 ## Controls the size of writes that Telegraf sends to output plugins
|
||||
metric_buffer_limit = 10000 ## Maximum number of unwritten metrics per output.
|
||||
collection_jitter = "5s" ## Jitter the collection by a random amount.
|
||||
flush_interval = "10s" ## Default flushing interval for all outputs.
|
||||
flush_jitter = "5s" ## Jitter the flush interval by a random amount
|
||||
precision = ""
|
||||
debug = false ## Log at debug level.
|
||||
# quiet = false ## Log only error level messages.
|
||||
{% if 'pis' in group_names %}
|
||||
logtarget = "file" ## destination logs can be one of "file" or "stderr"
|
||||
logfile = "/var/log/telegraf/telegraf.log"
|
||||
logfile_rotation_interval = "1d"
|
||||
# logfile_rotation_max_size = "0MB"
|
||||
logfile_rotation_max_archives = 2
|
||||
{% elif 'macs' in group_names %}
|
||||
logtarget = "stderr" ## destination logs can be one of "file" or "stderr"
|
||||
{% endif %}
|
||||
|
||||
hostname = "{{ inventory_hostname }}" ## Override default hostname, if empty use os.Hostname()
|
||||
omit_hostname = false ## If set to true, do no set the "host" tag in the telegraf agent.
|
||||
|
||||
###############################################################################
|
||||
# OUTPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[outputs.influxdb]]
|
||||
urls = ["http://influxdb.service.consul:{{ influxdb_port }}"]
|
||||
database = "homelab"
|
||||
retention_policy = "2day"
|
||||
timeout = "5s"
|
||||
|
||||
###############################################################################
|
||||
# INPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[inputs.cpu]] # Read metrics about cpu usage
|
||||
percpu = true ## Whether to report per-cpu stats or not
|
||||
totalcpu = true ## Whether to report total system cpu stats or not
|
||||
collect_cpu_time = false ## If true, collect raw CPU time metrics.
|
||||
report_active = false ## If true, compute and report the sum of all non-idle CPU states.
|
||||
[[inputs.disk]] # Read metrics about disk usage by mount point
|
||||
#mount_points = ["/mnt/usbDrive","/boot"] # Restrict the stats to only the specified mount points.
|
||||
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs", "nfsd", "nfs4", "smbfs"]
|
||||
[[inputs.diskio]] # Read metrics about disk IO by device
|
||||
[[inputs.internal]] # Collect telegraf memory stats.
|
||||
collect_memstats = true
|
||||
[[inputs.mem]] # Read metrics about memory usage
|
||||
[[inputs.processes]] # Get the number of processes and group them by status
|
||||
[[inputs.swap]] # Read metrics about swap memory usage
|
||||
[[inputs.system]] # Read metrics about system load & uptime
|
||||
[[inputs.net]] # Gather metrics about network interfaces
|
||||
#[[inputs.netstat]] # Collect TCP connections state and UDP socket counts
|
||||
|
||||
|
||||
{% if 'macs' not in group_names %}
|
||||
[[inputs.nstat]] # Collects network metrics
|
||||
{% endif %}
|
||||
|
||||
{% if 'pis' in group_names%}
|
||||
[[inputs.ntpq]]
|
||||
dns_lookup = false ## If false, add -n for ntpq command. Can reduce metric gather times.
|
||||
{% endif %}
|
||||
|
||||
{% if 'opnsense' in group_names %}
|
||||
[[inputs.ntpq]]
|
||||
dns_lookup = false ## If false, add -n for ntpq command. Can reduce metric gather times.
|
||||
[[inputs.wireguard]]
|
||||
devices = ["wg0","wg1"]
|
||||
[[inputs.pf]]
|
||||
{% endif %}
|
||||
156
templates/telegraf/docker.conf.j2
Normal file
156
templates/telegraf/docker.conf.j2
Normal file
@@ -0,0 +1,156 @@
|
||||
##############################################################################
|
||||
# PROCESSOR PLUGINS #
|
||||
##############################################################################
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_mem"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_net"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_cpu"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_blkio"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_health"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_status"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
###############################################################################
|
||||
# INPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[inputs.docker]]
|
||||
## Docker Endpoint
|
||||
## To use TCP, set endpoint = "tcp://[ip]:[port]"
|
||||
## To use environment variables (ie, docker-machine), set endpoint = "ENV"
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
|
||||
## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
|
||||
## Note: configure this in one of the manager nodes in a Swarm cluster.
|
||||
## configuring in multiple Swarm managers results in duplication of metrics.
|
||||
gather_services = false
|
||||
|
||||
## Only collect metrics for these containers. Values will be appended to
|
||||
## container_name_include.
|
||||
## Deprecated (1.4.0), use container_name_include
|
||||
container_names = []
|
||||
|
||||
## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
|
||||
source_tag = false
|
||||
|
||||
## Containers to include and exclude. Collect all if empty. Globs accepted.
|
||||
container_name_include = []
|
||||
container_name_exclude = []
|
||||
|
||||
## Container states to include and exclude. Globs accepted.
|
||||
## When empty only containers in the "running" state will be captured.
|
||||
## example: container_state_include = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
|
||||
## example: container_state_exclude = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
|
||||
# container_state_include = []
|
||||
# container_state_exclude = []
|
||||
|
||||
## Timeout for docker list, info, and stats commands
|
||||
timeout = "5s"
|
||||
|
||||
## Whether to report for each container per-device blkio (8:0, 8:1...),
|
||||
## network (eth0, eth1, ...) and cpu (cpu0, cpu1, ...) stats or not.
|
||||
## Usage of this setting is discouraged since it will be deprecated in favor of 'perdevice_include'.
|
||||
## Default value is 'true' for backwards compatibility, please set it to 'false' so that 'perdevice_include' setting
|
||||
## is honored.
|
||||
perdevice = true
|
||||
|
||||
## Specifies for which classes a per-device metric should be issued
|
||||
## Possible values are 'cpu' (cpu0, cpu1, ...), 'blkio' (8:0, 8:1, ...) and 'network' (eth0, eth1, ...)
|
||||
## Please note that this setting has no effect if 'perdevice' is set to 'true'
|
||||
# perdevice_include = ["cpu"]
|
||||
|
||||
## Whether to report for each container total blkio and network stats or not.
|
||||
## Usage of this setting is discouraged since it will be deprecated in favor of 'total_include'.
|
||||
## Default value is 'false' for backwards compatibility, please set it to 'true' so that 'total_include' setting
|
||||
## is honored.
|
||||
total = false
|
||||
|
||||
## Specifies for which classes a total metric should be issued. Total is an aggregated of the 'perdevice' values.
|
||||
## Possible values are 'cpu', 'blkio' and 'network'
|
||||
## Total 'cpu' is reported directly by Docker daemon, and 'network' and 'blkio' totals are aggregated by this plugin.
|
||||
## Please note that this setting has no effect if 'total' is set to 'false'
|
||||
# total_include = ["cpu", "blkio", "network"]
|
||||
|
||||
## docker labels to include and exclude as tags. Globs accepted.
|
||||
## Note that an empty array for both will include all labels as tags
|
||||
docker_label_include = []
|
||||
docker_label_exclude = ["traefik.*"] # Do not report on Traefik tags
|
||||
|
||||
## Which environment variables should we use as a tag
|
||||
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
22
templates/telegraf/leader.conf.j2
Normal file
22
templates/telegraf/leader.conf.j2
Normal file
@@ -0,0 +1,22 @@
|
||||
[[processors.regex]]
|
||||
namepass = ["consul_health_checks"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "check_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^service: \\W(\\w+)\\W check$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[inputs.consul]]
|
||||
address = "consul.service.consul:8500"
|
||||
scheme = "http"
|
||||
insecure_skip_verify = true
|
||||
metric_version = 2
|
||||
namedrop = ["traefik.http*","traefik.enable*","traefik.tcp*"]
|
||||
tagexclude = ["traefik.http*","traefik.enable*", "traefik.tcp*"]
|
||||
[inputs.consul.tagdrop]
|
||||
check_name = [ "Nomad Client*", "Nomad Server*", "Serf Health Status" ]
|
||||
15
templates/telegraf/nomad.conf.j2
Normal file
15
templates/telegraf/nomad.conf.j2
Normal file
@@ -0,0 +1,15 @@
|
||||
[[inputs.statsd]]
|
||||
protocol = "udp" # Protocol, must be "tcp", "udp4", "udp6" or "udp" (default=udp)
|
||||
service_address = "127.0.0.1:8125" # Address and port to host UDP listener on
|
||||
delete_gauges = true # Reset gauges every interval (default=true)
|
||||
delete_counters = true # Reset counters every interval (default=true)
|
||||
delete_sets = true # Reset sets every interval (default=true)
|
||||
delete_timings = true # Reset timings & histograms every interval (default=true)
|
||||
percentiles = [90.0] # Percentiles to calculate for timing & histogram stats
|
||||
metric_separator = "_"
|
||||
datadog_extensions = true # Parses tags in the datadog statsd format
|
||||
allowed_pending_messages = 10000
|
||||
percentile_limit = 1000
|
||||
[inputs.statsd.tagdrop]
|
||||
task = [ "await-*","run-*","await_*","run_*","create_*","create-*" ]
|
||||
task_group = [ "await-*","run-*","await_*","run_*","create_*","create-*" ]
|
||||
88
templates/telegraf/pingHosts.conf.j2
Normal file
88
templates/telegraf/pingHosts.conf.j2
Normal file
@@ -0,0 +1,88 @@
|
||||
{# Ping internal servers #}
|
||||
[[processors.enum]]
|
||||
[[processors.enum.mapping]]
|
||||
## Name of the field to map
|
||||
#field = "url"
|
||||
|
||||
## Name of the tag to map
|
||||
tag = "url"
|
||||
|
||||
## Destination tag or field to be used for the mapped value. By default the
|
||||
## source tag or field is used, overwriting the original value.
|
||||
dest = "host"
|
||||
|
||||
## Default value to be used for all values not contained in the mapping
|
||||
## table. When unset and no match is found, the original field will remain
|
||||
## unmodified and the destination tag or field will not be created.
|
||||
# default = 0
|
||||
|
||||
## Table of mappings
|
||||
[processors.enum.mapping.value_mappings]
|
||||
"10.0.30.6" = "synology"
|
||||
{% for i in groups['pis'] %}
|
||||
"{{ hostvars[i].ansible_host }}" = "{{ hostvars[i].inventory_hostname }}"
|
||||
{% endfor %}
|
||||
|
||||
[[inputs.ping]]
|
||||
## Hosts to send ping packets to.
|
||||
# https://github.com/influxdata/telegraf/blob/release-1.13/plugins/inputs/ping/README.md
|
||||
urls = [{% for i in groups['pis'] %}'{{ hostvars[i].ansible_host }}'{% if not loop.last %}, {% endif %}{% endfor %},
|
||||
'10.0.30.6',
|
||||
'core1.bos1.he.net',
|
||||
'core1.lax1.he.net',
|
||||
'core1.nyc4.he.net',
|
||||
'core1.oma1.he.net',
|
||||
'core1.chi1.he.net',
|
||||
'core1.dal1.he.net',
|
||||
'core1.den1.he.net',
|
||||
'core1.mia1.he.net',
|
||||
'core1.bna1.he.net',
|
||||
'core1.phx1.he.net',
|
||||
'core1.sea1.he.net',
|
||||
'core1.blp1.he.net',
|
||||
'core1.ams1.he.net',
|
||||
'core1.dxb1.he.net',
|
||||
'core1.jnb1.he.net',
|
||||
'core1.man1.he.net',
|
||||
'core1.rom1.he.net',
|
||||
'core1.tyo1.he.net',
|
||||
'core1.zrh3.he.net',
|
||||
'core2.sao1.he.net',
|
||||
'core1.sin1.he.net',
|
||||
'core1.kpb1.he.net',
|
||||
'core1.nbo1.he.net',
|
||||
'core1.tpe1.he.net',
|
||||
'core1.sto1.he.net',
|
||||
'core1.ymq1.he.net',
|
||||
'core2.syd1.he.net'
|
||||
]
|
||||
|
||||
## Method used for sending pings, can be either "exec" or "native". When set
|
||||
## to "exec" the systems ping command will be executed. When set to "native"
|
||||
## the plugin will send pings directly.
|
||||
##
|
||||
## While the default is "exec" for backwards compatibility, new deployments
|
||||
## are encouraged to use the "native" method for improved compatibility and
|
||||
## performance.
|
||||
method = "exec"
|
||||
|
||||
## Number of ping packets to send per interval. Corresponds to the "-c"
|
||||
## option of the ping command.
|
||||
count = 1
|
||||
|
||||
## Time to wait between sending ping packets in seconds. Operates like the
|
||||
## "-i" option of the ping command.
|
||||
ping_interval = 1.0
|
||||
|
||||
fielddrop = ["packets_received", "packets_transmitted", "ttl", "standard_deviation_ms"]
|
||||
|
||||
interval = "1m" ## Interval to send pings
|
||||
|
||||
## Specify the ping executable binary.
|
||||
{% if 'pis' in group_names %}
|
||||
binary = "/usr/bin/ping"
|
||||
{% elif 'macs' in group_names %}
|
||||
binary = "/sbin/ping"
|
||||
{% else %}
|
||||
binary = "/bin/ping"
|
||||
{% endif %}
|
||||
234
templates/telegraf/synology.conf.j2
Normal file
234
templates/telegraf/synology.conf.j2
Normal file
@@ -0,0 +1,234 @@
|
||||
# Telegraf Configuration
|
||||
#
|
||||
# Telegraf is entirely plugin driven. All metrics are gathered from the
|
||||
# declared inputs, and sent to the declared outputs.
|
||||
#
|
||||
# Plugins must be declared in here to be active.
|
||||
# To deactivate a plugin, comment out the name and any variables.
|
||||
#
|
||||
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
|
||||
# file would generate.
|
||||
#
|
||||
# Environment variables can be used anywhere in this config file, simply surround
|
||||
# them with ${}. For strings the variable must be within quotes (ie, "${STR_VAR}"),
|
||||
# for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR})
|
||||
|
||||
|
||||
# Global tags can be specified here in key="value" format.
|
||||
[global_tags]
|
||||
dc = "{{ datacenter_name }}"
|
||||
ip = "{{ ansible_host }}"
|
||||
|
||||
# Configuration for telegraf agent
|
||||
[agent]
|
||||
|
||||
interval = "10s" ## Default data collection interval for all inputs
|
||||
round_interval = true ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
|
||||
metric_batch_size = 1000 ## Controls the size of writes that Telegraf sends to output plugins
|
||||
metric_buffer_limit = 10000 ## Maximum number of unwritten metrics per output.
|
||||
collection_jitter = "5s" ## Jitter the collection by a random amount.
|
||||
flush_interval = "10s" ## Default flushing interval for all outputs.
|
||||
flush_jitter = "5s" ## Jitter the flush interval by a random amount
|
||||
precision = ""
|
||||
debug = false ## Log at debug level.
|
||||
# quiet = false ## Log only error level messages.
|
||||
{% if 'pis' in group_names %}
|
||||
logtarget = "file" ## destination logs can be one of "file" or "stderr"
|
||||
logfile = "/var/log/telegraf/telegraf.log"
|
||||
logfile_rotation_interval = "1d"
|
||||
# logfile_rotation_max_size = "0MB"
|
||||
logfile_rotation_max_archives = 2
|
||||
{% elif 'macs' in group_names %}
|
||||
logtarget = "stderr" ## destination logs can be one of "file" or "stderr"
|
||||
{% endif %}
|
||||
|
||||
hostname = "{{ inventory_hostname }}" ## Override default hostname, if empty use os.Hostname()
|
||||
omit_hostname = false ## If set to true, do no set the "host" tag in the telegraf agent.
|
||||
|
||||
###############################################################################
|
||||
# OUTPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[outputs.influxdb]]
|
||||
urls = ["http://influxdb.service.consul:{{ influxdb_port }}"]
|
||||
database = "homelab"
|
||||
retention_policy = "2day"
|
||||
timeout = "5s"
|
||||
|
||||
###############################################################################
|
||||
# INPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[inputs.cpu]] # Read metrics about cpu usage
|
||||
percpu = true ## Whether to report per-cpu stats or not
|
||||
totalcpu = true ## Whether to report total system cpu stats or not
|
||||
collect_cpu_time = false ## If true, collect raw CPU time metrics.
|
||||
report_active = false ## If true, compute and report the sum of all non-idle CPU states.
|
||||
[[inputs.disk]] # Read metrics about disk usage by mount point
|
||||
#mount_points = ["/mnt/usbDrive","/boot"] # Restrict the stats to only the specified mount points.
|
||||
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs", "nfsd", "nfs4", "smbfs"]
|
||||
[[inputs.diskio]] # Read metrics about disk IO by device
|
||||
[[inputs.internal]] # Collect telegraf memory stats.
|
||||
collect_memstats = true
|
||||
[[inputs.mem]] # Read metrics about memory usage
|
||||
[[inputs.processes]] # Get the number of processes and group them by status
|
||||
[[inputs.swap]] # Read metrics about swap memory usage
|
||||
[[inputs.system]] # Read metrics about system load & uptime
|
||||
[[inputs.net]] # Gather metrics about network interfaces
|
||||
|
||||
###############################################################################
|
||||
# PROCESSOR PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_mem"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_net"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_cpu"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_blkio"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_health"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
[[processors.regex]]
|
||||
namepass = ["docker_container_status"]
|
||||
|
||||
# Tag and field conversions defined in a separate sub-tables
|
||||
[[processors.regex.tags]]
|
||||
## Tag to change
|
||||
key = "container_name"
|
||||
## Regular expression to match on a tag value
|
||||
pattern = "^([a-zA-Z0-9_]+)-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$"
|
||||
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||
## notation to use the text of the first submatch.
|
||||
replacement = "${1}"
|
||||
|
||||
###############################################################################
|
||||
# INPUT PLUGINS #
|
||||
###############################################################################
|
||||
|
||||
[[inputs.docker]]
|
||||
## Docker Endpoint
|
||||
## To use TCP, set endpoint = "tcp://[ip]:[port]"
|
||||
## To use environment variables (ie, docker-machine), set endpoint = "ENV"
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
|
||||
## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
|
||||
## Note: configure this in one of the manager nodes in a Swarm cluster.
|
||||
## configuring in multiple Swarm managers results in duplication of metrics.
|
||||
gather_services = false
|
||||
|
||||
## Only collect metrics for these containers. Values will be appended to
|
||||
## container_name_include.
|
||||
## Deprecated (1.4.0), use container_name_include
|
||||
container_names = []
|
||||
|
||||
## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
|
||||
source_tag = false
|
||||
|
||||
## Containers to include and exclude. Collect all if empty. Globs accepted.
|
||||
container_name_include = []
|
||||
container_name_exclude = []
|
||||
|
||||
## Container states to include and exclude. Globs accepted.
|
||||
## When empty only containers in the "running" state will be captured.
|
||||
## example: container_state_include = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
|
||||
## example: container_state_exclude = ["created", "restarting", "running", "removing", "paused", "exited", "dead"]
|
||||
# container_state_include = []
|
||||
# container_state_exclude = []
|
||||
|
||||
## Timeout for docker list, info, and stats commands
|
||||
timeout = "5s"
|
||||
|
||||
## Whether to report for each container per-device blkio (8:0, 8:1...),
|
||||
## network (eth0, eth1, ...) and cpu (cpu0, cpu1, ...) stats or not.
|
||||
## Usage of this setting is discouraged since it will be deprecated in favor of 'perdevice_include'.
|
||||
## Default value is 'true' for backwards compatibility, please set it to 'false' so that 'perdevice_include' setting
|
||||
## is honored.
|
||||
perdevice = true
|
||||
|
||||
## Specifies for which classes a per-device metric should be issued
|
||||
## Possible values are 'cpu' (cpu0, cpu1, ...), 'blkio' (8:0, 8:1, ...) and 'network' (eth0, eth1, ...)
|
||||
## Please note that this setting has no effect if 'perdevice' is set to 'true'
|
||||
# perdevice_include = ["cpu"]
|
||||
|
||||
## Whether to report for each container total blkio and network stats or not.
|
||||
## Usage of this setting is discouraged since it will be deprecated in favor of 'total_include'.
|
||||
## Default value is 'false' for backwards compatibility, please set it to 'true' so that 'total_include' setting
|
||||
## is honored.
|
||||
total = false
|
||||
|
||||
## Specifies for which classes a total metric should be issued. Total is an aggregated of the 'perdevice' values.
|
||||
## Possible values are 'cpu', 'blkio' and 'network'
|
||||
## Total 'cpu' is reported directly by Docker daemon, and 'network' and 'blkio' totals are aggregated by this plugin.
|
||||
## Please note that this setting has no effect if 'total' is set to 'false'
|
||||
# total_include = ["cpu", "blkio", "network"]
|
||||
|
||||
## docker labels to include and exclude as tags. Globs accepted.
|
||||
## Note that an empty array for both will include all labels as tags
|
||||
docker_label_include = []
|
||||
docker_label_exclude = ["traefik.*"] # Do not report on Traefik tags
|
||||
|
||||
## Which environment variables should we use as a tag
|
||||
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
10
templates/telegraf/temperature.conf.j2
Normal file
10
templates/telegraf/temperature.conf.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
[[inputs.exec]]
|
||||
{% if 'pis' in group_names %}
|
||||
commands = ["cat /sys/class/thermal/thermal_zone0/temp"]
|
||||
{% elif 'macs' in group_names %}
|
||||
commands = ["${HOME}/dotfiles-private/config/telegraf/cputemp.sh"]
|
||||
{% endif %}
|
||||
timeout = "5s"
|
||||
name_suffix = "_cpu_temp"
|
||||
data_format = "value"
|
||||
data_type = "integer"
|
||||
Reference in New Issue
Block a user