Enable Mimir Alertmanager, add example alert #33
5
services/monitoring/lgtm/alerts/demo.yaml
Normal file
5
services/monitoring/lgtm/alerts/demo.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
groups:
|
||||||
|
- name: Demo alerts
|
||||||
|
rules:
|
||||||
|
- alert: Demo alert
|
||||||
|
expr: 1
|
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
nodes,
|
nodes,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -26,6 +27,8 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
jobConfigs = map toJobConfig scrapableMetas;
|
jobConfigs = map toJobConfig scrapableMetas;
|
||||||
|
|
||||||
|
mimirPort = config.services.mimir.configuration.server.http_listen_port;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.bagel.services.prometheus.enable = mkEnableOption "Prometheus scraper";
|
options.bagel.services.prometheus.enable = mkEnableOption "Prometheus scraper";
|
||||||
|
@ -41,7 +44,7 @@ in
|
||||||
globalConfig.scrape_interval = "15s";
|
globalConfig.scrape_interval = "15s";
|
||||||
scrapeConfigs = jobConfigs;
|
scrapeConfigs = jobConfigs;
|
||||||
remoteWrite = [
|
remoteWrite = [
|
||||||
{ url = "http://localhost:9009/api/v1/push"; }
|
{ url = "http://localhost:${toString mimirPort}/api/v1/push"; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,6 +52,8 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
extraFlags = ["--config.expand-env=true"];
|
extraFlags = ["--config.expand-env=true"];
|
||||||
configuration = {
|
configuration = {
|
||||||
|
target = "all,alertmanager";
|
||||||
|
|
||||||
multitenancy_enabled = false;
|
multitenancy_enabled = false;
|
||||||
|
|
||||||
common.storage = {
|
common.storage = {
|
||||||
|
@ -73,11 +78,40 @@ in
|
||||||
blocks_storage.backend = "s3";
|
blocks_storage.backend = "s3";
|
||||||
ruler_storage = {
|
ruler_storage = {
|
||||||
backend = "local";
|
backend = "local";
|
||||||
local.directory = ./alerts;
|
local.directory = pkgs.runCommand "mimir-rules" {} ''
|
||||||
|
mkdir -p $out
|
||||||
|
ln -s ${./alerts} $out/anonymous
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
alertmanager = {
|
||||||
|
sharding_ring.replication_factor = 1;
|
||||||
|
fallback_config_file = pkgs.writers.writeYAML "alertmanager.yaml" {
|
||||||
|
route = {
|
||||||
|
group_by = ["alertname"];
|
||||||
|
receiver = "matrix";
|
||||||
|
};
|
||||||
|
receivers = [
|
||||||
|
{
|
||||||
|
name = "matrix";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
alertmanager_storage.backend = "filesystem";
|
||||||
|
|
||||||
|
ruler.alertmanager_url = "http://localhost:${toString mimirPort}/alertmanager";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.mimir.serviceConfig.EnvironmentFile = [ config.age.secrets.mimir-environment.path ];
|
systemd.services.mimir.serviceConfig.EnvironmentFile = [ config.age.secrets.mimir-environment.path ];
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."mimir.forkos.org" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:${toString mimirPort}";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue