Update so-kibana-config-load

This commit is contained in:
weslambert
2020-03-23 23:23:04 -04:00
committed by GitHub
parent 1c153b9081
commit 1a44b744f7

View File

@@ -1,6 +1,24 @@
#!/bin/bash #!/bin/bash
VERSION="7.6.1" KIBANA_VERSION="7.6.1"
curl -X PUT "localhost:5601/api/saved_objects/config/$VERSION" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d' MAX_WAIT=60
# Check to see if Kibana is available
wait_step=0
until curl -s -XGET http://localhost:5601 > /dev/null ; do
wait_step=$(( ${wait_step} + 1 ))
echo "Waiting on Kibana...Attempt #$wait_step"
if [ ${wait_step} -gt ${MAX_WAIT} ]; then
echo "ERROR: Kibana not available for more than ${MAX_WAIT} seconds."
exit 5
fi
sleep 1s;
done
# Sleep additional JIC server is not ready
sleep 30s
# Load config
curl -X PUT "localhost:5601/api/saved_objects/config/$KIBANA_VERSION" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{ "attributes": { "attributes":
{ {
"defaultIndex": "2289a0c0-6970-11ea-a0cd-ffa0f6a1bc29", "defaultIndex": "2289a0c0-6970-11ea-a0cd-ffa0f6a1bc29",
@@ -12,6 +30,5 @@ curl -X PUT "localhost:5601/api/saved_objects/config/$VERSION" -H 'kbn-xsrf: tru
} }
}' }'
# Load saved objects
curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@/opt/so/saltstack/salt/kibana/saved_objects.ndjson curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@/opt/so/saltstack/salt/kibana/saved_objects.ndjson