diff --git a/nixos/machines/pepe/prometheus.nix b/nixos/machines/pepe/prometheus.nix index 34a9b68..8134d25 100644 --- a/nixos/machines/pepe/prometheus.nix +++ b/nixos/machines/pepe/prometheus.nix @@ -40,6 +40,21 @@ } ]; } + { + name = "home-assistant"; + rules = [ + { + record = "home_open_window_sum"; + expr = ''sum( homeassistant_binary_sensor_state{entity=~"binary_sensor\\.window_02_contact|binary_sensor\\.window_03_contact|binary_sensor\\.window_04_contact|binary_sensor\\.window_05_contact|binary_sensor\\.window_06_contact|binary_sensor\\.window_07_contact"} )''; + } + ] ++ (map + (number: + { + record = "home_at_least_n_windows_open"; + expr = ''home_open_window_sum >= bool ${toString number}''; + labels.n = number; + }) [ 1 2 3 ]); + } ]; })) ]; diff --git a/nixos/machines/pepe/telegraf.nix b/nixos/machines/pepe/telegraf.nix index f051719..d37352e 100644 --- a/nixos/machines/pepe/telegraf.nix +++ b/nixos/machines/pepe/telegraf.nix @@ -31,7 +31,7 @@ in systemd_units = { }; internet_speed.interval = "50m"; nginx.urls = [ "http://localhost/nginx_status" ]; - ping = [{ urls = [ "10.100.0.1" ]; }]; + ping = [{ urls = [ "10.100.0.1" ]; }]; # actually important to make pepe visible over wireguard }; }; };