Commit 9fdda8ac by marwan

init flowengine grafana influxdb package

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