Grafana: Difference between revisions

From NixOS Wiki
imported>Exyi
Created page with "[https://grafana.com/ Grafana] is an open-source, general purpose dashboarding tool, which runs as a web application. It can be used to create a variety of time-series graphs..."
 
imported>PaulGrandperrin
m fix proxyPath url, a slash was missing at the end causing redirection loop
Line 25: Line 25:
     enableACME = true;
     enableACME = true;
     locations."/grafana/" = {
     locations."/grafana/" = {
         proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
         proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}/";
         proxyWebsockets = true;
         proxyWebsockets = true;
     };
     };

Revision as of 12:30, 6 October 2022

Grafana is an open-source, general purpose dashboarding tool, which runs as a web application. It can be used to create a variety of time-series graphs and also for displaying logs. It supports Prometheus, graphite, InfluxDB, opentsdb, Grafana Loki, PostgreSQL and many other data sources.

See Grafana options

Installation

Grafana is available as NixOS module, it can be enabled using the following config:

services.grafana = {
      enable = true;
      # Listening address and TCP port
      addr = "127.0.0.1";
      port = 3000;
      # Grafana needs to know on which domain and URL it's running:
      domain = "your.domain";
      rootUrl = "https://your.domain/grafana/"; # Not needed if it is `https://your.domain/`
};

This will make Grafana available only at localhost. On a server, it might be used through SSH tunnel or made publicly available using nginx with TLS. For example the follwing Nginx configuration can be used:

  services.nginx.virtualHosts."your.domain" = {
    addSSL = true;
    enableACME = true;
    locations."/grafana/" = {
        proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}/";
        proxyWebsockets = true;
    };
  };

Usage

Log into the Grafana web application (using default user: admin, password: admin). Everything else (data sources, users, dashboards, ...) is configured in the Web UI. Refer to the official documentation on how to do it:

External Links