Commit b87f375c by root

edit script influxdb

parent 4f7431b8
...@@ -28,7 +28,20 @@ do ...@@ -28,7 +28,20 @@ do
done <<< "$(echo "$orgInfo" | awk 'NR > 1')" done <<< "$(echo "$orgInfo" | awk 'NR > 1')"
LengthOrgID=${#OrgID} LengthOrgID=${#OrgID}
done done
echo "OrgID: ${OrgID[@]}" 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 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) output=$(influx bucket list --token $INFLUX_TOKEN --org $ORG_NAME --host $URI)
...@@ -76,7 +89,7 @@ echo "Organization ID: ${OrgID[@]}" ...@@ -76,7 +89,7 @@ echo "Organization ID: ${OrgID[@]}"
echo "Schema Type: ${SchemaType[@]}" 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\": \"scraper_metrics\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }" #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\": \"string\", \"type\": \"prometheus\", \"url\": \"http://localhost:8086/metrics\" }" -i 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---- 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