mirror of
https://github.com/pstadler/metrics.sh.git
synced 2025-02-28 22:09:11 -05:00
19 lines
392 B
Bash
19 lines
392 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
init () {
|
||
|
if [ -z $INFLUXDB_API_ENDPOINT ]; then
|
||
|
echo "Error: influxdb requires \$INFLUXDB_API_ENDPOINT to be set"
|
||
|
exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
report () {
|
||
|
local METRIC=$1
|
||
|
local VALUE=$2
|
||
|
curl -X POST -d "[{\"name\":\"$METRIC\",\"columns\":[\"value\"],\"points\":[[$VALUE]]}]" $INFLUXDB_API_ENDPOINT
|
||
|
}
|
||
|
|
||
|
docs () {
|
||
|
echo "Send data to InfluxDB."
|
||
|
echo "\$INFLUXDB_API_ENDPOINT="
|
||
|
}
|