try alerting
This commit is contained in:
parent
91656004bc
commit
da3e1912aa
1 changed files with 48 additions and 1 deletions
|
|
@ -3,12 +3,14 @@
|
||||||
let
|
let
|
||||||
secretName = "grafanaSecret";
|
secretName = "grafanaSecret";
|
||||||
passwordName = "grafanaPassword";
|
passwordName = "grafanaPassword";
|
||||||
|
mailPasswordName = "mailPassword";
|
||||||
credentialDirectory = "/run/credentials/grafana.service/";
|
credentialDirectory = "/run/credentials/grafana.service/";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
systemd.services.grafana.serviceConfig.LoadCredential = [
|
systemd.services.grafana.serviceConfig.LoadCredential = [
|
||||||
"${secretName}:${config.age.secrets."grafanaSecret.age".path}"
|
"${secretName}:${config.age.secrets."grafanaSecret.age".path}"
|
||||||
"${passwordName}:${config.age.secrets."grafanaPassword.age".path}"
|
"${passwordName}:${config.age.secrets."grafanaPassword.age".path}"
|
||||||
|
"${mailPasswordName}:${config.age.secrets."smtpPassword.age".path}"
|
||||||
];
|
];
|
||||||
|
|
||||||
services =
|
services =
|
||||||
|
|
@ -34,9 +36,18 @@ in
|
||||||
admin_password = "$__file{${credentialDirectory}${passwordName}}";
|
admin_password = "$__file{${credentialDirectory}${passwordName}}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
smtp = {
|
||||||
|
enabled = true;
|
||||||
|
host = "mail.henryhiles.com";
|
||||||
|
user = config.services.caddy.email;
|
||||||
|
password = "$__file{${credentialDirectory}${mailPasswordName}}";
|
||||||
|
from_address = "alerts@federated.nexus";
|
||||||
|
from_name = "Grafana Alerts";
|
||||||
|
};
|
||||||
|
|
||||||
"auth.anonymous".enabled = true;
|
"auth.anonymous".enabled = true;
|
||||||
analytics.feedback_links_enabled = false;
|
|
||||||
users.default_theme = "system";
|
users.default_theme = "system";
|
||||||
|
analytics.feedback_links_enabled = false;
|
||||||
dashboards.default_home_dashboard_path = toString (import ../../../lib/status.nix attrs);
|
dashboards.default_home_dashboard_path = toString (import ../../../lib/status.nix attrs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -62,6 +73,42 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
alerting = {
|
||||||
|
contactPoints = [
|
||||||
|
{
|
||||||
|
name = "Email";
|
||||||
|
receivers = [
|
||||||
|
{
|
||||||
|
type = "email";
|
||||||
|
uid = "email";
|
||||||
|
settings.addresses = config.services.grafana.settings.smtp.user;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
policies = [
|
||||||
|
{
|
||||||
|
orgId = 1;
|
||||||
|
receiver = "grafana-default-email";
|
||||||
|
group_by = [ "..." ];
|
||||||
|
matchers = [
|
||||||
|
"alertname = Watchdog"
|
||||||
|
"severity =~ \"warning|critical\""
|
||||||
|
];
|
||||||
|
mute_time_intervals = [
|
||||||
|
"abc"
|
||||||
|
];
|
||||||
|
group_wait = "30s";
|
||||||
|
group_interval = "5m";
|
||||||
|
repeat_interval = "4h";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
caddy.virtualHosts."${domain}".extraConfig =
|
caddy.virtualHosts."${domain}".extraConfig =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue