status.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. #
  3. # Checks the status of local metrics
  4. #
  5. set -e
  6. cd "$(dirname "$0")"
  7. if [[ ! -f lib/config.sh ]]; then
  8. echo "Run start.sh first"
  9. exit 1
  10. fi
  11. # shellcheck source=/dev/null
  12. source lib/config.sh
  13. : "${INFLUXDB_ADMIN_USER:?}"
  14. : "${INFLUXDB_ADMIN_PASSWORD:?}"
  15. : "${INFLUXDB_WRITE_USER:?}"
  16. : "${INFLUXDB_WRITE_PASSWORD:?}"
  17. (
  18. set -x
  19. docker ps --no-trunc --size
  20. )
  21. curl_head() {
  22. curl --retry 5 --retry-delay 2 --retry-connrefused -v --head "$1"
  23. }
  24. if ! curl_head http://localhost:8086/ping; then
  25. echo Error: InfluxDB not running
  26. exit 1
  27. fi
  28. if ! curl_head http://localhost:3000; then
  29. echo Error: Grafana not running
  30. exit 1
  31. fi
  32. cat <<EOF
  33. =========================================================================
  34. * Grafana url: http://localhost:3000/dashboards
  35. username: $INFLUXDB_ADMIN_USER
  36. password: $INFLUXDB_ADMIN_PASSWORD
  37. * Enable metric collection per shell by running:
  38. export SOLANA_METRICS_CONFIG="host=http://localhost:8086,db=testnet,u=$INFLUXDB_WRITE_USER,p=$INFLUXDB_WRITE_PASSWORD"
  39. EOF