75 lines
1.8 KiB
Nix
75 lines
1.8 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
services.grafana = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
|
|
settings = {
|
|
server = {
|
|
http_addr = "0.0.0.0";
|
|
http_port = 3000;
|
|
};
|
|
|
|
analytics = {
|
|
reporting_enabled = false;
|
|
feedback_links_enabled = false;
|
|
};
|
|
|
|
security.secret_key = "3e16c96c8ac93b58bae44199237cab4e";
|
|
};
|
|
|
|
provision = {
|
|
enable = true;
|
|
datasources.settings.datasources = [
|
|
{
|
|
name = "Loki";
|
|
type = "loki";
|
|
access = "proxy";
|
|
url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}";
|
|
jsonData = {
|
|
timeout = 60;
|
|
maxLines = 1000;
|
|
};
|
|
}
|
|
{
|
|
name = "VictoriaMetrics";
|
|
type = "victoriametrics-metrics-datasource";
|
|
access = "proxy";
|
|
url = "http://127.0.0.1${toString config.services.victoriametrics.listenAddress}";
|
|
}
|
|
{
|
|
name = "InfluxDB-Proxmox";
|
|
type = "influxdb";
|
|
access = "proxy";
|
|
url = "http://127.0.0.1:8086";
|
|
jsonData = {
|
|
version = "Flux";
|
|
organization = "proxmox-org";
|
|
defaultBucket = "proxmox";
|
|
};
|
|
secureJsonData = {
|
|
token = "$__file{${config.sops.secrets.grafana_influx_token.path}}";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
|
|
declarativePlugins = with pkgs.grafanaPlugins; [
|
|
victoriametrics-metrics-datasource
|
|
victoriametrics-logs-datasource
|
|
|
|
grafana-metricsdrilldown-app
|
|
grafana-lokiexplore-app
|
|
grafana-exploretraces-app
|
|
grafana-pyroscope-app
|
|
];
|
|
};
|
|
|
|
sops.secrets."grafana_influx_token" = {
|
|
sopsFile = ../../secrets/monitoring.yaml;
|
|
owner = "grafana";
|
|
group = "grafana";
|
|
mode = "0440";
|
|
};
|
|
}
|