-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrun.sh
31 lines (24 loc) · 753 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
SERVER="$1"
METADATA="$2"
HOST="$3"
if [ -z "$SERVER" ]; then
echo "Server address is missing"
exit 1
fi
if [ -z "$METADATA" ]; then
echo "Host metadata is missing"
exit 1
fi
if [ -z "$HOST" ]; then
MACHINEID=$(cat /etc/machine-id)
HOST="$METADATA-$MACHINEID"
fi
sed -i "s/^Server\=.*/Server\=$SERVER/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^ServerActive\=.*/ServerActive\=$SERVER/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^Hostname\=.*/Hostname\=$HOST/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/^HostMetadata\=.*/HostMetadata\=$METADATA/" /etc/zabbix/zabbix_agentd.conf
if [ -f "/etc/zabbix/$HOST.conf" ]; then
cat "/etc/zabbix/$HOST.conf" >> /etc/zabbix/zabbix_agentd.conf
fi
exec /usr/bin/supervisord