add influxdb feature
All checks were successful
build container icinga2 / build (push) Successful in 2m31s
All checks were successful
build container icinga2 / build (push) Successful in 2m31s
This commit is contained in:
24
init.sh
24
init.sh
@@ -3,6 +3,7 @@
|
|||||||
ICINGA2_FILE_API_CONF=/etc/icinga2/features-enabled/api.conf
|
ICINGA2_FILE_API_CONF=/etc/icinga2/features-enabled/api.conf
|
||||||
ICINGA2_FILE_API_USER_CONF=/etc/icinga2/conf.d/api-users.conf
|
ICINGA2_FILE_API_USER_CONF=/etc/icinga2/conf.d/api-users.conf
|
||||||
ICINGA2_FILE_ICINGADB_CONF=/etc/icinga2/features-enabled/icingadb.conf
|
ICINGA2_FILE_ICINGADB_CONF=/etc/icinga2/features-enabled/icingadb.conf
|
||||||
|
ICINGA2_FILE_INFLUXDB_CONF=/etc/icinga2/features-enabled/influx.conf
|
||||||
|
|
||||||
## init icinga config files if need
|
## init icinga config files if need
|
||||||
if [ -z "$(ls -A /data)" ]; then
|
if [ -z "$(ls -A /data)" ]; then
|
||||||
@@ -39,7 +40,7 @@ if [ ! -f "$ICINGA2_FILE_ICINGADB_CONF" ]; then
|
|||||||
/usr/sbin/icinga2 feature enable icingadb
|
/usr/sbin/icinga2 feature enable icingadb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## replace redis conf is env vars set (anytime)
|
## icingadb: replace redis conf is env vars set (anytime)
|
||||||
if [ ! -z "$ICINGA2_ICINGADB_REDIS_HOST" ]; then
|
if [ ! -z "$ICINGA2_ICINGADB_REDIS_HOST" ]; then
|
||||||
echo set new redis host
|
echo set new redis host
|
||||||
sed -i "s|\(//\)*host = \".*\"|host = \"$ICINGA2_ICINGADB_REDIS_HOST\"|g" $ICINGA2_FILE_ICINGADB_CONF
|
sed -i "s|\(//\)*host = \".*\"|host = \"$ICINGA2_ICINGADB_REDIS_HOST\"|g" $ICINGA2_FILE_ICINGADB_CONF
|
||||||
@@ -53,5 +54,26 @@ if [ ! -z "$ICINGA2_ICINGADB_REDIS_PASS" ]; then
|
|||||||
sed -i "s|\(//\)*password = \".*\"|password = \"$ICINGA2_ICINGADB_REDIS_PASS\"|g" $ICINGA2_FILE_ICINGADB_CONF
|
sed -i "s|\(//\)*password = \".*\"|password = \"$ICINGA2_ICINGADB_REDIS_PASS\"|g" $ICINGA2_FILE_ICINGADB_CONF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## enable icingadb feature if not active
|
||||||
|
if [ ! -f "$ICINGA2_FILE_INFLUXDB_CONF" ]; then
|
||||||
|
echo enable influxdb
|
||||||
|
/usr/sbin/icinga2 feature enable influxdb
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$ICINGA2_INFLUXDB_HOST" ]; then
|
||||||
|
echo set new influxdb host
|
||||||
|
sed -i "s|\(//\)*host = \".*\"|host = \"$ICINGA2_INFLUXDB_PASS\"|g" $ICINGA2_FILE_INFLUXDB_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$ICINGA2_INFLUXDB_PORT" ]; then
|
||||||
|
echo set new influxdb port
|
||||||
|
sed -i "s|\(//\)*port = \".*\"|port = $ICINGA2_INFLUXDB_PORT|g" $ICINGA2_FILE_INFLUXDB_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$ICINGA2_INFLUXDB_DB" ]; then
|
||||||
|
echo set new influxdb database
|
||||||
|
sed -i "s|\(//\)*database = \".*\"|database = \"$ICINGA2_INFLUXDB_DB\"|g" $ICINGA2_FILE_INFLUXDB_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
# run CMD
|
# run CMD
|
||||||
exec "$@"
|
exec "$@"
|
||||||
Reference in New Issue
Block a user