updated sed to work with hostname and ip address for server

This commit is contained in:
2021-04-25 10:58:25 -04:00
parent b62202fdba
commit 1bc0f8b3d4

View File

@@ -121,9 +121,9 @@ if [ $(grep -c "^Server=127.0.0.1" /etc/zabbix/zabbix_agentd.conf) -eq 1 ]; then
sed --in-place $'s/^# Hostname=/# Hostname=\\\nHostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf sed --in-place $'s/^# Hostname=/# Hostname=\\\nHostname='${hostname}'/' /etc/zabbix/zabbix_agentd.conf
fi fi
# configure the zabbix server # configure the zabbix server
sed --in-place 's/^Server=127.0.0.1/Server='${ZABBIX_SERVER}'/' /etc/zabbix/zabbix_agentd.conf sed --in-place 's/^Server=127.0.0.1/Server='"${ZABBIX_SERVER}"'/' /etc/zabbix/zabbix_agentd.conf
# configure the zabbix server # configure the zabbix server
sed --in-place 's/^ServerActive=127.0.0.1/ServerActive='${ZABBIX_SERVER}'/' /etc/zabbix/zabbix_agentd.conf sed --in-place 's/^ServerActive=127.0.0.1/ServerActive='"${ZABBIX_SERVER}"'/' /etc/zabbix/zabbix_agentd.conf
# configure the encryption # configure the encryption
sed --in-place $'s/^# TLSAccept=unencrypted/# TLSAccept=unencrypted\\\nTLSAccept=psk/' /etc/zabbix/zabbix_agentd.conf sed --in-place $'s/^# TLSAccept=unencrypted/# TLSAccept=unencrypted\\\nTLSAccept=psk/' /etc/zabbix/zabbix_agentd.conf
sed --in-place $'s/^# TLSConnect=unencrypted/# TLSConnect=unencrypted\\\nTLSConnect=psk/' /etc/zabbix/zabbix_agentd.conf sed --in-place $'s/^# TLSConnect=unencrypted/# TLSConnect=unencrypted\\\nTLSConnect=psk/' /etc/zabbix/zabbix_agentd.conf