diff --git a/flake.lock b/flake.lock index f44686d..deadf14 100644 --- a/flake.lock +++ b/flake.lock @@ -908,11 +908,11 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1675861033, - "narHash": "sha256-N7jtUdy718AzP097ItsqzzxutiNmiBSfEd9AuL1yCoQ=", + "lastModified": 1675998131, + "narHash": "sha256-j17u/hZeFk/qJsqi8R3//UZbMZUFmuhM3EgqL/DdByo=", "ref": "main", - "rev": "847d654dd6393ad31627484785ffb28a73fe034f", - "revCount": 44, + "rev": "035d16fc7f29ee294da3091f74a4a909d46f197d", + "revCount": 45, "type": "git", "url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git" }, diff --git a/nixos/machines/pepe/prometheus.nix b/nixos/machines/pepe/prometheus.nix index 7478bce..079b43f 100644 --- a/nixos/machines/pepe/prometheus.nix +++ b/nixos/machines/pepe/prometheus.nix @@ -1,5 +1,7 @@ { config, pkgs, lib, ... }: { + sops.secrets.hass_long_term_token = { }; + services.nginx = { enable = true; statusPage = true; @@ -15,6 +17,7 @@ }; services.prometheus = { + checkConfig = "syntax-only"; enable = true; # keep data for 30 days extraFlags = [ "--storage.tsdb.retention.time=30d" ]; @@ -49,6 +52,20 @@ targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; }]; } + { + # see https://www.home-assistant.io/integrations/prometheus/ + job_name = "home-assistant"; + scrape_interval = "60s"; + metrics_path = "/api/prometheus"; + bearer_token_file = toString config.sops.secrets.hass_long_term_token.path; + static_configs = [{ + targets = [ "localhost:8123" ]; + labels = { + service = "hass"; + server = "pepe"; + }; + }]; + } ]; }; }