Skip to content

Instantly share code, notes, and snippets.

@zshamrock
Last active December 15, 2016 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zshamrock/d859bc08e20b87b41c81c3053bbe8885 to your computer and use it in GitHub Desktop.
Save zshamrock/d859bc08e20b87b41c81c3053bbe8885 to your computer and use it in GitHub Desktop.
Generate default conf for TICK services
#!/usr/bin/env bash
. versions.sh
CONF_DIR=conf
TELEGRAF_CONF=${CONF_DIR}/telegraf.conf
INFLUXDB_CONF=${CONF_DIR}/influxdb.conf
CHRONOGRAF_CONF=${CONF_DIR}/chronograf.conf
KAPACITOR_CONF=${CONF_DIR}/kapacitor.conf
declare -A COMMANDS
COMMANDS["${TELEGRAF_CONF}"]="docker run --rm telegraf:${TELEGRAF_VERSION} -sample-config"
COMMANDS["${INFLUXDB_CONF}"]="docker run --rm influxdb:${INFLUXDB_VERSION} influxd config"
COMMANDS["${CHRONOGRAF_CONF}"]="docker run --rm docker pull quay.io/influxdb/chronograf:${CHRONOGRAF_VERSION} -sample-config"
COMMANDS["${KAPACITOR_CONF}"]="docker run --rm kapacitor:${KAPACITOR_VERSION} kapacitord config"
mkdir -p ${CONF_DIR}
for conf in "${TELEGRAF_CONF}" "${INFLUXDB_CONF}" "${CHRONOGRAF_CONF}" "${KAPACITOR_CONF}"; do
if [ ! -e ${conf} ]; then
echo "Generating ${conf}"
command=${COMMANDS[$conf]}
echo "Running '${command}'"
eval ${command} > ${conf}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment