diff options
Diffstat (limited to 'hosts/vidhar/default.nix')
| -rw-r--r-- | hosts/vidhar/default.nix | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix index 3f5d17d5..fc77f03c 100644 --- a/hosts/vidhar/default.nix +++ b/hosts/vidhar/default.nix | |||
| @@ -235,25 +235,30 @@ with lib; | |||
| 235 | ]; | 235 | ]; |
| 236 | }; | 236 | }; |
| 237 | }; | 237 | }; |
| 238 | systemd.services.loki.preStart = let | 238 | systemd.services.loki = { |
| 239 | rulesYaml = generators.toYAML {} { | 239 | preStart = let |
| 240 | groups = [ | 240 | rulesYaml = generators.toYAML {} { |
| 241 | { name = "power-failures"; | 241 | groups = [ |
| 242 | rules = [ | 242 | { name = "power-failures"; |
| 243 | { record = "apcupsd_power_failures:per_day"; | 243 | rules = [ |
| 244 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1d])) * 86400"; | 244 | { record = "apcupsd_power_failures:per_day"; |
| 245 | } | 245 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1d])) * 86400"; |
| 246 | { record = "apcupsd_power_failures:per_week"; | 246 | } |
| 247 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1w])) * 604800"; | 247 | { record = "apcupsd_power_failures:per_week"; |
| 248 | } | 248 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1w])) * 604800"; |
| 249 | ]; | 249 | } |
| 250 | } | 250 | ]; |
| 251 | ]; | 251 | } |
| 252 | }; | 252 | ]; |
| 253 | in '' | 253 | }; |
| 254 | ${pkgs.coreutils}/bin/install -m 0755 -o ${config.services.loki.user} -g ${config.services.loki.group} -d ${config.services.loki.configuration.ruler.storage.local.directory}/fake | 254 | in '' |
| 255 | ${pkgs.coreutils}/bin/ln -sf ${pkgs.writeText "rules.yml" rulesYaml} ${config.services.loki.configuration.ruler.storage.local.directory}/fake/rules.yml | 255 | ${pkgs.coreutils}/bin/install -m 0755 -o ${config.services.loki.user} -g ${config.services.loki.group} -d ${config.services.loki.configuration.ruler.storage.local.directory}/fake |
| 256 | ''; | 256 | ${pkgs.coreutils}/bin/ln -sf ${pkgs.writeText "rules.yml" rulesYaml} ${config.services.loki.configuration.ruler.storage.local.directory}/fake/rules.yml |
| 257 | ''; | ||
| 258 | serviceConfig.Environment = [ | ||
| 259 | "ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19" | ||
| 260 | ]; | ||
| 261 | }; | ||
| 257 | services.promtail = { | 262 | services.promtail = { |
| 258 | enable = true; | 263 | enable = true; |
| 259 | configuration = { | 264 | configuration = { |
| @@ -286,6 +291,9 @@ with lib; | |||
| 286 | ]; | 291 | ]; |
| 287 | }; | 292 | }; |
| 288 | }; | 293 | }; |
| 294 | systemd.services.promtail.serviceConfig.Environment = [ | ||
| 295 | "ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19" | ||
| 296 | ]; | ||
| 289 | 297 | ||
| 290 | services.apcupsd = { | 298 | services.apcupsd = { |
| 291 | enable = true; | 299 | enable = true; |
