first commit
This commit is contained in:
56
data/setup/build/04_configure_grafana.sh
Normal file
56
data/setup/build/04_configure_grafana.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat > /tmp/grafana_check.sh << EOF
|
||||
curl -k \
|
||||
-X GET "http://grafana:3000/api/datasources" \
|
||||
-u 'admin:vagrant' \
|
||||
-H "content-type:application/json" \
|
||||
| grep '"name":"OpenSearch"'
|
||||
EOF
|
||||
|
||||
cat > /tmp/grafana_initial_setup.sh << EOF
|
||||
curl -k \
|
||||
-X POST "http://grafana:3000/api/datasources" \
|
||||
-u 'admin:vagrant' \
|
||||
-H "content-type:application/json" \
|
||||
-d '
|
||||
{
|
||||
"orgId": 1,
|
||||
"name": "OpenSearch",
|
||||
"type": "grafana-opensearch-datasource",
|
||||
"typeName": "OpenSearch",
|
||||
"typeLogoUrl": "public/plugins/grafana-opensearch-datasource/img/logo.svg",
|
||||
"access": "proxy",
|
||||
"url": "https://opensearch-node1:9200",
|
||||
"basicAuth": true,
|
||||
"basicAuthUser": "admin",
|
||||
"isDefault": true,
|
||||
"secureJsonData": {
|
||||
"basicAuthPassword": "vagrant"
|
||||
},
|
||||
"jsonData": {
|
||||
"database": "logstash-*",
|
||||
"esVersion": "8.0.0",
|
||||
"flavor": "opensearch",
|
||||
"logLevelField": "fields.level",
|
||||
"logMessageField": "message",
|
||||
"maxConcurrentShardRequests": 5,
|
||||
"pplEnabled": true,
|
||||
"timeField": "@timestamp",
|
||||
"tlsAuthWithCACert": false,
|
||||
"tlsSkipVerify": true,
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"readOnly": false
|
||||
}
|
||||
'
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/grafana*.sh
|
||||
|
||||
until "/tmp/grafana_check.sh" ; do
|
||||
echo "Grafana settings not applied; retrying"
|
||||
/tmp/grafana_initial_setup.sh
|
||||
sleep 10
|
||||
done
|
||||
echo "Grafana settings applied"
|
||||
Reference in New Issue
Block a user