Skip to content

Commit

Permalink
modules/alertmanager: add clusterAdvertiseAddress option
Browse files Browse the repository at this point in the history
Alertmanager fails to start when the memberlist library cannot find any private
IP addresses on the system.  This is a safeguard to avoid exposing cluster ports
over the internet unintentionally.  The workaround is to pass the
--cluster.advertise-address argument to AlertManager.

See also:
prometheus/alertmanager#1437
prometheus/alertmanager#1434
  • Loading branch information
eqyiel committed Aug 17, 2018
1 parent 6afd19e commit e3a0c80
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nixos/modules/services/monitoring/prometheus/alertmanager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ in {
'';
};

clusterAdvertiseAddress = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
If Alertmanager cannot find any private IP address on the host
machine, will fail to start unless an explicit advertise address is
provided. In that case, you can use the machine's public IP address
here.
'';
};

configuration = mkOption {
type = types.attrs;
default = {};
Expand Down Expand Up @@ -115,6 +126,7 @@ in {
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
--log.level ${cfg.logLevel} \
${optionalString (cfg.webExternalUrl != null) ''--web.external-url ${cfg.webExternalUrl} \''}
${optionalString (cfg.clusterAdvertiseAddress != null) ''--cluster.advertise-address ${cfg.clusterAdvertiseAddress} \''}
${optionalString (cfg.logFormat != null) "--log.format ${cfg.logFormat}"}
'';

Expand Down

0 comments on commit e3a0c80

Please sign in to comment.