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.
44 lines
1.4 KiB
44 lines
1.4 KiB
#!/bin/sh
|
|
|
|
# Exit at first error
|
|
set -e
|
|
|
|
CONFIG_DIR=/srv/collectd/config
|
|
TEMPLATES_DIR="/srv/collectd/templates"
|
|
|
|
mkdir -p "${CONFIG_DIR}"
|
|
|
|
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"
|
|
echo "Starting collectd..."
|
|
collectd -C "${CONFIG_DIR}/collectd.conf" -f
|
|
|