diff options
Diffstat (limited to 'hosts/vidhar')
-rw-r--r-- | hosts/vidhar/default.nix | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix index 5665c419..9bc33077 100644 --- a/hosts/vidhar/default.nix +++ b/hosts/vidhar/default.nix | |||
@@ -178,6 +178,17 @@ | |||
178 | }; | 178 | }; |
179 | }; | 179 | }; |
180 | }; | 180 | }; |
181 | ruler = { | ||
182 | storage = { | ||
183 | type = "local"; | ||
184 | local.directory = "/etc/loki/rules"; | ||
185 | }; | ||
186 | remote_write = { | ||
187 | enabled = true; | ||
188 | client.url = "http://localhost:9090/api/v1/write"; | ||
189 | }; | ||
190 | ring.kvstore.store = "inmemory"; | ||
191 | }; | ||
181 | schema_config.configs = [ | 192 | schema_config.configs = [ |
182 | { from = "2022-01-01"; | 193 | { from = "2022-01-01"; |
183 | store = "boltdb-shipper"; | 194 | store = "boltdb-shipper"; |
@@ -191,6 +202,20 @@ | |||
191 | ]; | 202 | ]; |
192 | }; | 203 | }; |
193 | }; | 204 | }; |
205 | environment.etc."loki/rules/rules.yml".text = lib.generators.toYAML {} { | ||
206 | groups = [ | ||
207 | { name = "power-failures"; | ||
208 | rules = [ | ||
209 | { record = "apcupsd_power_failures:rate_1d"; | ||
210 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1d])) * 86400"; | ||
211 | } | ||
212 | { record = "apcupsd_power_failures:per_week"; | ||
213 | expr = "sum by (nodename) (rate({job=\"systemd-journal\"} | json | MESSAGE = \"Power failure.\"[1w])) * 604800"; | ||
214 | } | ||
215 | ]; | ||
216 | }; | ||
217 | ]; | ||
218 | }; | ||
194 | services.promtail = { | 219 | services.promtail = { |
195 | enable = true; | 220 | enable = true; |
196 | configuration = { | 221 | configuration = { |