2019-06-24 14:20:21 -05:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
2022-11-22 10:53:43 -06:00
|
|
|
# Wrapper for the grafana binary
|
|
|
|
# This file serves as a wrapper for the grafana binary. It ensures we set
|
2019-06-24 14:20:21 -05:00
|
|
|
# the system-wide Grafana configuration that was bundled with the package as we
|
|
|
|
# use the binary.
|
|
|
|
|
|
|
|
DEFAULT=/etc/default/grafana
|
|
|
|
|
2022-11-22 10:53:43 -06:00
|
|
|
GRAFANA_HOME="${GRAFANA_HOME:-/usr/share/grafana}"
|
|
|
|
|
2019-06-24 14:20:21 -05:00
|
|
|
CONF_DIR=/etc/grafana
|
|
|
|
DATA_DIR=/var/lib/grafana
|
|
|
|
PLUGINS_DIR=/var/lib/grafana/plugins
|
|
|
|
LOG_DIR=/var/log/grafana
|
|
|
|
|
|
|
|
CONF_FILE=$CONF_DIR/grafana.ini
|
|
|
|
PROVISIONING_CFG_DIR=$CONF_DIR/provisioning
|
|
|
|
|
2022-11-22 10:53:43 -06:00
|
|
|
EXECUTABLE="$GRAFANA_HOME/bin/grafana"
|
2019-06-24 14:20:21 -05:00
|
|
|
|
|
|
|
if [ ! -x $EXECUTABLE ]; then
|
2022-11-22 10:53:43 -06:00
|
|
|
echo "$EXECUTABLE not installed or not executable"
|
2019-06-24 14:20:21 -05:00
|
|
|
exit 5
|
|
|
|
fi
|
|
|
|
|
|
|
|
# overwrite settings from default file
|
|
|
|
if [ -f "$DEFAULT" ]; then
|
|
|
|
. "$DEFAULT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
OPTS="--homepath=${GRAFANA_HOME} \
|
|
|
|
--config=${CONF_FILE} \
|
|
|
|
--pluginsDir=${PLUGINS_DIR} \
|
|
|
|
--configOverrides='cfg:default.paths.provisioning=$PROVISIONING_CFG_DIR \
|
|
|
|
cfg:default.paths.data=${DATA_DIR} \
|
|
|
|
cfg:default.paths.logs=${LOG_DIR} \
|
|
|
|
cfg:default.paths.plugins=${PLUGINS_DIR}'"
|
|
|
|
|
2022-11-22 10:53:43 -06:00
|
|
|
CMD=cli
|
|
|
|
|
|
|
|
eval $EXECUTABLE "$CMD" "$OPTS" "$@"
|