mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2025-08-10 07:19:34 +02:00
ildkule/prometheus: add utility function
This commit is contained in:
parent
043099eb37
commit
579ed180a3
@ -1,66 +1,28 @@
|
|||||||
{ config, ... }: let
|
{ config, ... }: let
|
||||||
cfg = config.services.prometheus;
|
cfg = config.services.prometheus;
|
||||||
|
|
||||||
|
mkHostScrapeConfig = name: ports: {
|
||||||
|
labels.hostname = name;
|
||||||
|
targets = map (port: "${name}.pvv.ntnu.no:${toString port}") ports;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultNodeExporterPort = 9100;
|
||||||
|
defaultSystemdExporterPort = 9101;
|
||||||
in {
|
in {
|
||||||
services.prometheus.scrapeConfigs = [{
|
services.prometheus.scrapeConfigs = [{
|
||||||
job_name = "base_info";
|
job_name = "base_info";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{ labels.hostname = "ildkule";
|
(mkHostScrapeConfig "ildkule" [ cfg.exporters.node.port cfg.exporters.systemd.port ])
|
||||||
targets = [
|
(mkHostScrapeConfig "bekkalokk" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
"ildkule.pvv.ntnu.no:${toString cfg.exporters.node.port}"
|
(mkHostScrapeConfig "kommode" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
"ildkule.pvv.ntnu.no:${toString cfg.exporters.systemd.port}"
|
(mkHostScrapeConfig "bicep" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
];
|
(mkHostScrapeConfig "brzeczyszczykiewicz" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
}
|
(mkHostScrapeConfig "georg" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
{ labels.hostname = "bekkalokk";
|
(mkHostScrapeConfig "ustetind" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||||
targets = [
|
|
||||||
"bekkalokk.pvv.ntnu.no:9100"
|
(mkHostScrapeConfig "hildring" [ defaultNodeExporterPort ])
|
||||||
"bekkalokk.pvv.ntnu.no:9101"
|
(mkHostScrapeConfig "isvegg" [ defaultNodeExporterPort ])
|
||||||
];
|
(mkHostScrapeConfig "microbel" [ defaultNodeExporterPort ])
|
||||||
}
|
|
||||||
{ labels.hostname = "kommode";
|
|
||||||
targets = [
|
|
||||||
"kommode.pvv.ntnu.no:9100"
|
|
||||||
"kommode.pvv.ntnu.no:9101"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "bicep";
|
|
||||||
targets = [
|
|
||||||
"bicep.pvv.ntnu.no:9100"
|
|
||||||
"bicep.pvv.ntnu.no:9101"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "brzeczyszczykiewicz";
|
|
||||||
targets = [
|
|
||||||
"brzeczyszczykiewicz.pvv.ntnu.no:9100"
|
|
||||||
"brzeczyszczykiewicz.pvv.ntnu.no:9101"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "georg";
|
|
||||||
targets = [
|
|
||||||
"georg.pvv.ntnu.no:9100"
|
|
||||||
"georg.pvv.ntnu.no:9101"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "ustetind";
|
|
||||||
targets = [
|
|
||||||
"ustetind.pvv.ntnu.no:9100"
|
|
||||||
"ustetind.pvv.ntnu.no:9101"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "hildring";
|
|
||||||
targets = [
|
|
||||||
"hildring.pvv.ntnu.no:9100"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "isvegg";
|
|
||||||
targets = [
|
|
||||||
"isvegg.pvv.ntnu.no:9100"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{ labels.hostname = "microbel";
|
|
||||||
targets = [
|
|
||||||
"microbel.pvv.ntnu.no:9100"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user