Merge pull request #85165 from mayflower/alertmanager-clustering
prometheus/alertmanager: implement HA clustering support
This commit is contained in:
commit
57087ea280
|
@ -21,6 +21,8 @@ let
|
||||||
"--config.file /tmp/alert-manager-substituted.yaml"
|
"--config.file /tmp/alert-manager-substituted.yaml"
|
||||||
"--web.listen-address ${cfg.listenAddress}:${toString cfg.port}"
|
"--web.listen-address ${cfg.listenAddress}:${toString cfg.port}"
|
||||||
"--log.level ${cfg.logLevel}"
|
"--log.level ${cfg.logLevel}"
|
||||||
|
"--storage.path /var/lib/alertmanager"
|
||||||
|
(toString (map (peer: "--cluster.peer ${peer}:9094") cfg.clusterPeers))
|
||||||
] ++ (optional (cfg.webExternalUrl != null)
|
] ++ (optional (cfg.webExternalUrl != null)
|
||||||
"--web.external-url ${cfg.webExternalUrl}"
|
"--web.external-url ${cfg.webExternalUrl}"
|
||||||
) ++ (optional (cfg.logFormat != null)
|
) ++ (optional (cfg.logFormat != null)
|
||||||
|
@ -120,6 +122,14 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clusterPeers = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
Initial peers for HA cluster.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraFlags = mkOption {
|
extraFlags = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -162,6 +172,7 @@ in {
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
StateDirectory = "alertmanager";
|
||||||
DynamicUser = true; # implies PrivateTmp
|
DynamicUser = true; # implies PrivateTmp
|
||||||
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
WorkingDirectory = "/tmp";
|
WorkingDirectory = "/tmp";
|
||||||
|
|
Loading…
Reference in New Issue