diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-09-09 00:02:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 00:02:46 +0000 |
commit | 1c0ef46804d0c6edecf281507ec1aa63bc8a130a (patch) | |
tree | f0276b59fb704353368c856b33fef0aa5674fd12 /nixos | |
parent | 60b28ae00d2defbe9e1fdb7b9ceb583ebc4270b5 (diff) | |
parent | 34fde40edd9bf8a8f071cfbfd05965921b16bf66 (diff) | |
download | nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar.gz nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar.bz2 nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar.lz nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar.xz nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.tar.zst nixlib-1c0ef46804d0c6edecf281507ec1aa63bc8a130a.zip |
Merge master into staging-next
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2211.section.xml | 8 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2211.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/config/console.nix | 26 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 17 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/ipmi.nix | 41 | ||||
-rw-r--r-- | nixos/tests/prometheus-exporters.nix | 13 |
6 files changed, 87 insertions, 20 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml index 9bf4877ecec2..7d113462c793 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml @@ -280,6 +280,14 @@ </listitem> <listitem> <para> + <link xlink:href="https://github.com/prometheus-community/ipmi_exporter">Prometheus + IPMI exporter</link>, an IPMI exporter for Prometheus. + Available as + <link linkend="opt-services.prometheus.exporters.ipmi.enable">services.prometheus.exporters.ipmi</link>. + </para> + </listitem> + <listitem> + <para> <link xlink:href="https://writefreely.org">WriteFreely</link>, a simple blogging platform with ActivityPub support. Available as diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md index 3340d5de23a3..83220c306612 100644 --- a/nixos/doc/manual/release-notes/rl-2211.section.md +++ b/nixos/doc/manual/release-notes/rl-2211.section.md @@ -99,6 +99,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [Patroni](https://github.com/zalando/patroni), a template for PostgreSQL HA with ZooKeeper, etcd or Consul. Available as [services.patroni](options.html#opt-services.patroni.enable). +- [Prometheus IPMI exporter](https://github.com/prometheus-community/ipmi_exporter), an IPMI exporter for Prometheus. Available as [services.prometheus.exporters.ipmi](#opt-services.prometheus.exporters.ipmi.enable). + - [WriteFreely](https://writefreely.org), a simple blogging platform with ActivityPub support. Available as [services.writefreely](options.html#opt-services.writefreely.enable). <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> diff --git a/nixos/modules/config/console.nix b/nixos/modules/config/console.nix index 89b75184c5d6..1f8f80a554d0 100644 --- a/nixos/modules/config/console.nix +++ b/nixos/modules/config/console.nix @@ -8,23 +8,14 @@ let makeColor = i: concatMapStringsSep "," (x: "0x" + substring (2*i) 2 x); - isUnicode = '' \ - LOCALE_ARCHIVE=${config.i18n.glibcLocales}/lib/locale/locale-archive \ - LANG=${config.i18n.defaultLocale} \ - LC_IDENTIFICATION=${config.i18n.defaultLocale} \ - locale -k identification-codeset | grep -i UTF-8 \ - ''; + isUnicode = hasSuffix "UTF-8" (toUpper config.i18n.defaultLocale); optimizedKeymap = pkgs.runCommand "keymap" { - nativeBuildInputs = with pkgs.buildPackages; [ kbd locale ]; + nativeBuildInputs = [ pkgs.buildPackages.kbd ]; LOADKEYS_KEYMAP_PATH = "${consoleEnv pkgs.kbd}/share/keymaps/**"; preferLocalBuild = true; } '' - if ${isUnicode} ; then - loadkeys -b -u "${cfg.keyMap}" > $out - else - loadkeys -b "${cfg.keyMap}" > $out - fi + loadkeys -b ${optionalString isUnicode "-u"} "${cfg.keyMap}" > $out ''; # Sadly, systemd-vconsole-setup doesn't support binary keymaps. @@ -139,7 +130,7 @@ in }) (mkIf setVconsole (mkMerge [ - { environment.systemPackages = with pkgs; [ kbd locale ]; + { environment.systemPackages = [ pkgs.kbd ]; # Let systemd-vconsole-setup.service do the work of setting up the # virtual consoles. @@ -148,13 +139,8 @@ in environment.etc.kbd.source = "${consoleEnv pkgs.kbd}/share"; boot.initrd.preLVMCommands = mkIf (!config.boot.initrd.systemd.enable) (mkBefore '' - if ${isUnicode} ; then - kbd_mode -u -C /dev/console - printf "\033%%G" >> /dev/console - else - kbd_mode -a -C /dev/console - printf "\033%%@" >> /dev/console - fi + kbd_mode ${if isUnicode then "-u" else "-a"} -C /dev/console + printf "\033%%${if isUnicode then "G" else "@"}" >> /dev/console loadkmap < ${optimizedKeymap} ${optionalString cfg.earlySetup '' diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 1f31c1f6ca1b..d9e380d42749 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -36,6 +36,7 @@ let "fastly" "fritzbox" "influxdb" + "ipmi" "json" "jitsi" "kea" @@ -243,6 +244,22 @@ in config = mkMerge ([{ assertions = [ { + assertion = cfg.ipmi.enable -> (cfg.ipmi.configFile != null) -> ( + !(lib.hasPrefix "/tmp/" cfg.ipmi.configFile) + ); + message = '' + Config file specified in `services.prometheus.exporters.ipmi.configFile' must + not reside within /tmp - it won't be visible to the systemd service. + ''; + } { + assertion = cfg.ipmi.enable -> (cfg.ipmi.webConfigFile != null) -> ( + !(lib.hasPrefix "/tmp/" cfg.ipmi.webConfigFile) + ); + message = '' + Config file specified in `services.prometheus.exporters.ipmi.webConfigFile' must + not reside within /tmp - it won't be visible to the systemd service. + ''; + } { assertion = cfg.snmp.enable -> ( (cfg.snmp.configurationPath == null) != (cfg.snmp.configuration == null) ); diff --git a/nixos/modules/services/monitoring/prometheus/exporters/ipmi.nix b/nixos/modules/services/monitoring/prometheus/exporters/ipmi.nix new file mode 100644 index 000000000000..55c4f4aa4826 --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/ipmi.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, options }: + +with lib; + +let + logPrefix = "services.prometheus.exporter.ipmi"; + cfg = config.services.prometheus.exporters.ipmi; +in { + port = 9290; + + extraOpts = { + configFile = mkOption { + type = types.nullOr types.path; + default = null; + description = lib.mdDoc '' + Path to configuration file. + ''; + }; + + webConfigFile = mkOption { + type = types.nullOr types.path; + default = null; + description = lib.mdDoc '' + Path to configuration file that can enable TLS or authentication. + ''; + }; + }; + + serviceOpts.serviceConfig = { + ExecStart = with cfg; concatStringsSep " " ([ + "${pkgs.prometheus-ipmi-exporter}/bin/ipmi_exporter" + "--web.listen-address ${listenAddress}:${toString port}" + ] ++ optionals (cfg.webConfigFile != null) [ + "--web.config.file ${escapeShellArg cfg.webConfigFile}" + ] ++ optionals (cfg.configFile != null) [ + "--config.file ${escapeShellArg cfg.configFile}" + ] ++ extraFlags); + + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; + }; +} diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 3b9ca4f0aa6a..596a4eafcd64 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -307,6 +307,19 @@ let ''; }; + ipmi = { + exporterConfig = { + enable = true; + }; + exporterTest = '' + wait_for_unit("prometheus-ipmi-exporter.service") + wait_for_open_port(9290) + succeed( + "curl -sSf http://localhost:9290/metrics | grep 'ipmi_scrape_duration_seconds'" + ) + ''; + }; + jitsi = { exporterConfig = { enable = true; |