Fix job names of Prometheus
This commit is contained in:
parent
b5d45a974e
commit
35714c3d08
1 changed files with 29 additions and 32 deletions
|
@ -12,42 +12,39 @@
|
||||||
services.prometheus = {
|
services.prometheus = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
scrapeConfigs = (
|
scrapeConfigs = let
|
||||||
let
|
node = {
|
||||||
generated = lib.pipe nodes [
|
job_name = "node";
|
||||||
(lib.filterAttrs (name: node: node.config.services.prometheus.exporters.node.enable))
|
static_configs = [
|
||||||
(lib.attrsets.mapAttrsToList
|
{
|
||||||
(name: node: {
|
targets = lib.pipe nodes [
|
||||||
job_name = name;
|
(lib.filterAttrs (_name: node: node.config.services.prometheus.exporters.node.enable))
|
||||||
static_configs = [
|
(lib.attrsets.mapAttrsToList
|
||||||
{
|
(_name: node: "${node.config.networking.fqdn}:${toString node.config.services.prometheus.exporters.node.port}"))
|
||||||
targets = ["${node.config.networking.fqdn}:${toString node.config.services.prometheus.exporters.node.port}"];
|
];
|
||||||
}
|
}
|
||||||
];
|
|
||||||
}))
|
|
||||||
];
|
];
|
||||||
|
};
|
||||||
|
|
||||||
pikvm = {
|
pikvm = {
|
||||||
job_name = "pikvm";
|
job_name = "pikvm";
|
||||||
metrics_path = "/api/export/prometheus/metrics";
|
metrics_path = "/api/export/prometheus/metrics";
|
||||||
scheme = "https";
|
scheme = "https";
|
||||||
tls_config.insecure_skip_verify = true;
|
tls_config.insecure_skip_verify = true;
|
||||||
|
|
||||||
# We don't care about security here, it's behind a VPN.
|
# We don't care about security here, it's behind a VPN.
|
||||||
basic_auth = {
|
basic_auth = {
|
||||||
username = "admin";
|
username = "admin";
|
||||||
password = "admin";
|
password = "admin";
|
||||||
};
|
|
||||||
|
|
||||||
static_configs = [
|
|
||||||
{
|
|
||||||
targets = ["pikvm.dmz"];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
in
|
|
||||||
generated ++ [pikvm]
|
static_configs = [
|
||||||
);
|
{
|
||||||
|
targets = ["pikvm.dmz"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in [node pikvm];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue