mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
chore(monitoring): nf-fmt-nix
This commit is contained in:
parent
6fb140c7e6
commit
a0a7df1b0e
6 changed files with 164 additions and 141 deletions
|
|
@ -11,18 +11,24 @@
|
|||
nodeExporterSystems =
|
||||
filter (
|
||||
system:
|
||||
system.config.access.online.enable &&
|
||||
system.config.exports.prometheus.exporter.services != [ ]
|
||||
system.config.access.online.enable
|
||||
&& system.config.exports.prometheus.exporter.services != []
|
||||
)
|
||||
(attrValues systems);
|
||||
mkPortTarget = { system, service, portName }: let
|
||||
mkPortTarget = {
|
||||
system,
|
||||
service,
|
||||
portName,
|
||||
}: let
|
||||
port = service.ports.${portName};
|
||||
in "${access.getAddressFor system.config.name "lan"}:${toString port.port}";
|
||||
mkServiceConfig = system: serviceName: let
|
||||
service = system.config.exports.services.${serviceName};
|
||||
targets = map (portName: mkPortTarget {
|
||||
inherit system service portName;
|
||||
}) service.prometheus.exporter.ports;
|
||||
targets = map (portName:
|
||||
mkPortTarget {
|
||||
inherit system service portName;
|
||||
})
|
||||
service.prometheus.exporter.ports;
|
||||
in {
|
||||
job_name = "${system.config.name}-${service.id}";
|
||||
static_configs = [
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@
|
|||
inherit (lib.attrsets) attrValues;
|
||||
inherit (lib.lists) concatMap toList;
|
||||
allExporters = let
|
||||
exporters = removeAttrs config.services.prometheus.exporters [ "unifi-poller" ];
|
||||
in concatMap toList (attrValues exporters);
|
||||
exporters = removeAttrs config.services.prometheus.exporters ["unifi-poller"];
|
||||
in
|
||||
concatMap toList (attrValues exporters);
|
||||
in {
|
||||
config = {
|
||||
services.prometheus.exporters = {
|
||||
|
|
@ -57,8 +58,11 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
networking.firewall.interfaces.lan.allowedTCPPorts = map (exporter:
|
||||
mkIf (exporter.enable && !exporter.openFirewall) 999
|
||||
) allExporters;
|
||||
networking.firewall.interfaces.lan.allowedTCPPorts =
|
||||
map (
|
||||
exporter:
|
||||
mkIf (exporter.enable && !exporter.openFirewall) exporter.port
|
||||
)
|
||||
allExporters;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue