hassio-addons/zabbix-agent/run.sh

23 lines
441 B
Bash
Raw Normal View History

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