2024-03-21 05:26:03 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
options,
|
|
|
|
...
|
|
|
|
}:
|
2022-09-02 09:38:11 -04:00
|
|
|
|
|
|
|
let
|
|
|
|
logPrefix = "services.prometheus.exporter.ipmi";
|
|
|
|
cfg = config.services.prometheus.exporters.ipmi;
|
2024-04-24 14:41:17 -04:00
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
concatStringsSep
|
|
|
|
optionals
|
|
|
|
escapeShellArg
|
|
|
|
;
|
2022-09-02 09:38:11 -04:00
|
|
|
in
|
|
|
|
{
|
|
|
|
port = 9290;
|
|
|
|
|
|
|
|
extraOpts = {
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
Path to configuration file.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
webConfigFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
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";
|
2023-05-23 21:00:00 +02:00
|
|
|
RestrictAddressFamilies = [
|
|
|
|
"AF_INET"
|
|
|
|
"AF_INET6"
|
|
|
|
"AF_UNIX"
|
|
|
|
];
|
2022-09-02 09:38:11 -04:00
|
|
|
};
|
|
|
|
}
|