1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-08-01 04:27:46 +00:00

feat: move away from cube host

This commit is contained in:
RGBCube 2025-02-28 00:29:52 +03:00
parent 07537d4889
commit 5125a31e7f
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
36 changed files with 97 additions and 165 deletions

View file

@ -0,0 +1,44 @@
{ self, config, lib, ... }: let
inherit (lib) enabled filterAttrs flatten mapAttrsToList;
in {
services.grafana.provision.datasources.settings = {
datasources = [{
name = "Prometheus";
type = "prometheus";
url = "http://[::1]:${toString config.services.prometheus.port}";
orgId = 1;
}];
deleteDatasources = [{
name = "Prometheus";
orgId = 1;
}];
};
services.prometheus = enabled {
listenAddress = "[::]";
retentionTime = "1w";
scrapeConfigs = let
configToScrapeConfig = hostName: { config, ... }: let
hostConfig = config;
in hostConfig.services.prometheus.exporters
|> filterAttrs (exporterName: exporterConfig:
exporterName != "minio" &&
exporterName != "unifi-poller" &&
exporterName != "tor" &&
exporterConfig.enable or false)
|> mapAttrsToList (exporterName: exporterConfig: {
job_name = "${exporterName}-${hostName}";
static_configs = [{
targets = [ "${hostName}:${toString exporterConfig.port}" ];
}];
});
in self.nixosConfigurations
|> mapAttrsToList configToScrapeConfig
|> flatten;
};
}