Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 015541ea6a35
Choose a base ref
...
head repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 035269437312
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 13, 2019

  1. Allow the definition of extra options on commandline

    I stumbled upon an issue with the Alertmanager that required
    an additional comand line option. See https://groups.google.com/forum/#!msg/prometheus-users/-5wd-P13xCI/lGLBHHgnBgAJ
    
    (cherry picked from commit 69e4e49)
    
    Without this, Nixos machines on 18.09 that have no private IP addresses cannot start Alertmanager.
    NixOS/nixpkgs#46068
    NixOS/nixpkgs#45302
    azazel75 authored and tomfitzhenry committed Jan 13, 2019
    Copy the full SHA
    ef7c9c4 View commit details
  2. Merge pull request #53877 from tomfitzhenry/cherry-pick-alertmanager-…

    …extra-flags
    
    Alertmanager: Allow the definition of extra options on commandline
    samueldr authored Jan 13, 2019
    Copy the full SHA
    0352694 View commit details
Showing with 18 additions and 5 deletions.
  1. +18 −5 nixos/modules/services/monitoring/prometheus/alertmanager.nix
23 changes: 18 additions & 5 deletions nixos/modules/services/monitoring/prometheus/alertmanager.nix
Original file line number Diff line number Diff line change
@@ -9,6 +9,15 @@ let
if cfg.configText != null then
pkgs.writeText "alertmanager.yml" cfg.configText
else mkConfigFile;
cmdlineArgs = cfg.extraFlags ++ [
"--config.file ${alertmanagerYml}"
"--web.listen-address ${cfg.listenAddress}:${toString cfg.port}"
"--log.level ${cfg.logLevel}"
] ++ (optional (cfg.webExternalUrl != null)
"--web.external-url ${cfg.webExternalUrl}"
) ++ (optional (cfg.logFormat != null)
"--log.format ${cfg.logFormat}"
);
in {
options = {
services.prometheus.alertmanager = {
@@ -99,6 +108,14 @@ in {
Open port in firewall for incoming connections.
'';
};

extraFlags = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra commandline options when launching the Alertmanager.
'';
};
};
};

@@ -111,11 +128,7 @@ in {
after = [ "network.target" ];
script = ''
${pkgs.prometheus-alertmanager.bin}/bin/alertmanager \
--config.file ${alertmanagerYml} \
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
--log.level ${cfg.logLevel} \
${optionalString (cfg.webExternalUrl != null) ''--web.external-url ${cfg.webExternalUrl} \''}
${optionalString (cfg.logFormat != null) "--log.format ${cfg.logFormat}"}
${concatStringsSep " \\\n " cmdlineArgs}
'';

serviceConfig = {