You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docker-grafana/collectd/root/entrypoint.sh

45 lines
1.4 KiB

3 years ago
#!/bin/sh
# Exit at first error
set -e
3 years ago
CONFIG_DIR=/srv/collectd/config
TEMPLATES_DIR="/srv/collectd/templates"
3 years ago
3 years ago
mkdir -p "${CONFIG_DIR}"
3 years ago
3 years ago
echo "Generating '/srv/collectd/templates/collectd.conf.template'..."
cat "${TEMPLATES_DIR}/collectd.conf.template.base.part" > \
"${TEMPLATES_DIR}/collectd.conf.template"
if [ "${P_NETWORK_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.network.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
if [ "${P_PYTHON_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.python.start.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
if [ "${P_PYTHON_FRITZ_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.python.fritz.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
cat "${TEMPLATES_DIR}/collectd.plugin.python.end.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
if [ "${P_WGRAPHITE_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.write_graphite.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
# Fill the varibles in collectd.conf.template and put the result in collectd.conf
echo "Generating '${CONFIG_DIR}/collectd.conf'..."
envsubst < /srv/collectd/templates/collectd.conf.template > \
"${CONFIG_DIR}/collectd.conf"
3 years ago
echo "Starting collectd..."
3 years ago
collectd -C "${CONFIG_DIR}/collectd.conf" -f