hassio-zabbix-agent2/run.sh
Paolo Asperti 5b3ad999a4
All checks were successful
continuous-integration/drone/push Build is passing
initial import
2021-09-14 15:54:13 +02:00

23 lines
444 B
Bash

#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
CUSTOM_CFG_PATH=/share/zabbix-agent2
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
mkdir -p "$CUSTOM_CFG_PATH"
fi
echo "
Server=$SERVER
ServerActive=$SERVER
Hostname=$HOSTNAME
LogType=console
Include=${CUSTOM_CFG_PATH}/*.conf
" > /etc/zabbix/zabbix_agent2.conf
sudo -u zabbix zabbix_agent2 -f