From 002c19f3adf50d7ab5f872141390a5014e633018 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Sun, 4 Dec 2022 15:17:43 +0100 Subject: [PATCH] telegraf: Add parameter to enable ZFS stats Previous templates used the assumptioon, that FreeBSD will always have ZFS and nothing else. --- README.md | 1 + defaults/main.yml | 1 + templates/telegraf.conf.j2 | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5aa0a5..3edce1e 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Telegraf is configured with basic host telemetry by default. You can add more fe - `telegraf_docker_file`: filename of the docker telegraf config part in `{{role_path}}/templates` (default `telegraf-docker.conf`). - `telegraf_unifi_file`: filename of the SNMP telegraf config part in `{{role_path}}/templates` (default `telegraf-UniFi.conf.j2`). - `telegraf_airmax_file`: filename of the SNMP telegraf config part in `{{role_path}}/templates` (default `telegraf-AirMAX.conf.j2`). +- `telegraf_enable_zfs`: gather ZFS stats (default `false`). Optional settings: - `telegraf_interval`: Data sampling interval (default `300s`) diff --git a/defaults/main.yml b/defaults/main.yml index dd8bbc9..d14eedc 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -9,6 +9,7 @@ telegraf_interval: "300s" telegraf_docker_file: "telegraf-docker.conf" telegraf_unifi_file: "telegraf-UniFi.conf.j2" telegraf_airmax_file: "telegraf-AirMAX.conf.j2" +telegraf_enable_zfs: false exim_etc_mailname: "{{ inventory_hostname }}" exim_skip_install: false diff --git a/templates/telegraf.conf.j2 b/templates/telegraf.conf.j2 index 851902e..1ecd65a 100644 --- a/templates/telegraf.conf.j2 +++ b/templates/telegraf.conf.j2 @@ -84,7 +84,7 @@ name_override = "cpu_temp" {% endif %} -{% if ((override_os_family is defined) | ternary(override_os_family,ansible_os_family)) == 'FreeBSD' %} +{% if telegraf_enable_zfs %} # Read metrics of ZFS from arcstats, zfetchstats, vdev_cache_stats, and pools [[inputs.zfs]] ## By default, telegraf gather all zfs stats