summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMatthew Justin Bauer <mjbauer95@gmail.com>2018-06-01 23:18:49 -0400
committerGitHub <noreply@github.com>2018-06-01 23:18:49 -0400
commitbc7ea93a47c0d7b1837dc3a2b095dcb57585f46f (patch)
tree72432eb840f7a81874a365010c021c418253feb4 /nixos
parente4746bdf15c60566e7dfd86ccb9903da97d41fe4 (diff)
parente2dfac67f7feee6c53b1df3e42c89c649278df6b (diff)
downloadnixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar.gz
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar.bz2
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar.lz
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar.xz
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.tar.zst
nixlib-bc7ea93a47c0d7b1837dc3a2b095dcb57585f46f.zip
Merge pull request #40028 from WilliButz/add-dnsmasq-exporter
prometheus-dnsmasq-exporter: init at 2018-05-05, add module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters.nix1
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix39
2 files changed, 40 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix
index 780448d8bad8..8d2c303a69e8 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -20,6 +20,7 @@ let
   exporterOpts = {
     blackbox  = import ./exporters/blackbox.nix  { inherit config lib pkgs; };
     collectd  = import ./exporters/collectd.nix  { inherit config lib pkgs; };
+    dnsmasq   = import ./exporters/dnsmasq.nix   { inherit config lib pkgs; };
     dovecot   = import ./exporters/dovecot.nix   { inherit config lib pkgs; };
     fritzbox  = import ./exporters/fritzbox.nix  { inherit config lib pkgs; };
     json      = import ./exporters/json.nix      { inherit config lib pkgs; };
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix b/nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix
new file mode 100644
index 000000000000..b1fab85109af
--- /dev/null
+++ b/nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix
@@ -0,0 +1,39 @@
+{ config, lib, pkgs }:
+
+with lib;
+
+let
+  cfg = config.services.prometheus.exporters.dnsmasq;
+in
+{
+  port = 9153;
+  extraOpts = {
+    dnsmasqListenAddress = mkOption {
+      type = types.str;
+      default = "localhost:53";
+      description = ''
+        Address on which dnsmasq listens.
+      '';
+    };
+    leasesPath = mkOption {
+      type = types.path;
+      default = "/var/lib/misc/dnsmasq.leases";
+      example = "/var/lib/dnsmasq/dnsmasq.leases";
+      description = ''
+        Path to the <literal>dnsmasq.leases</literal> file.
+      '';
+    };
+  };
+  serviceOpts = {
+    serviceConfig = {
+      DynamicUser = true;
+      ExecStart = ''
+        ${pkgs.prometheus-dnsmasq-exporter}/bin/dnsmasq_exporter \
+          --listen ${cfg.listenAddress}:${toString cfg.port} \
+          --dnsmasq ${cfg.dnsmasqListenAddress} \
+          --leases_path ${cfg.leasesPath} \
+          ${concatStringsSep " \\\n  " cfg.extraFlags}
+      '';
+    };
+  };
+}