From d562826c569a7d8b0b3a26714f85bd6adedda6d4 Mon Sep 17 00:00:00 2001 From: jgaunt Date: Fri, 26 Feb 2021 11:17:54 -0500 Subject: [PATCH] added in sed to add the smartctl include path --- zabbix_agent.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zabbix_agent.sh b/zabbix_agent.sh index e3fce39..6f3e9e1 100644 --- a/zabbix_agent.sh +++ b/zabbix_agent.sh @@ -110,6 +110,10 @@ if [ $(grep -c "^Server=127.0.0.1" /etc/zabbix/zabbix_agentd.conf) -eq 1 ]; then # ask for the hostname read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" hostname + # set the include to add the smartctl config directory + # sed --in-place $'s/^# Hostname=/# Hostname=\\\nHostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf + sed --in-place $'s/^Include=\/etc\/zabbix\/zabbix_agentd.conf.d\/\*.conf/Include=\/etc\/zabbix\/zabbix_agentd.conf.d\/\*.conf\\\nInclude=\/etc\/zabbix\/zabbix_agentd.d\/\*.conf/' /etc/zabbix/zabbix_agentd.conf + # configure the hostname, check for older config and newer config if [ $(grep -c "^Hostname=Zabbix" /etc/zabbix/zabbix_agentd.conf) -eq 1 ]; then sed --in-place 's/^Hostname=Zabbix\ server/Hostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf