4NK_node/scripts/install_grafana_local.sh
Debian 5c60af349d
Some checks failed
CI - 4NK_node / Security Tests (push) Failing after 27s
CI - 4NK_node / Documentation Tests (push) Failing after 3s
CI - 4NK_node / Security Audit (push) Successful in 3s
CI - 4NK_node / Release Guard (push) Has been skipped
CI - 4NK_node / Performance Tests (push) Successful in 27s
CI - 4NK_node / Notify (push) Failing after 1s
CI - 4NK_node / Publish Release (push) Has been skipped
CI - 4NK_node / Code Quality (push) Failing after 30s
CI - 4NK_node / Unit Tests (push) Failing after 29s
CI - 4NK_node / Integration Tests (push) Failing after 33s
CI - 4NK_node / Docker Build & Test (push) Failing after 10s
feat(config): centralize restart config; add conf/restart_config.conf; adapt restart script; add skeleton external_nodes.conf; update README
2025-09-04 19:44:15 +00:00

62 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "[Grafana setup] starting local Grafana and Loki/Promtail integration"
# Install Grafana if not present
if ! command -v grafana-server >/dev/null 2>&1; then
echo "Grafana not found. Please install Grafana manually or enable the apt repository and run this script again."
exit 1
fi
echo "Grafana is installed. Ensuring service is running..."
sudo systemctl enable grafana-server
sudo systemctl start grafana-server || true
echo "Grafana service status:"
sudo systemctl is-active grafana-server || true
# Try to install Loki/Promtail if helper script exists
HELPER="/home/debian/code/4NK_dev/4NK_node/scripts/install_loki_promtail_local.sh"
if [ -x "$HELPER" ]; then
echo "Running Loki/Promtail installer..."
bash "$HELPER"
else
echo "No Loki/Promtail installer found at $HELPER; skipping."
fi
echo "[Grafana setup] completed."
#!/usr/bin/env bash
set -euo pipefail
echo "[ Grafana setup ]: starting local Grafana installation and Loki/Promtail integration"
# Install Grafana if not present
if ! command -v grafana-server >/dev/null 2>&1; then
echo "Installing Grafana..."
sudo apt-get update
sudo apt-get install -y software-properties-common wget apt-transport-https
wget -q -O - https://packages.grafana.com/grafana.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install -y grafana
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
else
echo "Grafana is already installed."
fi
echo "[ Grafana setup ]: Grafana service status ready."
# Try to install Loki/Promtail using existing helper script if present
if [ -x "/home/debian/code/4NK_dev/4NK_node/scripts/install_loki_promtail_local.sh" ]; then
echo "Running Loki/Promtail installer..."
bash /home/debian/code/4NK_dev/4NK_node/scripts/install_loki_promtail_local.sh
else
echo "Loki/Promtail installer script not found; skipping. Please install Loki/Promtail manually if needed."
fi
echo "[ Grafana setup ]: completed."