1{ config, lib, pkgs, options }:
2
3with lib;
4
5let
6 cfg = config.services.prometheus.exporters.lnd;
7in
8{
9 port = 9092;
10 extraOpts = {
11 lndHost = mkOption {
12 type = types.str;
13 default = "localhost:10009";
14 description = ''
15 lnd instance gRPC address:port.
16 '';
17 };
18
19 lndTlsPath = mkOption {
20 type = types.path;
21 description = ''
22 Path to lnd TLS certificate.
23 '';
24 };
25
26 lndMacaroonDir = mkOption {
27 type = types.path;
28 description = ''
29 Path to lnd macaroons.
30 '';
31 };
32 };
33 serviceOpts.serviceConfig = {
34 ExecStart = ''
35 ${pkgs.prometheus-lnd-exporter}/bin/lndmon \
36 --prometheus.listenaddr=${cfg.listenAddress}:${toString cfg.port} \
37 --prometheus.logdir=/var/log/prometheus-lnd-exporter \
38 --lnd.host=${cfg.lndHost} \
39 --lnd.tlspath=${cfg.lndTlsPath} \
40 --lnd.macaroondir=${cfg.lndMacaroonDir} \
41 ${concatStringsSep " \\\n " cfg.extraFlags}
42 '';
43 LogsDirectory = "prometheus-lnd-exporter";
44 ReadOnlyPaths = [ cfg.lndTlsPath cfg.lndMacaroonDir ];
45 };
46}