From e9f44d8d03c5c8590fba5b2850fab1c419a6b181 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 27 Nov 2019 09:45:47 +0100 Subject: [PATCH] Detect if running >= 4.4, and remove vfs.dev.discovery UserParameter in this case --- createlinks | 2 +- .../zabbix_agentd.conf.d/block_devices.conf/10All | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf.d/block_devices.conf/10All diff --git a/createlinks b/createlinks index 3b1448c..1f02030 100644 --- a/createlinks +++ b/createlinks @@ -7,7 +7,7 @@ foreach my $conf (qw!zabbix_agentd.conf zabbix_agentd.conf.d/asterisk.conf zabbix_agentd.conf.d/deprecated_cpunum.conf zabbix_agentd.conf.d/deprecated_memory.conf zabbix_agentd.conf.d/deprecated_netstat.conf zabbix_agentd.conf.d/deprecated_swap.conf zabbix_agentd.conf.d/extip.conf zabbix_agentd.conf.d/mail.conf zabbix_agentd.conf.d/mysql.conf - zabbix_agentd.conf.d/phpki_certs.conf zabbix_agentd.conf.d/samba.conf!){ + zabbix_agentd.conf.d/phpki_certs.conf zabbix_agentd.conf.d/samba.conf zabbix_agentd.conf.d/block_devices.conf!){ templates2events("/etc/zabbix/$conf", qw(zabbix-agent-update bootstrap-console-save)); } templates2events("/etc/sudoers", "zabbix-agent-update"); diff --git a/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf.d/block_devices.conf/10All b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf.d/block_devices.conf/10All new file mode 100644 index 0000000..634166c --- /dev/null +++ b/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf.d/block_devices.conf/10All @@ -0,0 +1,13 @@ +{ + $OUT = ''; + qx(zabbix_agentd -t vfs.dev.discovery -c /dev/null | grep -q ZBX_NOTSUPPORTED); + if ($? != 0){ + $OUT .= '# vfs.dev.discovery is natively supported, not UserParameter needed'; + } else{ + $OUT .=<<'_EOF'; +# Discover block devices +UserParameter=vfs.dev.discovery,/var/lib/zabbix/bin/disco_block_devices +_EOF + } +} +