defiant: add uptime-kuma, rename metrics->monitoring
This commit is contained in:
69
hosts/defiant/services/monitoring/grafana.nix
Normal file
69
hosts/defiant/services/monitoring/grafana.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.grafana;
|
||||
in {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
dataDir = "/tank/services/metrics/grafana";
|
||||
|
||||
# TODO: Migrate sqlite to postgres
|
||||
|
||||
settings.server = {
|
||||
domain = "grafana.home.feal.no";
|
||||
http_port = 2342;
|
||||
http_addr = "127.0.0.1";
|
||||
};
|
||||
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
uid = "prom1";
|
||||
url = ("http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}");
|
||||
isDefault = true;
|
||||
}
|
||||
{
|
||||
name = "Loki";
|
||||
type = "loki";
|
||||
url = ("http://${config.services.loki.configuration.server.http_listen_address}:${toString config.services.loki.configuration.server.http_listen_port}");
|
||||
}
|
||||
];
|
||||
dashboards.settings.providers = [
|
||||
{
|
||||
name = "Node Exporter Full";
|
||||
type = "file";
|
||||
url = "https://grafana.com/api/dashboards/1860/revisions/29/download";
|
||||
options.path = dashboards/node-exporter-full.json;
|
||||
}
|
||||
{
|
||||
name = "Synology NAS Details";
|
||||
type = "file";
|
||||
url = "https://grafana.com/api/dashboards/14284/revisions/9/download";
|
||||
options.path = dashboards/synology-nas-details.json;
|
||||
}
|
||||
{
|
||||
name = "OpenWRT";
|
||||
type = "file";
|
||||
url = "https://grafana.com/api/dashboards/11147/revisions/1/download";
|
||||
options.path = dashboards/openwrt.json;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${cfg.settings.server.domain} = {
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString cfg.settings.server.http_port}";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_buffers 8 1024k;
|
||||
proxy_buffer_size 1024k;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user