diff options
author | Naïm Favier <n@monade.li> | 2021-10-03 18:06:03 +0200 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2021-10-04 12:47:20 +0200 |
commit | 2ddc335e6f32b875e14ad9610101325b306a0add (patch) | |
tree | 2a4591c137cb363a6ec09f529d587a10aa7a0bc7 /nixos/modules/services/monitoring/prometheus | |
parent | 330b1e08b8df4e1f0100a0a7810ec3157749e5ee (diff) | |
download | nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.gz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.bz2 nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.lz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.xz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.zst nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.zip |
nixos/doc: clean up defaults and examples
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus')
16 files changed, 34 insertions, 38 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/alertmanager.nix b/nixos/modules/services/monitoring/prometheus/alertmanager.nix index 1b02ebf3704..1f396634ae0 100644 --- a/nixos/modules/services/monitoring/prometheus/alertmanager.nix +++ b/nixos/modules/services/monitoring/prometheus/alertmanager.nix @@ -45,7 +45,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus-alertmanager; - defaultText = "pkgs.alertmanager"; + defaultText = literalExpression "pkgs.alertmanager"; description = '' Package that should be used for alertmanager. ''; diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index 1161d18ab14..d2b37cf688b 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -692,7 +692,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus; - defaultText = "pkgs.prometheus"; + defaultText = literalExpression "pkgs.prometheus"; description = '' The prometheus package that should be used. ''; @@ -833,7 +833,7 @@ in { alertmanagers = mkOption { type = types.listOf types.attrs; - example = literalExample '' + example = literalExpression '' [ { scheme = "https"; path_prefix = "/alertmanager"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 83de9a3f5eb..99dfea6daa7 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, options, ... }: let - inherit (lib) concatStrings foldl foldl' genAttrs literalExample maintainers + inherit (lib) concatStrings foldl foldl' genAttrs literalExpression maintainers mapAttrsToList mkDefault mkEnableOption mkIf mkMerge mkOption optional types mkOptionDefault flip attrNames; @@ -109,7 +109,7 @@ let firewallFilter = mkOption { type = types.nullOr types.str; default = null; - example = literalExample '' + example = literalExpression '' "-i eth0 -p tcp -m tcp --dport ${toString port}" ''; description = '' @@ -204,7 +204,7 @@ in }; description = "Prometheus exporter configuration"; default = {}; - example = literalExample '' + example = literalExpression '' { node = { enable = true; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix index 7557480ac06..e9be39608fc 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix @@ -36,7 +36,7 @@ in queues = mkOption { type = with types; nullOr (listOf str); default = null; - example = literalExample ''[ "my-queue1" "my-queue2" ]''; + example = literalExpression ''[ "my-queue1" "my-queue2" ]''; description = '' Which specific queues to process. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix index 6a35f46308f..b85e5461f21 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix @@ -9,7 +9,7 @@ in { extraOpts = { brokers = mkOption { type = types.listOf types.str; - example = literalExample ''[ "kafka.example.org:19092" ]''; + example = literalExpression ''[ "kafka.example.org:19092" ]''; description = "List of Kafka brokers to connect to."; }; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix index 9677281f877..0571325c5d9 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix @@ -13,7 +13,7 @@ in { extraOpts = { controlSocketPaths = mkOption { type = types.listOf types.str; - example = literalExample '' + example = literalExpression '' [ "/run/kea/kea-dhcp4.socket" "/run/kea/kea-dhcp6.socket" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix index 46c28fe0a57..2acaac293b6 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix @@ -10,7 +10,7 @@ in { knotLibraryPath = mkOption { type = types.str; default = "${pkgs.knot-dns.out}/lib/libknot.so"; - defaultText = "\${pkgs.knot-dns}/lib/libknot.so"; + defaultText = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"''; description = '' Path to the library of <package>knot-dns</package>. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix index 7e196149fbb..956bd96aa45 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix @@ -100,7 +100,7 @@ let servers = mkOption { type = types.listOf (types.submodule serverOptions); default = []; - example = literalExample '' + example = literalExpression '' [ { name = "testserver"; server = "smtp.domain.tld"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix index 62c2cc56847..8f9536b702a 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix @@ -15,7 +15,7 @@ in Path to a mikrotik exporter configuration file. Mutually exclusive with <option>configuration</option> option. ''; - example = literalExample "./mikrotik.yml"; + example = literalExpression "./mikrotik.yml"; }; configuration = mkOption { @@ -28,7 +28,7 @@ in See <link xlink:href="https://github.com/nshttpd/mikrotik-exporter/blob/master/README.md"/> for the description of the configuration file format. ''; - example = literalExample '' + example = literalExpression '' { devices = [ { diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node.nix b/nixos/modules/services/monitoring/prometheus/exporters/node.nix index adc2abe0b91..ed594460d95 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/node.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/node.nix @@ -11,7 +11,7 @@ in enabledCollectors = mkOption { type = types.listOf types.str; default = []; - example = ''[ "systemd" ]''; + example = [ "systemd" ]; description = '' Collectors to enable. The collectors listed here are enabled in addition to the default ones. ''; @@ -19,7 +19,7 @@ in disabledCollectors = mkOption { type = types.listOf types.str; default = []; - example = ''[ "timex" ]''; + example = [ "timex" ]; description = '' Collectors to disable which are enabled by default. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix index 21c2e5eab4c..4bc27ebc32f 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix @@ -42,8 +42,8 @@ in }; piholePort = mkOption { type = types.port; - default = "80"; - example = "443"; + default = 80; + example = 443; description = '' The port pihole webinterface is reachable on ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/process.nix b/nixos/modules/services/monitoring/prometheus/exporters/process.nix index e3b3d18367f..1e9c402fb55 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/process.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/process.nix @@ -11,14 +11,12 @@ in extraOpts = { settings.process_names = mkOption { type = types.listOf types.anything; - default = {}; - example = literalExample '' - { - process_names = [ - # Remove nix store path from process name - { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; } - ]; - } + default = []; + example = literalExpression '' + [ + # Remove nix store path from process name + { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; } + ] ''; description = '' All settings expressed as an Nix attrset. diff --git a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix index 994670a376e..ed985751e42 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix @@ -62,8 +62,8 @@ in default = { host = config.networking.hostName; }; - defaultText = "{ host = config.networking.hostName; }"; - example = literalExample '' + defaultText = literalExpression "{ host = config.networking.hostName; }"; + example = literalExpression '' { host = config.networking.hostName; custom_label = "some_value"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/script.nix b/nixos/modules/services/monitoring/prometheus/exporters/script.nix index 104ab859f2e..a805a0ad335 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/script.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/script.nix @@ -30,7 +30,7 @@ in }; }; }); - example = literalExample '' + example = literalExpression '' { scripts = [ { name = "sleep"; script = "sleep 5"; } diff --git a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix index 01276366e97..de42663e67f 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix @@ -14,7 +14,7 @@ in description = '' Path to a snmp exporter configuration file. Mutually exclusive with 'configuration' option. ''; - example = "./snmp.yml"; + example = literalExpression "./snmp.yml"; }; configuration = mkOption { @@ -23,16 +23,14 @@ in description = '' Snmp exporter configuration as nix attribute set. Mutually exclusive with 'configurationPath' option. ''; - example = '' - { - "default" = { - "version" = 2; - "auth" = { - "community" = "public"; - }; + example = { + "default" = { + "version" = 2; + "auth" = { + "community" = "public"; }; }; - ''; + }; }; logFormat = mkOption { diff --git a/nixos/modules/services/monitoring/prometheus/pushgateway.nix b/nixos/modules/services/monitoring/prometheus/pushgateway.nix index f8fcc3eb97e..01b99376243 100644 --- a/nixos/modules/services/monitoring/prometheus/pushgateway.nix +++ b/nixos/modules/services/monitoring/prometheus/pushgateway.nix @@ -26,7 +26,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus-pushgateway; - defaultText = "pkgs.prometheus-pushgateway"; + defaultText = literalExpression "pkgs.prometheus-pushgateway"; description = '' Package that should be used for the prometheus pushgateway. ''; |