hassio-addons/zabbix-agent/run.sh

23 lines
443 B
Bash
Raw Normal View History

2019-03-19 18:16:52 +00:00
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
2019-03-20 08:42:28 +00:00
CUSTOM_CFG_PATH=/share/zabbix-agent
2019-03-19 18:16:52 +00:00
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
2019-03-20 08:13:18 +00:00
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
mkdir -p "$CUSTOM_CFG_PATH"
2019-03-19 21:05:09 +00:00
fi
2019-03-19 18:16:52 +00:00
echo "
Server=$SERVER
ServerActive=$SERVER
Hostname=$HOSTNAME
LogType=console
2019-03-20 08:13:18 +00:00
Include=${CUSTOM_CFG_PATH}/*.conf
2019-03-19 18:16:52 +00:00
" > /etc/zabbix/zabbix_agentd.conf
sudo -u zabbix zabbix_agentd -f