diff --git a/scripts/configure-local-metrics-collection.sh b/scripts/configure-local-metrics-collection.sh new file mode 100755 index 000000000000..1b86f98b4050 --- /dev/null +++ b/scripts/configure-local-metrics-collection.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Configures prometheus and promtail to collect metrics and logs from +# a local node. + +API_PORT="${API_PORT:-9650}" + +LOGS_PATH="${LOGS_PATH:-${HOME}/.avalanchego/logs}" + +# Generate a uuid to uniquely identify the collected metrics +METRICS_UUID="$(uuidgen)" + +echo "Configuring metrics and log collection for a local node with API port ${API_PORT} and logs path ${LOGS_PATH}" + +PROMETHEUS_CONFIG_PATH="${HOME}/.tmpnet/prometheus/file_sd_configs" +PROMETHEUS_CONFIG_FILE="${PROMETHEUS_CONFIG_PATH}/local.json" +mkdir -p "${PROMETHEUS_CONFIG_PATH}" +cat > "${PROMETHEUS_CONFIG_FILE}" < "${PROMTAIL_CONFIG_FILE}" <