nixos/services.prometheus.exporters.ipmi: new module
Bringing in new https://github.com/prometheus-community/ipmi_exporter exporter into existing Prometheus exporters framework.
This commit is contained in:
parent
ca1690c2ed
commit
866d977212
|
@ -258,6 +258,14 @@
|
|||
<link xlink:href="options.html#opt-services.patroni.enable">services.patroni</link>.
|
||||
</para>
|
||||
</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>,
|
||||
|
|
|
@ -92,6 +92,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. -->
|
||||
|
|
|
@ -36,6 +36,7 @@ let
|
|||
"fastly"
|
||||
"fritzbox"
|
||||
"influxdb"
|
||||
"ipmi"
|
||||
"json"
|
||||
"jitsi"
|
||||
"kea"
|
||||
|
@ -242,6 +243,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)
|
||||
);
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue