Skip to content

Instantly share code, notes, and snippets.

@avarabyeu
Created August 28, 2017 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save avarabyeu/ab213787ff4a24fa50a1fc154c8f213a to your computer and use it in GitHub Desktop.
Save avarabyeu/ab213787ff4a24fa50a1fc154c8f213a to your computer and use it in GitHub Desktop.
grafana_setup.sh
#!/bin/bash
./run.sh "${@}" &
timeout 10 bash -c "until </dev/tcp/localhost/3000; do sleep 1; done"
curl -s -H "Content-Type: application/json" \
-XPOST http://admin:admin@localhost:3000/api/datasources \
-d @- <<EOF
{
"name": "influx",
"type": "influxdb",
"access": "proxy",
"url": "http://${INFLUX_HOST}:${INFLUX_PORT}",
"database": "my_existing_db"
}
EOF
pkill grafana-server
timeout 10 bash -c "while </dev/tcp/localhost/3000; do sleep 1; done"
exec ./run.sh "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment