Add monitoring services

This commit is contained in:
Torjus Håkestad 2024-03-18 00:18:17 +01:00
parent 72a10c5ec0
commit a4d83d6bb8
2 changed files with 34 additions and 0 deletions

View File

@ -3,6 +3,7 @@
{
imports = [
./hardware-configuration.nix
../../system/monitoring.nix
];
# Sops stuff

33
system/monitoring.nix Normal file
View File

@ -0,0 +1,33 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
prometheus-node-exporter
prometheus-systemd-exporter
];
systemd.services."node-exporter" = {
enable = true;
unitConfig = {
Description = "Prometheus Node Exporter";
After = [ "network.target" ];
};
serviceConfig = {
ExecStart = "${pkgs.prometheus-node-exporter}/bin/node_exporter";
};
wantedBy = [ "multi-user.target" ];
};
systemd.services."systemd-exporter" = {
enable = true;
unitConfig = {
Description = "Prometheus Systemd Exporter";
After = [ "network.target" ];
};
serviceConfig = {
ExecStart = "${pkgs.prometheus-systemd-exporter}/bin/systemd_exporter";
};
wantedBy = [ "multi-user.target" ];
};
networking.firewall.allowedTCPPorts = [ 9100 9558 ];
}