2021-11-17 04:50:18 -08:00
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
# grafana configuration
|
|
|
|
services.grafana = {
|
|
|
|
enable = true;
|
|
|
|
domain = "stats.mossnet.lan";
|
|
|
|
port = 2342;
|
|
|
|
addr = "127.0.0.1";
|
|
|
|
};
|
2022-06-14 00:00:59 -07:00
|
|
|
|
2021-11-17 04:50:18 -08:00
|
|
|
# nginx reverse proxy
|
|
|
|
services.nginx.virtualHosts.${config.services.grafana.domain} = {
|
|
|
|
locations."/" = {
|
2022-06-14 00:00:59 -07:00
|
|
|
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
|
|
|
proxyWebsockets = true;
|
2022-06-14 00:17:23 -07:00
|
|
|
extraConfig = "proxy_set_header Host $http_host";
|
2021-11-17 04:50:18 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.prometheus = {
|
|
|
|
enable = true;
|
|
|
|
port = 9001;
|
|
|
|
exporters = {
|
|
|
|
node = {
|
|
|
|
enable = true;
|
|
|
|
enabledCollectors = [ "systemd" ];
|
|
|
|
port = 9002;
|
|
|
|
};
|
|
|
|
dnsmasq = {
|
|
|
|
enable = true;
|
|
|
|
port = 9153;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "box";
|
|
|
|
static_configs = [{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; }];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "dns";
|
|
|
|
static_configs = [{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.dnsmasq.port}" ]; }];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.loki = {
|
2022-04-23 21:16:17 -07:00
|
|
|
#enable = true;
|
|
|
|
#configFile = /var/loki-config.yaml;
|
2021-11-17 04:50:18 -08:00
|
|
|
};
|
|
|
|
|
2022-04-23 21:16:17 -07:00
|
|
|
#systemd.services.promtail = {
|
|
|
|
# description = "Promtail service for Loki";
|
|
|
|
# wantedBy = [ "multi-user.target" ];
|
2021-11-17 04:50:18 -08:00
|
|
|
|
2022-04-23 21:16:17 -07:00
|
|
|
# serviceConfig = {
|
|
|
|
# ExecStart = ''
|
|
|
|
# ${pkgs.grafana-loki}/bin/promtail --config.file ${/var/promtail.yaml}
|
|
|
|
# '';
|
|
|
|
# };
|
|
|
|
#};
|
2021-11-17 04:50:18 -08:00
|
|
|
}
|