Clean format
This commit is contained in:
parent
ae70c60700
commit
0ce43a7e50
34
grafana.sh
34
grafana.sh
|
@ -133,7 +133,6 @@ sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI
|
||||||
sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI
|
sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI
|
||||||
sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI
|
sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI
|
||||||
systemctl restart grafana-server
|
systemctl restart grafana-server
|
||||||
systemctl status grafana-server
|
|
||||||
|
|
||||||
if [ -f $WS_CONF ]; then
|
if [ -f $WS_CONF ]; then
|
||||||
sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF
|
sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF
|
||||||
|
@ -149,11 +148,12 @@ fi
|
||||||
echo "
|
echo "
|
||||||
# Setup Grafana credentials.
|
# Setup Grafana credentials.
|
||||||
"
|
"
|
||||||
curl -X PUT -H "Content-Type: application/json" -d "{
|
curl -X PUT -H "Content-Type: application/json;charset=UTF-8" -d \
|
||||||
|
"{
|
||||||
\"oldPassword\": \"admin\",
|
\"oldPassword\": \"admin\",
|
||||||
\"newPassword\": \"$GRAFANA_PASS\",
|
\"newPassword\": \"$GRAFANA_PASS\",
|
||||||
\"confirmNew\": \"$GRAFANA_PASS\"
|
\"confirmNew\": \"$GRAFANA_PASS\"
|
||||||
}" http://admin:admin@localhost:3000/api/user/password
|
}" http://admin:admin@localhost:3000/api/user/password; echo ""
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Create InfluxDB datasource
|
# Create InfluxDB datasource
|
||||||
|
@ -161,13 +161,13 @@ echo "
|
||||||
curl -X \
|
curl -X \
|
||||||
POST -H 'Content-Type: application/json;charset=UTF-8' -d \
|
POST -H 'Content-Type: application/json;charset=UTF-8' -d \
|
||||||
'{
|
'{
|
||||||
"name":"InfluxDB",
|
"name": "InfluxDB",
|
||||||
"type":"influxdb",
|
"type": "influxdb",
|
||||||
"url":"http://localhost:8086",
|
"url": "http://localhost:8086",
|
||||||
"access":"proxy",
|
"access": "proxy",
|
||||||
"isDefault":true,
|
"isDefault": true,
|
||||||
"database":"jitsi"
|
"database": "jitsi"
|
||||||
}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources
|
}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources; echo ""
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Add Grafana Dashboard
|
# Add Grafana Dashboard
|
||||||
|
@ -181,10 +181,16 @@ for d in "${ds[@]}"; do
|
||||||
j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json)
|
j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json)
|
||||||
curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \
|
curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"dashboard\":$j,\"overwrite\":true, \
|
-d "{
|
||||||
\"inputs\":[{\"name\":\"DS_INFLUXDB\",\"type\":\"datasource\", \
|
\"dashboard\": $j,
|
||||||
\"pluginId\":\"influxdb\",\"value\":\"$grafana_datasource\"}]}" \
|
\"overwrite\": true,
|
||||||
$grafana_host/api/dashboards/import; echo ""
|
\"inputs\": [{
|
||||||
|
\"name\": \"DS_INFLUXDB\",
|
||||||
|
\"type\": \"datasource\",
|
||||||
|
\"pluginId\": \"influxdb\",
|
||||||
|
\"value\": \"$grafana_datasource\"
|
||||||
|
}]
|
||||||
|
}" $grafana_host/api/dashboards/import; echo ""
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
|
Loading…
Reference in New Issue