solana/scripts/metrics-write-datapoint.sh

27 lines
616 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2018-08-27 09:13:53 -07:00
#
# Send a metrics datapoint
#
point=$1
if [[ -z $point ]]; then
echo "Data point not specified"
exit 1
fi
echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] Influx data point: $point"
if [[ -z $INFLUX_DATABASE || -z $INFLUX_USERNAME || -z $INFLUX_PASSWORD ]]; then
echo Influx user credentials not found
exit 0
fi
2022-01-11 20:23:15 -08:00
host="https://internal-metrics.solana.com:8086"
if [[ -n $INFLUX_HOST ]]; then
host="$INFLUX_HOST"
fi
echo "${host}/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \
| xargs curl --max-time 5 --silent --show-error -XPOST --data-binary "$point"
exit 0