helm/hosts/profiles/monitoring/default.nix

90 lines
2.3 KiB
Nix
Raw Normal View History

{ self, config, pkgs, ... }: {
age.secrets.nullhex-smtp.file = "${self}/secrets/nullhex-smtp.age";
age.secrets.nullhex-smtp.owner = "grafana";
2023-05-15 07:19:38 -07:00
2022-09-18 15:13:50 -07:00
# grafana configuration
services.grafana = {
enable = true;
2023-05-15 07:19:38 -07:00
settings = {
smtp = {
enabled = true;
password = "$__file{/run/agenix/nullhex-smtp}";
2023-05-15 07:19:38 -07:00
host = "smtp.nullhex.com";
user = "ops@sealight.xyz";
from_address = "ops@sealight.xyz";
};
server = {
domain = "stats.mossnet.lan";
http_addr = "127.0.0.1";
http_port = 2342;
root_url = "http://stats.mossnet.lan/";
2023-05-15 07:19:38 -07:00
};
2022-12-06 08:01:17 -08:00
};
# TODO enable
# provision.alerting.rules.path = "${self}/hosts/profiles/monitoring/alert-rules.yaml";
2022-09-18 15:13:50 -07:00
};
# nginx reverse proxy
# services.nginx.recommendedProxySettings = true; # Needed for new grafana versions
2023-05-15 07:19:38 -07:00
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
2022-09-18 15:13:50 -07:00
locations."/" = {
proxyPass = "http://127.0.0.1:2342";
2022-09-18 15:13:50 -07:00
proxyWebsockets = true;
};
};
services.postgresql = {
ensureUsers = [{
name = "grafana";
ensurePermissions = {
2023-08-12 18:57:16 -07:00
"ALL TABLES IN SCHEMA public" = "SELECT";
"DATABASE wallabag" = "CONNECT";
"DATABASE ulogger" = "CONNECT";
"DATABASE photoprism" = "CONNECT";
};
}];
};
2022-09-18 15:13:50 -07:00
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
dnsmasq = {
2022-12-06 08:01:17 -08:00
enable = false;
2022-09-18 15:13:50 -07:00
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}" ]; }];
}
];
};
2022-12-06 08:20:01 -08:00
# services.loki = {
# enable = true;
# configFile = /var/loki-config.yaml;
# };
2022-09-18 15:13:50 -07:00
#systemd.services.promtail = {
# description = "Promtail service for Loki";
# wantedBy = [ "multi-user.target" ];
# serviceConfig = {
# ExecStart = ''
# ${pkgs.grafana-loki}/bin/promtail --config.file ${/var/promtail.yaml}
# '';
# };
#};
}