test.sh 613 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. #
  3. # Test local metrics by sending a airdrop datapoint
  4. #
  5. set -e
  6. cd "$(dirname "$0")"
  7. # shellcheck source=metrics/scripts/enable.sh
  8. source ./enable.sh
  9. if [[ -z $INFLUX_DATABASE || -z $INFLUX_USERNAME || -z $INFLUX_PASSWORD ]]; then
  10. echo Influx user credentials not found
  11. exit 0
  12. fi
  13. host="https://localhost:8086"
  14. if [[ -n $INFLUX_HOST ]]; then
  15. host="$INFLUX_HOST"
  16. fi
  17. set -x
  18. point="faucet-airdrop,localmetrics=test request_amount=1i,request_current=1i"
  19. echo "${host}/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p={$INFLUX_PASSWORD}" \
  20. | xargs curl -XPOST --data-binary "$point"