Skip to content

Instantly share code, notes, and snippets.

@mkol5222
Forked from avarabyeu/grafana_setup.sh
Created September 7, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkol5222/299b0b18a3b5de641a0cf19b9238de71 to your computer and use it in GitHub Desktop.
Save mkol5222/299b0b18a3b5de641a0cf19b9238de71 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