From d43d3433faa15df9e9e2a65005e106c7ad9bad04 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 5 Mar 2021 20:50:08 +0000 Subject: [PATCH] Collect SMART metrics for disks --- ansible/roles/telegraf/files/telegraf.conf | 3 +++ ansible/roles/telegraf/tasks/main.yml | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/ansible/roles/telegraf/files/telegraf.conf b/ansible/roles/telegraf/files/telegraf.conf index 563554e..2cc0c1b 100644 --- a/ansible/roles/telegraf/files/telegraf.conf +++ b/ansible/roles/telegraf/files/telegraf.conf @@ -96,3 +96,6 @@ [[inputs.ping]] urls = ["192.168.1.1", "1.1.1.1"] ping_interval = 60.0 + +[[inputs.smart]] + use_sudo = true diff --git a/ansible/roles/telegraf/tasks/main.yml b/ansible/roles/telegraf/tasks/main.yml index b80d1d0..afc56ac 100644 --- a/ansible/roles/telegraf/tasks/main.yml +++ b/ansible/roles/telegraf/tasks/main.yml @@ -2,3 +2,9 @@ import_role: name: rossmcdonald.telegraf become: true + +- name: Let telegraf do smart stats + lineinfile: + path: /etc/sudoers + line: "{{ telegraf_runas_user }} ALL=(ALL) NOPASSWD: /usr/sbin/smartctl" + become: true