From f079839f736c4352636e39ae3672dc0a1af0793f Mon Sep 17 00:00:00 2001 From: Kerri Wait <kerri.wait@monash.edu> Date: Thu, 8 Oct 2020 11:38:53 +1100 Subject: [PATCH] Refactor telegraf.conf.j2 to pull inputs.ethtool conf out into template --- roles/telegraf/tasks/main.yml | 14 ++++++++++++++ roles/telegraf/templates/inputs.ethtool.conf.j2 | 8 ++++++++ roles/telegraf/templates/telegraf.conf.j2 | 9 --------- 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 roles/telegraf/templates/inputs.ethtool.conf.j2 diff --git a/roles/telegraf/tasks/main.yml b/roles/telegraf/tasks/main.yml index 5ca8af1f..39bc7d2c 100644 --- a/roles/telegraf/tasks/main.yml +++ b/roles/telegraf/tasks/main.yml @@ -71,6 +71,20 @@ tags: - configuration +- name: Install ethtool plugin for mlx interfaces + template: + src: inputs.ethtool.conf.j2 + dest: /etc/telegraf/telegraf.d/inputs.ethtool.conf + owner: telegraf + group: telegraf + mode: '640' + notify: + - "restart telegraf" + become: true + become_user: root + tags: + - configuration + - name: Install multifile plugin for mlx hw_counters template: src: inputs.multifile_mlx.conf.j2 diff --git a/roles/telegraf/templates/inputs.ethtool.conf.j2 b/roles/telegraf/templates/inputs.ethtool.conf.j2 new file mode 100644 index 00000000..01e42a2c --- /dev/null +++ b/roles/telegraf/templates/inputs.ethtool.conf.j2 @@ -0,0 +1,8 @@ +# Returns ethtool statistics for given interfaces +[[inputs.ethtool]] + interval = "60s" + # List of interfaces to pull metrics for + # interface_include = ["mlx0", "p1p1"] + + # List of interfaces to ignore when pulling metrics. + interface_exclude = ["eth0", "eth00", "eth1", "eth2", "lo", "virbr0", "virbr0-nic"] \ No newline at end of file diff --git a/roles/telegraf/templates/telegraf.conf.j2 b/roles/telegraf/templates/telegraf.conf.j2 index dad6f453..02b7c6c4 100644 --- a/roles/telegraf/templates/telegraf.conf.j2 +++ b/roles/telegraf/templates/telegraf.conf.j2 @@ -119,15 +119,6 @@ # Uncomment the following line if you do not need disk serial numbers. # skip_serial_number = true -# Returns ethtool statistics for given interfaces -[[inputs.ethtool]] - interval = "60s" - # List of interfaces to pull metrics for - # interface_include = ["mlx0", "p1p1"] - - # List of interfaces to ignore when pulling metrics. - interface_exclude = ["eth0", "eth00", "eth1", "eth2", "lo", "virbr0", "virbr0-nic"] - # Read metrics about the number of files in /home [[inputs.filecount]] directories = ["/home"] -- GitLab