teleport/assets/monitoring/grafana-import.sh
Andrew Lytvynov 8d7a217089 Run shellcheck during "make lint"
Shellcheck is a linter for shell scripts. Since we have quite a few of
those for release packaging and examples, we'll benefit from an extra
set of (robot) eyes.

Note: I disabled https://github.com/koalaman/shellcheck/wiki/Sc2086 to
make this PR smaller. That specific check is for the most frequent
mistake in our scripts - not quoting env var expansions. I'll do a
separate PR cleaning those up.

`build.assets/pkg` is no longer used and was removed.
2020-09-29 20:40:16 +00:00

25 lines
632 B
Bash
Executable file

#!/bin/bash
until curl --output /dev/null --silent --head --fail http://grafana:3000; do
echo 'waiting for grafana to respond'
sleep 5
done
echo "grafana is up setting up dashboards and data sources"
curl -s -H "Content-Type: application/json" \
-XPOST http://admin:admin@grafana:3000/api/datasources \
-d @- <<EOF
{
"name": "InfluxDB",
"type": "influxdb",
"access": "proxy",
"url": "http://influxdb:8086",
"database": "telegraf"
}
EOF
curl -X POST -d @/mnt/health-dashboard.json 'http://admin:admin@grafana:3000/api/dashboards/db' --header 'Content-Type: application/json'
echo "all done!"