Commit 68112143 authored by Ľubomír Kollár's avatar Ľubomír Kollár
Browse files

Merge branch 'Grafana' into 'master'

Grafana

See merge request tomas.gordon/hackathon-2021!5
parents b82cc2c8 d99d43fc
# http://editorconfig.org
root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
insert_final_newline = false
# IDEs
.idea/
.vscode/
/test.sh
# grafana
> Grafana Docker image for easy initialization of Grafana.
Docker-Hub image: [stefanwalther/grafana](https://hub.docker.com/r/stefanwalther/grafana/)
## Reference Links
The following resources helped me to create this solution
- [Rolling your own analytics dashboard with InfluxDB, Grafana and Docker](https://donagh.io/influxdb-grafana-dashboard/)
\ No newline at end of file
FROM grafana/grafana:4.6.4
RUN apt-get update && \
apt-get install -y curl gettext-base && \
rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
RUN rm -rf /var/lib/grafana/.init
ENTRYPOINT ["./entrypoint.sh"]
# -------------------------------------------------------------------
# Grafana options
# -------------------------------------------------------------------
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=birdie123
GF_USERS_DEFAULT_THEME=dark
GF_USERS_ALLOW_SIGN_UP=false
GF_USERS_ALLOW_ORG_CREATE=false
GF_AUTH_ANONYMOUS_ENABLED=true
GF_INSTALL_PLUGINS
\ No newline at end of file
This diff is collapsed.
{
"name": "InfluxDb",
"type": "influxdb",
"url": "http://localhost:8086",
"access": "direct",
"user": "$INFLUXDB_USER",
"password": "$INFLUXDB_PASSWORD",
"database": "$INFLUXDB_DB",
"basicAuth": false
}
{
"name": "InfluxDb",
"type": "influxdb",
"url": "http://influxdb:8086",
"access": "server",
"user": "admin",
"password": "birdie123",
"database": "db",
"basicAuth": false
}
{
"name": "Prometheus",
"type": "prometheus",
"url": "http://localhost:9090",
"access": "direct",
"basicAuth": false
}
# Sample file: https://github.com/grafana/grafana/blob/master/conf/sample.ini
instance_name: Intranet
#################################### Dashboard JSON files ##########################
[dashboards.json]
enabled = true
path = /var/lib/grafana/dashboards
......@@ -161,4 +161,4 @@ volumes:
mosquitto_data:
networks:
main:
\ No newline at end of file
main:
#!/usr/bin/env sh
url="http://$GF_SECURITY_ADMIN_USER:$GF_SECURITY_ADMIN_PASSWORD@localhost:3000"
post() {
curl -s -X POST -d "$1" \
-H 'Content-Type: application/json;charset=UTF-8' \
"$url$2" 2> /dev/null
}
if [ ! -f "/var/lib/grafana/.init" ]; then
exec /run.sh $@ &
until curl -s "$url/api/datasources" 2> /dev/null; do
echo "Waiting for the URL to be available: $url"
sleep 1
done
for datasource in /etc/grafana/datasources/*; do
echo installed $datasource;
post "$(envsubst < $datasource)" "/api/datasources"
done
# for dashboard in /etc/grafana/dashboards/*; do
# post "$(cat $dashboard)" "/api/dashboards/db"
# done
touch "/var/lib/grafana/.init"
kill $(pgrep grafana)
fi
exec /run.sh $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment