1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

Revert "feat(alertmanager): alert via irc"

This reverts commit 630d99e191.
This commit is contained in:
2022-01-27 17:17:43 +01:00
parent 62479936b1
commit 4e520a82aa
2 changed files with 49 additions and 24 deletions

View File

@@ -114,24 +114,48 @@ in
}]; }];
})]; })];
systemd.services.alertmanager-irc = { systemd.services.alertmanager-bot-telegram =
let
alertmanager-bot-telegram = pkgs.buildGoModule rec {
pname = "alertmanager-bot";
version = "2020-07-13";
src = pkgs.fetchFromGitHub {
owner = "metalmatze";
repo = "alertmanager-bot";
rev = "5efc0bbbf8023d4324e9da98562f064a714a7206";
sha256 = "09cciml1j8x76jpm2v5v6h2q6j1fkhsz1kswslmx8wl4wk40xgp4";
};
vendorSha256 = "1v0fgin8dn81b559zz4lqmrl7hikr46g4gb18sci4riql5qs1isj";
postInstall = ''
install -D ./default.tmpl $out/templates/default.tmpl
'';
};
in {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "ip-up.target" ]; after = [ "ip-up.target" ];
environment.TELEGRAM_ADMIN = "18980945";
environment.TELEGRAM_TOKEN = lib.strings.fileContents <system-secrets/telegram/prometheus.token>;
serviceConfig = { serviceConfig = {
DynamicUser = true; DynamicUser = true;
StateDirectory = "alert-irc"; StateDirectory = "alertbot";
ExecStart = ''${pkgs.alertmanager-irc-relay}/bin/alertmanager-irc-relay \ ExecStart = ''${alertmanager-bot-telegram}/bin/alertmanager-bot \
--config ${(pkgs.formats.yaml {}).generate "config.yaml" { --alertmanager.url=http://localhost:9093 --log.level=info \
http_host = "0.0.0.0"; --store=bolt --bolt.path=/var/lib/alertbot/bot.db \
http_port = 16330; --listen.addr="0.0.0.0:16320" \
irc_host = "irc.r"; --template.paths=${pkgs.writeText "template.tmpl" ''
irc_port = 6667; {{ define "telegram.default" }}
irc_use_ssl = false; {{range .Alerts -}}
irc_nickname = "niveum"; {{ if eq .Status "firing" }}
irc_channels = [ { name = "#niveum"; } ]; <b>{{ index .Annotations "summary"}}</b>
msg_template = ''{{ index .Annotations "summary" }} ({{ .Status }})''; {{ index .Annotations "description" }}
}}
''; See on Grafana: http://${config.services.grafana.domain}/d/alpUteInz/niveum
{{ else -}}
RESOLVED 😌 <del>{{ index .Annotations "summary"}}</del>
{{- end }}
{{end -}}
{{end}}
''}'';
}; };
}; };
@@ -146,16 +170,20 @@ in
}; };
receivers = [{ receivers = [{
name = "me"; name = "me";
webhook_configs = [ webhook_configs = [{
{ url = "http://localhost:16320";
url = "http://localhost:16330/niveum"; send_resolved = true;
send_resolved = true; }];
}
];
}]; }];
}; };
}; };
services.prometheus.alertmanagers = [{
scheme = "http";
path_prefix = "/";
static_configs = [ { targets = [ "localhost:9093" ]; } ];
}];
services.prometheus.scrapeConfigs = [ services.prometheus.scrapeConfigs = [
{ {
job_name = "makanek"; job_name = "makanek";

View File

@@ -33,9 +33,6 @@ in {
look.mouse = true; look.mouse = true;
look.prefix_align_max = 15; look.prefix_align_max = 15;
color.chat_nick_colors = lib.lists.subtractLists (lib.range 52 69 ++ lib.range 231 248) (lib.range 31 254); color.chat_nick_colors = lib.lists.subtractLists (lib.range 52 69 ++ lib.range 231 248) (lib.range 31 254);
look.highlight_tags = [
"irc_notice+nick_niveum"
];
}; };
irc = { irc = {
look = { look = {
@@ -83,7 +80,7 @@ in {
retiolum = { retiolum = {
autoconnect = true; autoconnect = true;
address = "irc.r"; address = "irc.r";
autojoin = [ "#xxx" "#brockman" "#flix" "#niveum" ]; autojoin = [ "#xxx" "#brockman" "#flix" "#autowifi" ];
command = lib.concatStringsSep "\\;" [ command = lib.concatStringsSep "\\;" [
"/oper admin aidsballs" "/oper admin aidsballs"
"/msg nickserv always-on true" "/msg nickserv always-on true"