hainich/monitoring: init prometheus
This commit is contained in:
parent
323b4edf1c
commit
0d362a17fc
2 changed files with 43 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
./services/gitlab-runner.nix
|
./services/gitlab-runner.nix
|
||||||
./services/lantifa.nix
|
./services/lantifa.nix
|
||||||
./services/syncthing.nix
|
./services/syncthing.nix
|
||||||
|
./services/monitoring.nix
|
||||||
];
|
];
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
boot.loader.grub.version = 2;
|
boot.loader.grub.version = 2;
|
||||||
|
|
42
hosts/hainich/services/monitoring.nix
Normal file
42
hosts/hainich/services/monitoring.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
webExternalUrl = "https://stats.hacc.space";
|
||||||
|
exporters = {
|
||||||
|
dovecot = {
|
||||||
|
enable = true;
|
||||||
|
scopes = [ "user" "global" ];
|
||||||
|
socketPath = "/var/run/dovecot2/old-stats";
|
||||||
|
};
|
||||||
|
nginx.enable = true;
|
||||||
|
node.enable = true;
|
||||||
|
postfix = {
|
||||||
|
enable = true;
|
||||||
|
systemd.enable = true;
|
||||||
|
};
|
||||||
|
rspamd.enable = true;
|
||||||
|
};
|
||||||
|
scrapeConfigs = (lib.mapAttrsToList (name: val:
|
||||||
|
{
|
||||||
|
job_name = "${name}-${config.networking.hostName}";
|
||||||
|
static_configs = [{
|
||||||
|
targets = [ "localhost:${toString val.port}" ];
|
||||||
|
labels.host = config.networking.hostName;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
) (lib.filterAttrs (_: val: val.enable) config.services.prometheus.exporters));
|
||||||
|
};
|
||||||
|
|
||||||
|
services.dovecot2.extraConfig = ''
|
||||||
|
mail_plugins = $mail_plugins old_stats
|
||||||
|
service old-stats {
|
||||||
|
unix_listener old-stats {
|
||||||
|
user = dovecot-exporter
|
||||||
|
group = dovecot-exporter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
services.nginx.statusPage = true;
|
||||||
|
}
|
Loading…
Reference in a new issue