prometheus module: add blackboxExporter
This commit is contained in:
parent
bd45d5fe8d
commit
618b249fc5
@ -309,6 +309,7 @@
|
|||||||
./services/monitoring/nagios.nix
|
./services/monitoring/nagios.nix
|
||||||
./services/monitoring/prometheus/default.nix
|
./services/monitoring/prometheus/default.nix
|
||||||
./services/monitoring/prometheus/alertmanager.nix
|
./services/monitoring/prometheus/alertmanager.nix
|
||||||
|
./services/monitoring/prometheus/blackbox-exporter.nix
|
||||||
./services/monitoring/prometheus/json-exporter.nix
|
./services/monitoring/prometheus/json-exporter.nix
|
||||||
./services/monitoring/prometheus/nginx-exporter.nix
|
./services/monitoring/prometheus/nginx-exporter.nix
|
||||||
./services/monitoring/prometheus/node-exporter.nix
|
./services/monitoring/prometheus/node-exporter.nix
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.prometheus.blackboxExporter;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
services.prometheus.blackboxExporter = {
|
||||||
|
enable = mkEnableOption "prometheus blackbox exporter";
|
||||||
|
|
||||||
|
configFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = ''
|
||||||
|
Path to configuration file.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 9115;
|
||||||
|
description = ''
|
||||||
|
Port to listen on.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraFlags = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
Extra commandline options when launching the blackbox exporter.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.prometheus-blackbox-exporter = {
|
||||||
|
description = "Prometheus exporter for blackbox probes";
|
||||||
|
unitConfig.Documentation = "https://github.com/prometheus/blackbox_exporter";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
User = "nobody";
|
||||||
|
Restart = "always";
|
||||||
|
PrivateTmp = true;
|
||||||
|
WorkingDirectory = /tmp;
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.prometheus-blackbox-exporter}/bin/blackbox_exporter \
|
||||||
|
-web.listen-address :${toString cfg.port} \
|
||||||
|
-config.file ${cfg.configFile} \
|
||||||
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||||
|
'';
|
||||||
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user