diff options
Diffstat (limited to 'os/srv/prometheus.nix')
| -rw-r--r-- | os/srv/prometheus.nix | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/os/srv/prometheus.nix b/os/srv/prometheus.nix new file mode 100644 index 0000000..afccef4 --- /dev/null +++ b/os/srv/prometheus.nix @@ -0,0 +1,75 @@ +{ config, lib, ... }: +let + cfg = config.os.srv.prometheus; +in +{ + options.os.srv.prometheus.enable = lib.mkEnableOption "enables prometheus"; + config = lib.mkIf cfg.enable { + services.prometheus = { + enable = true; + port = 9090; + + alertmanagers = [ + { + static_configs = [ { targets = [ "127.0.0.1:9093" ]; } ]; + } + ]; + + scrapeConfigs = [ + { + job_name = "prometheus"; + static_configs = [ { targets = [ "127.0.0.1:9090" ]; } ]; + } + { + job_name = "node_exporter"; + static_configs = [ { targets = [ "127.0.0.1:9100" ]; } ]; + } + { + job_name = "uptime_kuma"; + metrics_path = "/metrics"; + static_configs = [ { targets = [ "127.0.0.1:3001" ]; } ]; + } + ]; + exporters = { + node = { + enable = true; + enableCollectors = [ "systemd" ]; + port = 9100; + }; + + alertmanager = { + enable = true; + port = 9093; + configuration = { + route = { + receiver = "default-receiver"; + group_by = [ "alertname" ]; + }; + receivers = [ + { + name = "default-receiver"; + } + ]; + }; + }; + + smokeping = { + enable = true; + listenAddress = "127.0.0.1"; + + pingInterval = "1s"; + + hosts = [ + "10.0.0.1" # Personal Router + "192.168.0.1" # ISP Modem Box + "84.116.254.69" # First ISP Hop + "185.182.244.39" # Regional Katowice Hub + "1.1.1.1" # Cloudflare DNS + "8.8.8.8" # Google DNS + "130.162.223.123" # OCI Instance + ]; + }; + }; + }; + }; +} |
