Commit 9fdda8ac by marwan

init flowengine grafana influxdb package

parent c784e986
......@@ -11,27 +11,22 @@ OrgID=''
LengthOrgID=0
while [ "$LengthOrgID" -ne 16 ]
do
sleep 1
orgInfo=$(influx org list --token $INFLUX_TOKEN --host $URI)
orgInfo=$(echo "$orgInfo" | sed -e 's/^[ \t]*//')
sleep 1
orgInfo=$(influx org list --token $INFLUX_TOKEN --host $URI)
orgInfo=$(echo "$orgInfo" | sed -e 's/^[ \t]*//')
#ID Name
#ae4907f2f6f4ac66 primary
name=''
while read -r line; do
echo $line
name=$(echo "$line" | awk '{print $2}' | sed 's/[^a-zA-Z0-9]//g')
echo $name
if [ "$ORG_NAME" == "$name" ]; then
OrgID=($(echo "$line" | awk '{print $1}'))
fi
done <<< "$(echo "$orgInfo" | awk 'NR > 1')"
LengthOrgID=${#OrgID}
#echo $LengthOrgID
#if [ "$LengthOrgID" -ne 16 ]; then
# echo cannot get orgID
# exit 0;
#fi
#ID Name
#ae4907f2f6f4ac66 primary
name=''
while read -r line; do
echo $line
name=$(echo "$line" | awk '{print $2}' | sed 's/[^a-zA-Z0-9]//g')
echo $name
if [ "$ORG_NAME" == "$name" ]; then
OrgID=($(echo "$line" | awk '{print $1}'))
fi
done <<< "$(echo "$orgInfo" | awk 'NR > 1')"
LengthOrgID=${#OrgID}
done
echo "OrgID: ${OrgID[@]}"
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
......
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