From f577660364f1e37b901eb4179b60ea6675a1ff96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Tr=C3=A9gou=C3=ABt?= Date: Tue, 26 May 2020 11:17:29 +0200 Subject: [PATCH] metrics : unification de la conf telegraf Co-authored-by: aouvrard --- roles/jitsi-enable-stats/tasks/main.yml | 18 +++----- .../templates/telegraf-general-nrd.conf.j2 | 42 ------------------- ...al-cl.conf.j2 => telegraf-general.conf.j2} | 6 +++ 3 files changed, 12 insertions(+), 54 deletions(-) delete mode 100644 roles/jitsi-enable-stats/templates/telegraf-general-nrd.conf.j2 rename roles/jitsi-enable-stats/templates/{telegraf-general-cl.conf.j2 => telegraf-general.conf.j2} (90%) diff --git a/roles/jitsi-enable-stats/tasks/main.yml b/roles/jitsi-enable-stats/tasks/main.yml index 2c3d479..ca36134 100644 --- a/roles/jitsi-enable-stats/tasks/main.yml +++ b/roles/jitsi-enable-stats/tasks/main.yml @@ -50,18 +50,12 @@ prompt: "Vers quel influxdb/grafana souhaitez vous envoyer les metrics?\n1- Néréide\n2- Champs-Libres\n" register: prompt_input -- name: Application de la conf Telegraf Néréide +- name: Application de la conf Telegraf + vars: + outputnrd: prompt_input.user_input == "1" + outputcl: prompt_input.user_input == "2" template: - src: ../templates/telegraf-general-nrd.conf.j2 + src: ../templates/telegraf-general.conf.j2 dest: /etc/telegraf/telegraf.conf notify: - - restart telegraf - when: prompt_input.user_input == "1" - -- name: Application de la conf Telegraf Champs-Libre - template: - src: ../templates/telegraf-general-cl.conf.j2 - dest: /etc/telegraf/telegraf.conf - notify: - - restart telegraf - when: prompt_input.user_input == "2" + - restart telegraf \ No newline at end of file diff --git a/roles/jitsi-enable-stats/templates/telegraf-general-nrd.conf.j2 b/roles/jitsi-enable-stats/templates/telegraf-general-nrd.conf.j2 deleted file mode 100644 index cf40607..0000000 --- a/roles/jitsi-enable-stats/templates/telegraf-general-nrd.conf.j2 +++ /dev/null @@ -1,42 +0,0 @@ -[global_tags] - - -# Configuration for telegraf agent -[agent] - interval = "60s" - debug = false - hostname = "{{ inventory_hostname }}" - round_interval = true - flush_interval = "10s" - flush_jitter = "0s" - collection_jitter = "0s" - metric_batch_size = 1000 - metric_buffer_limit = 10000 - quiet = false - logfile = "" - omit_hostname = false - -############################################################################### -# OUTPUTS # -############################################################################### - -[[outputs.influxdb]] - urls = [ "https://influxdb.nereide.fr" ] - username = "telegraf" - password = "{{ vault_telegraf_nrd_passwd }}" - -############################################################################### -# INPUTS # -############################################################################### - -[[inputs.processes]] -[[inputs.cpu]] - percpu = false -[[inputs.disk]] - interval = "3600s" - ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] - fielddrop = ["total","used","inodes_free","inodes_total","inodes_used"] -[[inputs.mem]] - fielddrop=["buffered","cached","slab","available_percent","used_percent","wired","commit_limit","commited_as","dirty","high_free","high_total","huge_page_size","huge_pages_free","huge_pages_total","low_free","low_total","mapped","page_tables","shared","sreclaimable","sunreclaim","swap_total","vmalloc_chunk","vmalloc_total","vmalloc_used","write_back","write_back_tmp"] -[[inputs.system]] - fielddrop=["n_users","uptime_format","uptime","n_cpus"] diff --git a/roles/jitsi-enable-stats/templates/telegraf-general-cl.conf.j2 b/roles/jitsi-enable-stats/templates/telegraf-general.conf.j2 similarity index 90% rename from roles/jitsi-enable-stats/templates/telegraf-general-cl.conf.j2 rename to roles/jitsi-enable-stats/templates/telegraf-general.conf.j2 index 5f869ce..b3ba4f0 100644 --- a/roles/jitsi-enable-stats/templates/telegraf-general-cl.conf.j2 +++ b/roles/jitsi-enable-stats/templates/telegraf-general.conf.j2 @@ -21,9 +21,15 @@ ############################################################################### [[outputs.influxdb]] +{% if outputnrd %} + urls = [ "https://influxdb.nereide.fr" ] + username = "telegraf" + password = "{{ vault_telegraf_nrd_passwd }}" +{% elif outputcl %} urls = [ "https://influxdb.gra1.metrics.ovh.net" ] username = "metrics" password = "{{ vault_telegraf_cl_passwd }}" +{% endif %} ############################################################################### # INPUTS #