Merge pull request #1 from mweibel/feature/influxdb-0.9
Update influxdb reporter to syntax of 0.9
This commit is contained in:
commit
817a19d4d8
|
@ -13,10 +13,7 @@ start () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$INFLUXDB_SEND_HOSTNAME" = true ]; then
|
if [ "$INFLUXDB_SEND_HOSTNAME" = true ]; then
|
||||||
__influxdb_columns="[\"value\",\"host\"]"
|
__influxdb_hostname="host=$(hostname)"
|
||||||
__influxdb_hostname=$(hostname)
|
|
||||||
else
|
|
||||||
__influxdb_columns="[\"value\"]"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,17 +21,12 @@ report () {
|
||||||
local metric=$1
|
local metric=$1
|
||||||
local value=$2
|
local value=$2
|
||||||
local points
|
local points
|
||||||
if [ "$INFLUXDB_SEND_HOSTNAME" = true ]; then
|
local data="$metric,$__influxdb_hostname value=$value"
|
||||||
points="[$value,\"$__influxdb_hostname\"]"
|
curl -s -X POST $INFLUXDB_API_ENDPOINT --data-binary "$data"
|
||||||
else
|
|
||||||
points="[$value]"
|
|
||||||
fi
|
|
||||||
local data="[{\"name\":\"$metric\",\"columns\":$__influxdb_columns,\"points\":[$points]}]"
|
|
||||||
curl -s -X POST $INFLUXDB_API_ENDPOINT -d $data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
docs () {
|
docs () {
|
||||||
echo "Send data to InfluxDB."
|
echo "Send data to InfluxDB."
|
||||||
echo "INFLUXDB_API_ENDPOINT=$INFLUXDB_API_ENDPOINT"
|
echo "INFLUXDB_API_ENDPOINT=$INFLUXDB_API_ENDPOINT"
|
||||||
echo "INFLUXDB_SEND_HOSTNAME=$INFLUXDB_SEND_HOSTNAME"
|
echo "INFLUXDB_SEND_HOSTNAME=$INFLUXDB_SEND_HOSTNAME"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue