Update telegraf to use influx2

This commit is contained in:
Wilfried OLLIVIER 2022-06-01 20:34:48 +02:00
parent f91c55e3e1
commit 32f9eda9b6
6 changed files with 4584 additions and 617 deletions

View file

@ -1,9 +1,7 @@
--- ---
db_name: telegraf
db_user: telegraf
db_pass: not24get
influx_host: localhost influx_host: localhost
influx_proto: http influx_proto: http
influx_port: 8086 influx_port: 8086
bucket_name: telegraf-bucket
org_name: papey

View file

@ -5,13 +5,12 @@ galaxy_info:
license: WTFPL license: WTFPL
min_ansible_version: 2.4 min_ansible_version: "2.4"
platforms: platforms:
- name: Debian - name: Debian
versions: versions:
- Stretch - "bullseye"
- Buster
galaxy_tags: galaxy_tags:
- telegraf - telegraf

View file

@ -1,5 +1,4 @@
--- ---
# https://docs.influxdata.com/telegraf/v1.11/introduction/installation/ # https://docs.influxdata.com/telegraf/v1.11/introduction/installation/
- name: Ensure apt-transport-https - name: Ensure apt-transport-https
@ -8,17 +7,12 @@
state: present state: present
update_cache: yes update_cache: yes
- name: Ensure python dependencies - name: Ensure influxdata signing key
apt:
name: [ 'python-requests', 'python-pip' ]
state: present
- name: Ensure Influx Data signing key
apt_key: apt_key:
url: "{{ influx.repo }}" url: "{{ influx.repo }}"
state: present state: present
- name: Ensure Influx Data repo - name: Ensure influxdata repo
apt_repository: apt_repository:
repo: deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable repo: deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable
state: present state: present
@ -54,7 +48,7 @@
- name: Ensure Telegraf can access Docker socket - name: Ensure Telegraf can access Docker socket
user: name=telegraf user: name=telegraf
group=telegraf group=telegraf
groups=docker groups=docker
append=yes append=yes
when: "'docker' in services" when: "'docker' in services"

View file

@ -31,10 +31,6 @@
## Timeout for docker list, info, and stats commands ## Timeout for docker list, info, and stats commands
timeout = "5s" timeout = "5s"
## Whether to report for each container per-device blkio (8:0, 8:1...) and
## network (eth0, eth1, ...) stats or not
perdevice = true
## Whether to report for each container total blkio and network stats or not ## Whether to report for each container total blkio and network stats or not
total = false total = false

View file

@ -91,77 +91,12 @@
# OUTPUT PLUGINS # # OUTPUT PLUGINS #
############################################################################### ###############################################################################
# Configuration for sending metrics to InfluxDB v2
# Configuration for sending metrics to InfluxDB [[outputs.influxdb_v2]]
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
# urls = ["unix:///var/run/influxdb.sock"]
# urls = ["udp://127.0.0.1:8089"]
# urls = ["http://127.0.0.1:8086"]
urls = ["{{ influx_proto }}://{{ influx_host }}:{{ influx_port }}"] urls = ["{{ influx_proto }}://{{ influx_host }}:{{ influx_port }}"]
token = "{{ _telegraf_token }}"
## The target database for metrics; will be created as needed. organization = "{{ org_name }}"
## For UDP url endpoint database needs to be configured on server side. bucket = "{{ bucket_name }}"
database = "{{ db_name }}"
## The value of this tag will be used to determine the database. If this
## tag is not set the 'database' option is used as the default.
# database_tag = ""
## If true, no CREATE DATABASE queries will be sent. Set to true when using
## Telegraf with a user without permissions to create databases or when the
## database already exists.
skip_database_creation = true
## Name of existing retention policy to write to. Empty string writes to
## the default retention policy. Only takes effect when using HTTP.
# retention_policy = ""
## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
## Only takes effect when using HTTP.
write_consistency = "any"
## Timeout for HTTP messages.
timeout = "5s"
## HTTP Basic Auth
username = "{{ db_user }}"
password = "{{ db_pass }}"
## HTTP User-Agent
# user_agent = "telegraf"
## UDP payload size is the maximum packet size to send.
# udp_payload = "512B"
## Optional TLS Config for use on HTTP connections.
# 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
## HTTP Proxy override, if unset values the standard proxy environment
## variables are consulted to determine which proxy, if any, should be used.
# http_proxy = "http://corporate.proxy:3128"
## Additional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "identity"
## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: "42u". You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false
# # Configuration for Amon Server to send metrics to. # # Configuration for Amon Server to send metrics to.
# [[outputs.amon]] # [[outputs.amon]]

File diff suppressed because it is too large Load diff