prometheus-collectd-exporter: fix options for new version

This commit is contained in:
Robin Gloster 2021-05-11 14:57:21 -05:00
parent b2956ce654
commit 9438b12f99
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF

View File

@ -41,11 +41,11 @@ in
}; };
logFormat = mkOption { logFormat = mkOption {
type = types.str; type = types.enum [ "logfmt" "json" ];
default = "logger:stderr"; default = "logfmt";
example = "logger:syslog?appname=bob&local=7 or logger:stdout?json=true"; example = "json";
description = '' description = ''
Set the log target and format. Set the log format.
''; '';
}; };
@ -59,16 +59,16 @@ in
}; };
serviceOpts = let serviceOpts = let
collectSettingsArgs = if (cfg.collectdBinary.enable) then '' collectSettingsArgs = if (cfg.collectdBinary.enable) then ''
-collectd.listen-address ${cfg.collectdBinary.listenAddress}:${toString cfg.collectdBinary.port} \ --collectd.listen-address ${cfg.collectdBinary.listenAddress}:${toString cfg.collectdBinary.port} \
-collectd.security-level ${cfg.collectdBinary.securityLevel} \ --collectd.security-level ${cfg.collectdBinary.securityLevel} \
'' else ""; '' else "";
in { in {
serviceConfig = { serviceConfig = {
ExecStart = '' ExecStart = ''
${pkgs.prometheus-collectd-exporter}/bin/collectd_exporter \ ${pkgs.prometheus-collectd-exporter}/bin/collectd_exporter \
-log.format ${escapeShellArg cfg.logFormat} \ --log.format ${escapeShellArg cfg.logFormat} \
-log.level ${cfg.logLevel} \ --log.level ${cfg.logLevel} \
-web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
${collectSettingsArgs} \ ${collectSettingsArgs} \
${concatStringsSep " \\\n " cfg.extraFlags} ${concatStringsSep " \\\n " cfg.extraFlags}
''; '';