2018-11-11 08:19:04 -08:00
|
|
|
#!/usr/bin/env bash
|
2018-08-27 09:13:53 -07:00
|
|
|
#
|
|
|
|
# Send a metrics datapoint
|
|
|
|
#
|
2018-07-21 23:15:36 -07:00
|
|
|
|
|
|
|
point=$1
|
|
|
|
if [[ -z $point ]]; then
|
|
|
|
echo "Data point not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Influx data point: $point"
|
|
|
|
if [[ -z $INFLUX_DATABASE || -z $INFLUX_USERNAME || -z $INFLUX_PASSWORD ]]; then
|
|
|
|
echo Influx user credentials not found
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-03-29 11:47:36 -07:00
|
|
|
host="https://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}" \
|
2018-08-01 15:23:36 -07:00
|
|
|
| xargs curl --max-time 5 -XPOST --data-binary "$point"
|
2019-01-16 08:42:49 -08:00
|
|
|
exit 0
|