Update 'provision_env.sh'
This commit is contained in:
parent
033ac4d67d
commit
9f1e03254f
@ -3,6 +3,7 @@
|
|||||||
# Variables
|
# Variables
|
||||||
jwt=`http --verify=no POST https://192.168.10.1:9443/api/auth Username="adelorenzo" Password="Dimitri2014@" | jq '.jwt' | sed 's/^.//' | sed 's/.$//'`
|
jwt=`http --verify=no POST https://192.168.10.1:9443/api/auth Username="adelorenzo" Password="Dimitri2014@" | jq '.jwt' | sed 's/^.//' | sed 's/.$//'`
|
||||||
access="ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI="
|
access="ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI="
|
||||||
|
edge_group_id=`http --verify=no GET https://192.168.10.1:9443/api/endpoint_groups "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "edge" ) | .Id'`
|
||||||
temperature_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "temperature" ) | .ID'`
|
temperature_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "temperature" ) | .ID'`
|
||||||
speed_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "speed" ) | .ID'`
|
speed_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "speed" ) | .ID'`
|
||||||
pressure_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "pressure" ) | .ID'`
|
pressure_tag=`http --verify=no GET https://192.168.10.1:9443/api/tags "Authorization: Bearer $jwt" | jq -c '.[] | select( .Name == "pressure" ) | .ID'`
|
||||||
@ -27,7 +28,7 @@ for i in {160..199}; do pct exec 20$i -- bash -c "curl http://192.168.11.10/in
|
|||||||
for i in {00..39}
|
for i in {00..39}
|
||||||
do
|
do
|
||||||
temperature_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep temp-edge20$i | awk '{ print $2 }'`
|
temperature_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep temp-edge20$i | awk '{ print $2 }'`
|
||||||
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$temperature_endpoint\' --data \'{\"TagIds\": ["$temperature_tag"]}\, \"GroupID\":5}\' > tag_add.sh
|
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$temperature_endpoint\' --data \'{\"TagIds\": ["$temperature_tag"]\, \"GroupID\":"$edge_group_id"}\' > tag_add.sh
|
||||||
chmod +x ./tag_add.sh
|
chmod +x ./tag_add.sh
|
||||||
./tag_add.sh
|
./tag_add.sh
|
||||||
done
|
done
|
||||||
@ -35,7 +36,7 @@ done
|
|||||||
for i in {40..79}
|
for i in {40..79}
|
||||||
do
|
do
|
||||||
speed_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep speed-edge20$i | awk '{ print $2 }'`
|
speed_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep speed-edge20$i | awk '{ print $2 }'`
|
||||||
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$speed_endpoint\' --data \'{\"TagIds\": ["$speed_tag"]}\, \"GroupID\":5}\' > tag_add.sh
|
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$speed_endpoint\' --data \'{\"TagIds\": ["$speed_tag"]\, \"GroupID\":"$edge_group_id"}\' > tag_add.sh
|
||||||
chmod +x ./tag_add.sh
|
chmod +x ./tag_add.sh
|
||||||
./tag_add.sh
|
./tag_add.sh
|
||||||
done
|
done
|
||||||
@ -43,7 +44,7 @@ done
|
|||||||
for i in {80..119}
|
for i in {80..119}
|
||||||
do
|
do
|
||||||
pressure_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep pressure-edge20$i | awk '{ print $2 }'`
|
pressure_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep pressure-edge20$i | awk '{ print $2 }'`
|
||||||
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$pressure_endpoint\' --data \'{\"TagIds\": ["$pressure_tag"]}\, \"GroupID\":5}\' > tag_add.sh
|
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$pressure_endpoint\' --data \'{\"TagIds\": ["$pressure_tag"]\, \"GroupID\":"$edge_group_id"}\' > tag_add.sh
|
||||||
chmod +x ./tag_add.sh
|
chmod +x ./tag_add.sh
|
||||||
./tag_add.sh
|
./tag_add.sh
|
||||||
done
|
done
|
||||||
@ -51,7 +52,7 @@ done
|
|||||||
for i in {120..159}
|
for i in {120..159}
|
||||||
do
|
do
|
||||||
humidity_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep humidity-edge20$i | awk '{ print $2 }'`
|
humidity_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep humidity-edge20$i | awk '{ print $2 }'`
|
||||||
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$humidity_endpoint\' --data \'{\"TagIds\": ["$humidity_tag"]}\, \"GroupID\":5}\' > tag_add.sh
|
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$humidity_endpoint\' --data \'{\"TagIds\": ["$humidity_tag"]\, \"GroupID\":"$edge_group_id"}\' > tag_add.sh
|
||||||
chmod +x ./tag_add.sh
|
chmod +x ./tag_add.sh
|
||||||
./tag_add.sh
|
./tag_add.sh
|
||||||
done
|
done
|
||||||
@ -59,7 +60,7 @@ done
|
|||||||
for i in {160..199}
|
for i in {160..199}
|
||||||
do
|
do
|
||||||
power_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep power-edge20$i | awk '{ print $2 }'`
|
power_endpoint=`http --verify=no GET https://192.168.10.1:9443/api/endpoints "Authorization: Bearer $jwt" | jq -c '.[] | select( .Type == 4 ) | .Name,.Id' | paste - - | grep power-edge20$i | awk '{ print $2 }'`
|
||||||
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$power_endpoint\' --data \'{\"TagIds\": ["$power_tag"]}\, \"GroupID\":5}\' > tag_add.sh
|
echo curl --request PUT --insecure --write-out \"%{http_code}\" --header \'Content-Type: application/json\' --header \'x-api-key: ptr_wo8hpuQq7hgHa6m2HfNLzZdYiBw8ICuClCxPGva/ZTI=\' --url \'https://192.168.10.1:9443/api/endpoints/$power_endpoint\' --data \'{\"TagIds\": ["$power_tag"]\, \"GroupID\":"$edge_group_id"}\' > tag_add.sh
|
||||||
chmod +x ./tag_add.sh
|
chmod +x ./tag_add.sh
|
||||||
./tag_add.sh
|
./tag_add.sh
|
||||||
done
|
done
|
Loading…
Reference in New Issue
Block a user