more monitoring

This commit is contained in:
chris 2025-03-19 23:13:43 +01:00
parent 5d7d2c7e94
commit 80509191ae
Signed by: c6ristian
SSH key fingerprint: SHA256:B3m+yzpaxGXSEcDBpPHfvza/DNC0wuX+CKMeGq8wgak
3 changed files with 34 additions and 22 deletions
modules
systems/monitoring.noc.eh22.intern

View file

@ -8,16 +8,16 @@
{ {
sops = { sops = {
secrets."services/loki/basic_auth" = { secrets."services/loki/basic_auth" = {
mode = "0444"; mode = "0440";
owner = "nobody"; owner = "alloy";
group = "nobody"; group = "alloy";
restartUnits = [ "alloy.service" ]; restartUnits = [ "alloy.service" ];
sopsFile = ../secrets/passwords.yaml; sopsFile = ../secrets/passwords.yaml;
}; };
secrets."services/mimir/basic_auth" = { secrets."services/mimir/basic_auth" = {
mode = "0444"; mode = "0440";
owner = "nobody"; owner = "alloy";
group = "nobody"; group = "alloy";
restartUnits = [ "alloy.service" ]; restartUnits = [ "alloy.service" ];
sopsFile = ../secrets/passwords.yaml; sopsFile = ../secrets/passwords.yaml;
}; };
@ -27,6 +27,18 @@
enable = true; enable = true;
}; };
users = {
users.alloy = {
isSystemUser = true;
group = "alloy";
};
groups.alloy = { };
};
systemd.services."alloy".serviceConfig = {
DynamicUser = lib.mkForce false;
};
environment.etc."alloy/config.alloy" = { environment.etc."alloy/config.alloy" = {
text = '' text = ''
prometheus.remote_write "default" { prometheus.remote_write "default" {
@ -81,8 +93,7 @@
} }
logging { logging {
level = "warn" level = "info"
format = "logfmt"
} }
prometheus.exporter.unix "local_system" { } prometheus.exporter.unix "local_system" { }

View file

@ -62,6 +62,12 @@ in
instance_addr = "127.0.0.1"; instance_addr = "127.0.0.1";
}; };
}; };
ruler = {
ring = {
instance_addr = "127.0.0.1";
};
};
ruler_storage = { ruler_storage = {
backend = "local"; backend = "local";
local.directory = alerts; local.directory = alerts;

View file

@ -30,29 +30,24 @@
environment.etc."alloy/pve.alloy" = { environment.etc."alloy/pve.alloy" = {
text = '' text = ''
prometheus.scrape "example" { prometheus.scrape "noc_pve" {
// Collect metrics from the default listen address.
targets = [{ targets = [{
__address__ = "127.0.0.1:9221", __address__ = "127.0.0.1:9221",
__scheme__ = "http", __scheme__ = "http",
__metrics_path__ = "pve",
__param_target__ = "94.45.255.1",
}] }]
metrics_path = "/pve"
params = {
"target" = ["94.45.255.1"],
"module" = ["default"],
}
scrape_interval = "10s"
forward_to = [prometheus.relabel.pve.receiver] forward_to = [prometheus.relabel.pve.receiver]
} }
prometheus.relabel "pve" { prometheus.relabel "pve" {
forward_to = [prometheus.remote_write.default.receiver] forward_to = [prometheus.remote_write.default.receiver]
rule {
source_labels = [ "__param_target" ]
target_label = "instance"
}
rule {
target_label = "__address__"
replacement = "pve-exporter"
}
} }
''; '';
}; };