Changes for Prometheus
This commit is contained in:
parent
63b80fb5dc
commit
83fda1a391
@ -49,9 +49,9 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
gssapi-realm = mkOption {
|
gssapi-realm = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
description = "GSSAPI (i.e. Kerberos) realm of this domain.";
|
description = "GSSAPI (i.e. Kerberos) realm of this domain.";
|
||||||
default = toUpper domain;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
kerberos-master = mkOption {
|
kerberos-master = mkOption {
|
||||||
|
@ -7,11 +7,11 @@ let
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options.fudo.prometheus = {
|
options.fudo.prometheus = with types; {
|
||||||
enable = mkEnableOption "Fudo Prometheus Data-Gathering Server";
|
enable = mkEnableOption "Fudo Prometheus Data-Gathering Server";
|
||||||
|
|
||||||
service-discovery-dns = mkOption {
|
service-discovery-dns = mkOption {
|
||||||
type = with types; attrsOf (listOf str);
|
type = attrsOf (listOf str);
|
||||||
description = ''
|
description = ''
|
||||||
A map of exporter type to a list of domains to use for service discovery.
|
A map of exporter type to a list of domains to use for service discovery.
|
||||||
'';
|
'';
|
||||||
@ -28,7 +28,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static-targets = mkOption {
|
static-targets = mkOption {
|
||||||
type = with types; attrsOf (listOf str);
|
type = attrsOf (listOf str);
|
||||||
description = ''
|
description = ''
|
||||||
A map of exporter type to a list of host:ports from which to collect metrics.
|
A map of exporter type to a list of host:ports from which to collect metrics.
|
||||||
'';
|
'';
|
||||||
@ -44,7 +44,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
docker-hosts = mkOption {
|
docker-hosts = mkOption {
|
||||||
type = with types; listOf str;
|
type = listOf str;
|
||||||
description = ''
|
description = ''
|
||||||
A list of explicit <host:port> docker targets from which to gather node data.
|
A list of explicit <host:port> docker targets from which to gather node data.
|
||||||
'';
|
'';
|
||||||
@ -52,7 +52,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
push-url = mkOption {
|
push-url = mkOption {
|
||||||
type = with types; nullOr str;
|
type = nullOr str;
|
||||||
description = ''
|
description = ''
|
||||||
The <host:port> that services can use to manually push data.
|
The <host:port> that services can use to manually push data.
|
||||||
'';
|
'';
|
||||||
@ -60,7 +60,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
push-address = mkOption {
|
push-address = mkOption {
|
||||||
type = with types; nullOr str;
|
type = nullOr str;
|
||||||
description = ''
|
description = ''
|
||||||
The <host:port> address on which to listen for incoming data.
|
The <host:port> address on which to listen for incoming data.
|
||||||
'';
|
'';
|
||||||
@ -68,10 +68,16 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
hostname = mkOption {
|
hostname = mkOption {
|
||||||
type = with types; str;
|
type = str;
|
||||||
description = "The hostname upon which Prometheus will serve.";
|
description = "The hostname upon which Prometheus will serve.";
|
||||||
example = "my-metrics-server.fudo.org";
|
example = "my-metrics-server.fudo.org";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state-directory = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "Directory at which to store Prometheus state.";
|
||||||
|
default = "/var/lib/prometheus";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -51,13 +51,11 @@ let
|
|||||||
lines = splitString "\n" zonedata;
|
lines = splitString "\n" zonedata;
|
||||||
in concatStringsSep "\n" (map formatter lines);
|
in concatStringsSep "\n" (map formatter lines);
|
||||||
|
|
||||||
makeSrvRecords = protocol: service: records: let
|
makeSrvRecords = protocol: service: records:
|
||||||
service-blah = service;
|
join-lines (map (record:
|
||||||
record-blah = records;
|
"_${service}._${protocol} IN SRV ${toString record.priority} ${
|
||||||
in join-lines (map (record:
|
toString record.weight
|
||||||
"_${service}._${protocol} IN SRV ${toString record.priority} ${
|
} ${toString record.port} ${record.host}.") records);
|
||||||
toString record.weight
|
|
||||||
} ${toString record.port} ${record.host}.") records);
|
|
||||||
|
|
||||||
makeSrvProtocolRecords = protocol: services:
|
makeSrvProtocolRecords = protocol: services:
|
||||||
join-lines (mapAttrsToList (makeSrvRecords protocol) services);
|
join-lines (mapAttrsToList (makeSrvRecords protocol) services);
|
||||||
@ -96,13 +94,10 @@ let
|
|||||||
"${hostname} IN A ${nethost-data.ipv4-address}";
|
"${hostname} IN A ${nethost-data.ipv4-address}";
|
||||||
aaaa-record = optional (nethost-data.ipv6-address != null)
|
aaaa-record = optional (nethost-data.ipv6-address != null)
|
||||||
"${hostname} IN AAAA ${nethost-data.ipv6-address}";
|
"${hostname} IN AAAA ${nethost-data.ipv6-address}";
|
||||||
cname-record = optional (nethost-data.authoritative-hostname != null)
|
|
||||||
"${hostname} IN CNAME ${nethost-data.authoritative-hostname}";
|
|
||||||
description-record = optional (nethost-data.description != null)
|
description-record = optional (nethost-data.description != null)
|
||||||
''${hostname} IN TXT "${nethost-data.description}"'';
|
''${hostname} IN TXT "${nethost-data.description}"'';
|
||||||
in join-lines (a-record ++
|
in join-lines (a-record ++
|
||||||
aaaa-record ++
|
aaaa-record ++
|
||||||
cname-record ++
|
|
||||||
sshfp-records ++
|
sshfp-records ++
|
||||||
description-record);
|
description-record);
|
||||||
|
|
||||||
@ -114,26 +109,11 @@ let
|
|||||||
|
|
||||||
mxRecords = mxs: map (mx: "@ IN MX 10 ${mx}.") mxs;
|
mxRecords = mxs: map (mx: "@ IN MX 10 ${mx}.") mxs;
|
||||||
|
|
||||||
nsRecords = domain: ns-hosts:
|
nsRecords = map (ns-host: "@ IN NS ${ns-host}");
|
||||||
mapAttrsToList (host: _: "@ IN NS ${host}.${domain}.") ns-hosts;
|
|
||||||
|
|
||||||
flatmapAttrsToList = f: attrs:
|
flatmapAttrsToList = f: attrs:
|
||||||
foldr (a: b: a ++ b) [] (mapAttrsToList f attrs);
|
foldr (a: b: a ++ b) [] (mapAttrsToList f attrs);
|
||||||
|
|
||||||
# nsARecords = _: ns-hosts: let
|
|
||||||
# a-record = host: hostOpts: optional (hostOpts.ipv4-address != null)
|
|
||||||
# "${host} IN A ${hostOpts.ipv4-address}";
|
|
||||||
# aaaa-record = host: hostOpts: optional (hostOpts.ipv6-address != null)
|
|
||||||
# "${host} IN AAAA ${hostOpts.ipv6-address}";
|
|
||||||
# description-record = host: hostOpts: optional (hostOpts.description != null)
|
|
||||||
# ''${host} IN TXT "${hostOpts.description}"'';
|
|
||||||
# in flatmapAttrsToList
|
|
||||||
# (host: hostOpts:
|
|
||||||
# (a-record host hostOpts) ++
|
|
||||||
# (aaaa-record host hostOpts) ++
|
|
||||||
# (description-record host hostOpts))
|
|
||||||
# ns-hosts;
|
|
||||||
|
|
||||||
|
|
||||||
srvRecordPair = domain: protocol: service: record: {
|
srvRecordPair = domain: protocol: service: record: {
|
||||||
"_${service}._${protocol}.${domain}" =
|
"_${service}._${protocol}.${domain}" =
|
||||||
@ -142,7 +122,7 @@ let
|
|||||||
} ${record.host}.";
|
} ${record.host}.";
|
||||||
};
|
};
|
||||||
|
|
||||||
domain-record = dom: zone: ''
|
domain-records = dom: zone: ''
|
||||||
$ORIGIN ${dom}.
|
$ORIGIN ${dom}.
|
||||||
$TTL ${zone.default-ttl}
|
$TTL ${zone.default-ttl}
|
||||||
|
|
||||||
@ -156,9 +136,7 @@ let
|
|||||||
${optionalString (zone.gssapi-realm != null)
|
${optionalString (zone.gssapi-realm != null)
|
||||||
''_kerberos IN TXT "${zone.gssapi-realm}"''}
|
''_kerberos IN TXT "${zone.gssapi-realm}"''}
|
||||||
|
|
||||||
${join-lines (nsRecords dom zone.nameservers)}
|
${join-lines (nsRecords zone.nameservers)}
|
||||||
|
|
||||||
${join-lines (mapAttrsToList hostRecords zone.nameservers)}
|
|
||||||
|
|
||||||
${join-lines (mapAttrsToList makeSrvProtocolRecords zone.srv-records)}
|
${join-lines (mapAttrsToList makeSrvProtocolRecords zone.srv-records)}
|
||||||
|
|
||||||
@ -171,7 +149,7 @@ let
|
|||||||
${join-lines zone.verbatim-dns-records}
|
${join-lines zone.verbatim-dns-records}
|
||||||
|
|
||||||
${join-lines (mapAttrsToList
|
${join-lines (mapAttrsToList
|
||||||
(subdom: subdomCfg: domain-record "${subdom}.${dom}" subdomCfg)
|
(subdom: subdomCfg: domain-records "${subdom}.${dom}" subdomCfg)
|
||||||
zone.subdomains)}
|
zone.subdomains)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -203,6 +181,6 @@ in rec {
|
|||||||
3w
|
3w
|
||||||
5m)
|
5m)
|
||||||
|
|
||||||
${domain-record dom zone}
|
${domain-records dom zone}
|
||||||
'');
|
'');
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,9 @@ with lib;
|
|||||||
};
|
};
|
||||||
|
|
||||||
mac-address = mkOption {
|
mac-address = mkOption {
|
||||||
type = nullOr types.str;
|
|
||||||
description =
|
|
||||||
"The MAC address of a given host, if desired for IP reservation.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
authoritative-hostname = mkOption {
|
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description =
|
description =
|
||||||
"The 'real' hostname of this host, i.e. CNAME. Prefer aliases!";
|
"The MAC address of a given host, if desired for IP reservation.";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,15 +48,13 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
nameservers = mkOption {
|
nameservers = mkOption {
|
||||||
type = attrsOf (submodule networkHostOpts);
|
type = listOf str;
|
||||||
description = "Map of domain nameservers to host data.";
|
description = "List of zone nameservers.";
|
||||||
example = {
|
example = [
|
||||||
"ns1" = {
|
"ns1.fudo.org."
|
||||||
ipv4-address = "1.1.1.1";
|
"10.0.0.1"
|
||||||
ipv6-address = "1::1";
|
];
|
||||||
};
|
default = [];
|
||||||
};
|
|
||||||
default = {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
srv-records = mkOption {
|
srv-records = mkOption {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user