|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« Grafana - Visualisierungen |

Grafana wird genutzt, um Informationen von Anwendungen zu sammeln und diese zu visualisieren. Die Daten können von Prometheus eingesammelt werden und dann durch Prometheus an Grafana geschickt werden.
Über diesen Link gelangt man zur Download-Seite von Grafana. Die eigentliche Installation ist unproblematisch.
Nun noch die Information, wie grafana als Unterseite angesprochen werden sollte:
https://<name>.ddns.net/grafana
grafana sollte nicht mehr global erreichbar sein, sondern lediglich über einen proxy. grafana lauscht daher nur noch auf der 127.0.0.1. grafana ist auf dem gleichen Rechner installiert wie Prometheus
Ich wollte grafana als Unterseite in meine Domain einbinden unter Apache - und da ist nicht mehr ganz so trivial. Die diversen KI Bots legen sich die Backen, die offizielle Dokumentation ist falsch - aber es gab ein BLOG-Post, das die Lösung aufzeigte.
Zuerst der entsprechende Abschnitt in der Konfigurationsdatei von grafana (/etc/grafana/grafana.ini):
[server]
# Protocol (http, https, h2, socket, socket_h2)
;protocol = http
# Minimum TLS version allowed. By default, this value is empty. Accepted values are: TLS1.2, TLS1.3. If nothing is set TLS1.2 would be taken
;min_tls_version = ""
# The ip address to bind to, empty will bind to all interfaces
http_addr = 127.0.0.1
# The http port to use
;http_port = 3000
# The public facing domain name used to access grafana from a browser
;domain = localhost
# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false
# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = https://<name>.ddns.net/grafana/
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
;serve_from_sub_path = false
Und dann noch der Eintrag in der host-config-Datei unter Apache:
#
# Grafana als Unterseite
#
ProxyPreserveHost On
ProxyPass /grafana/api/live/ http://localhost:3000/api/live/ upgrade=websocket
ProxyPass /grafana/ http://localhost:3000/
ProxyPassReverse /grafana/ http://localhost:3000/
Wenn man Grafana geöffnet hat, sollte man als erstes den Prometheus Server eintragen, damit man eine Datenquelle hat. Da Prometheus auf dem gleichen Rechner installiert ist, kann man einfach "http://localhost:9090" als Datenquelle angeben.
Und dann kann der Spaß mit den Dashboards losgehen.