feat(modules/dgn-monitoring): Setup VictoriaMetrics and VictoriaLogs
This commit is contained in:
parent
358b5a6497
commit
95df4a5ed6
2 changed files with 68 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
"dgn-firewall"
|
"dgn-firewall"
|
||||||
"dgn-forgejo-runners"
|
"dgn-forgejo-runners"
|
||||||
"dgn-hardware"
|
"dgn-hardware"
|
||||||
|
"dgn-monitoring"
|
||||||
"dgn-netbox-agent"
|
"dgn-netbox-agent"
|
||||||
"dgn-network"
|
"dgn-network"
|
||||||
"dgn-node-monitoring"
|
"dgn-node-monitoring"
|
||||||
|
|
67
modules/nixos/dgn-monitoring/default.nix
Normal file
67
modules/nixos/dgn-monitoring/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
meta,
|
||||||
|
name,
|
||||||
|
nodeMeta,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) filterAttrs mapAttrsToList optional;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
services.vmagent = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
flags = {
|
||||||
|
"remoteWrite.url" = "http://${meta.network.storage01.netbirdIp}:8428/api/v1/write";
|
||||||
|
"remoteWrite.label" = "node=${name}";
|
||||||
|
};
|
||||||
|
|
||||||
|
prometheusConfig = {
|
||||||
|
scrape_configs =
|
||||||
|
mapAttrsToList
|
||||||
|
(job_name: cfg: {
|
||||||
|
inherit job_name;
|
||||||
|
static_configs = [ { targets = [ "127.0.0.1:${builtins.toString cfg.port}" ]; } ];
|
||||||
|
})
|
||||||
|
(
|
||||||
|
filterAttrs (
|
||||||
|
name: cfg:
|
||||||
|
!(builtins.elem name [
|
||||||
|
"assertions"
|
||||||
|
"warnings"
|
||||||
|
"blackbox"
|
||||||
|
"unifi-poller"
|
||||||
|
"domain"
|
||||||
|
"minio"
|
||||||
|
"idrac"
|
||||||
|
"pve"
|
||||||
|
"tor"
|
||||||
|
])
|
||||||
|
&& cfg.enable
|
||||||
|
) config.services.prometheus.exporters
|
||||||
|
);
|
||||||
|
global = {
|
||||||
|
scrape_interval = "15s";
|
||||||
|
external_labels.hostname = "${name}.${nodeMeta.site}.infra.dgnum.eu";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# services.prometheus.exporters = {
|
||||||
|
# node = {
|
||||||
|
# enable = true;
|
||||||
|
# enabledCollectors = [ "systemd" ] ++ (optional config.boot.zfs.enabled "zfs");
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
services.journald.upload = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
Upload.URL = "http://${meta.network.storage01.netbirdIp}:9428/insert/journald";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue