Merge branch 'master' into add_gamma

This commit is contained in:
jeltz 2025-07-06 23:06:02 +02:00
commit 8414d06a3c
Signed by: jeltz
GPG key ID: 800882B66C0C3326
5 changed files with 20 additions and 8 deletions

View file

@ -6,10 +6,9 @@ let
postgresql = config.services.postgresql.package; postgresql = config.services.postgresql.package;
additionalPackages = [ additionalPackages = [
pkgs.coreutils pkgs.coreutils
postgresql
pkgs.sudo pkgs.sudo
pkgs.sqlite pkgs.sqlite
]; ] ++ lib.optionals (builtins.length cfg.postgresqlDatabases > 0) [ postgresql ];
remotes = { remotes = {
memoragon = { memoragon = {
host = "memoragon.infra.federez.net"; host = "memoragon.infra.federez.net";

View file

@ -86,7 +86,9 @@ in {
[ [
{ {
name = "VictoriaMetrics"; name = "VictoriaMetrics";
type = "victoriametrics-metrics-datasource"; # See https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/59
type = "prometheus";
#type = "victoriametrics-metrics-datasource";
uid = "vm"; uid = "vm";
url = "http://localhost:8428"; url = "http://localhost:8428";
editable = false; editable = false;

View file

@ -5,6 +5,7 @@ let
alertmanagerPort = config.services.prometheus.alertmanager.port; alertmanagerPort = config.services.prometheus.alertmanager.port;
alertbotPort = config.services.alertbot.listenPort; alertbotPort = config.services.alertbot.listenPort;
blackboxPort = config.services.prometheus.exporters.blackbox.port; blackboxPort = config.services.prometheus.exporters.blackbox.port;
vmalertPort = 8880;
nodePort = 9100; nodePort = 9100;
mkScrapeConfig = name: config: { mkScrapeConfig = name: config: {
job_name = name; job_name = name;
@ -30,6 +31,7 @@ let
(alert: attrs: attrs // { inherit alert; }) (alert: attrs: attrs // { inherit alert; })
(import path { inherit critical warning; }); (import path { inherit critical warning; });
}); });
inactiveNodes = [ "wagon" "jargon" "lagon" ];
in { in {
imports = [ imports = [
../../modules/alertbot.nix ../../modules/alertbot.nix
@ -41,14 +43,22 @@ in {
services.victoriametrics = { services.victoriametrics = {
enable = true; enable = true;
extraOptions = [ "-enableTCP6" ]; extraOptions = [
"-enableTCP6"
"-vmalert.proxyURL=http://localhost:${toString vmalertPort}"
];
listenAddress = "localhost:${toString victoriametricsPort}"; listenAddress = "localhost:${toString victoriametricsPort}";
prometheusConfig = { prometheusConfig = {
scrape_configs = mkScrapeConfigs { scrape_configs = mkScrapeConfigs {
node = { node = {
path = "/metrics"; path = "/metrics";
replacement = "$1.infra.federez.net:${toString nodePort}"; replacement = "$1.infra.federez.net:${toString nodePort}";
targets = lib.attrsets.mapAttrsToList (n: _: n) network.infra.nodes; targets = let
activeNodes = lib.filterAttrs
(n: _: !(builtins.elem n inactiveNodes))
network.infra.nodes;
in
lib.attrsets.mapAttrsToList (n: _: n) activeNodes;
}; };
blackbox_https_get_200 = { blackbox_https_get_200 = {
path = "/probe"; path = "/probe";
@ -90,6 +100,7 @@ in {
"remoteWrite.url" = victoriametricsUrl; "remoteWrite.url" = victoriametricsUrl;
"remoteRead.url" = victoriametricsUrl; "remoteRead.url" = victoriametricsUrl;
"notifier.url" = [ alertmanagerUrl ]; "notifier.url" = [ alertmanagerUrl ];
"httpListenAddr" = "localhost:${toString vmalertPort}";
}; };
}; };

View file

@ -131,7 +131,7 @@
NodePhysicalComponentTooHot = { NodePhysicalComponentTooHot = {
expr = '' expr = ''
node_hwmon_temp_celsius > clamp_max(79, node_hwmon_temp_max_celsius) node_hwmon_temp_celsius > clamp_max(node_hwmon_temp_max_celsius, 79)
''; '';
for = "0m"; for = "0m";
labels = critical; labels = critical;
@ -265,7 +265,7 @@
NodeLoad5Usage = { NodeLoad5Usage = {
expr = '' expr = ''
node_load5 / ( node_load5 / (
count without(cpu, mode) (node_cpu_seconds_total{mode="idle"})) > 1.1 count without(cpu, mode) (node_cpu_seconds_total{mode="idle"})) > 1.25
''; '';
for = "1m"; for = "1m";
labels = warning; labels = warning;

View file

@ -101,7 +101,7 @@
age.secrets = { age.secrets = {
vogon-wg-infra-key = { vogon-wg-infra-key = {
file = ../secrets/vogon-wg-infra-key.age; file = ../../secrets/vogon-wg-infra-key.age;
owner = "root"; owner = "root";
group = "root"; group = "root";
}; };