Commit a204788d by root

update bash script of influxdb

parent ebea94ec
......@@ -28,7 +28,20 @@ do
done <<< "$(echo "$orgInfo" | awk 'NR > 1')"
LengthOrgID=${#OrgID}
done
echo "OrgID: ${OrgID[@]}"
bucketInfo=$(influx bucket list --token $INFLUX_TOKEN --org $ORG_NAME --host $URI)
bucketInfo=$(echo "$bucketInfo" | sed -e 's/^[ \t]*//')
while read -r line; do
echo $line
name=$(echo "$line" | awk '{print $2}' )
echo $name
if [ "$BUCKET_NAME" == "$name" ]; then
echo this scripte is used.
exit 0
fi
done <<< "$(echo "$bucketInfo" | awk 'NR > 1')"
curl --request POST ${URI}/api/v2/buckets -H "Authorization: Token ${INFLUX_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"name\": \"${BUCKET_NAME}\", \"description\": \"A bucket holding air sensor data\", \"orgID\": \"${OrgID[@]}\", \"retentionRules\": [ { \"type\": \"expire\", \"everySeconds\": 15552000 } ] }" #2592000
output=$(influx bucket list --token $INFLUX_TOKEN --org $ORG_NAME --host $URI)
......@@ -75,8 +88,8 @@ echo "Shard Duration: ${ShardDuration[@]}"
echo "Organization ID: ${OrgID[@]}"
echo "Schema Type: ${SchemaType[@]}"
#echo curl -X POST http://localhost:8086/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"string\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }"
curl -X POST ${URI}/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"string\", \"type\": \"prometheus\", \"url\": \"http://localhost:8086/metrics\" }" -i
#echo curl -X POST http://localhost:8086/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"scraper_metrics\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }"
curl -X POST ${URI}/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"scraper_monitoring\", \"type\": \"prometheus\", \"url\": \"http://localhost:8086/metrics\" }" -i
echo ----success----
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment