homeassistant -> prometheus

This commit is contained in:
Ingolf Wagner 2023-02-10 04:16:40 +01:00
parent 860baf6203
commit 421d89d1d8
Signed by: palo
GPG key ID: 76BF5F1928B9618B
2 changed files with 21 additions and 4 deletions

View file

@ -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"
},

View file

@ -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";
};
}];
}
];
};
}