grafana-cli 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /usr/bin/env bash
  2. # Wrapper for the grafana-cli binary
  3. # This file serves as a wrapper for the grafana-cli binary. It ensures we set
  4. # the system-wide Grafana configuration that was bundled with the package as we
  5. # use the binary.
  6. DEFAULT=/etc/default/grafana
  7. GRAFANA_HOME=/usr/share/grafana
  8. CONF_DIR=/etc/grafana
  9. DATA_DIR=/var/lib/grafana
  10. PLUGINS_DIR=/var/lib/grafana/plugins
  11. LOG_DIR=/var/log/grafana
  12. CONF_FILE=$CONF_DIR/grafana.ini
  13. PROVISIONING_CFG_DIR=$CONF_DIR/provisioning
  14. EXECUTABLE=$GRAFANA_HOME/bin/grafana-cli
  15. if [ ! -x $EXECUTABLE ]; then
  16. echo "Program not installed or not executable"
  17. exit 5
  18. fi
  19. # overwrite settings from default file
  20. if [ -f "$DEFAULT" ]; then
  21. . "$DEFAULT"
  22. fi
  23. OPTS="--homepath=${GRAFANA_HOME} \
  24. --config=${CONF_FILE} \
  25. --pluginsDir=${PLUGINS_DIR} \
  26. --configOverrides='cfg:default.paths.provisioning=$PROVISIONING_CFG_DIR \
  27. cfg:default.paths.data=${DATA_DIR} \
  28. cfg:default.paths.logs=${LOG_DIR} \
  29. cfg:default.paths.plugins=${PLUGINS_DIR}'"
  30. eval $EXECUTABLE "$OPTS" "$@"