Add systemctl status to allow grafana be ready
(cherry picked from commit c9606959ca
)
This commit is contained in:
parent
57f9a5fe1d
commit
67491720eb
10
grafana.sh
10
grafana.sh
|
@ -145,6 +145,7 @@ 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
|
||||||
|
@ -160,17 +161,18 @@ fi
|
||||||
echo "
|
echo "
|
||||||
# Setup Grafana credentials.
|
# Setup Grafana credentials.
|
||||||
"
|
"
|
||||||
curl -X PUT -H "Content-Type: application/json;charset=UTF-8" -d \
|
curl -k -u "admin:admin" -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; echo ""
|
}" http://localhost:3000/api/user/password; echo ""
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
# Create InfluxDB datasource
|
# Create InfluxDB datasource
|
||||||
"
|
"
|
||||||
curl -s -k -u "admin:$GRAFANA_PASS" -X \
|
curl -k -u "admin:$GRAFANA_PASS" -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",
|
||||||
|
@ -191,7 +193,7 @@ ds=(11969);
|
||||||
for d in "${ds[@]}"; do
|
for d in "${ds[@]}"; do
|
||||||
echo -n "Processing $d: "
|
echo -n "Processing $d: "
|
||||||
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 -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{
|
-d "{
|
||||||
\"dashboard\": $j,
|
\"dashboard\": $j,
|
||||||
|
|
Loading…
Reference in New Issue