2019-07-17 13:19:18 +01:00
|
|
|
{ config, lib, pkgs, options }:
|
2018-03-09 20:33:09 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.prometheus.exporters.node;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
port = 9100;
|
|
|
|
extraOpts = {
|
|
|
|
enabledCollectors = mkOption {
|
2019-08-08 21:48:27 +01:00
|
|
|
type = types.listOf types.str;
|
2018-03-09 20:33:09 +00:00
|
|
|
default = [];
|
|
|
|
example = ''[ "systemd" ]'';
|
|
|
|
description = ''
|
|
|
|
Collectors to enable. The collectors listed here are enabled in addition to the default ones.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
disabledCollectors = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = ''[ "timex" ]'';
|
|
|
|
description = ''
|
|
|
|
Collectors to disable which are enabled by default.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serviceOpts = {
|
|
|
|
serviceConfig = {
|
2019-08-02 14:23:23 +01:00
|
|
|
DynamicUser = false;
|
2018-03-20 18:42:00 +00:00
|
|
|
RuntimeDirectory = "prometheus-node-exporter";
|
2018-03-09 20:33:09 +00:00
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.prometheus-node-exporter}/bin/node_exporter \
|
|
|
|
${concatMapStringsSep " " (x: "--collector." + x) cfg.enabledCollectors} \
|
|
|
|
${concatMapStringsSep " " (x: "--no-collector." + x) cfg.disabledCollectors} \
|
2019-06-20 22:04:36 +01:00
|
|
|
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
|
2018-03-09 20:33:09 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|