1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.services.prometheus.exporters.libvirt;
10in
11{
12 port = 9177;
13 extraOpts = {
14 libvirtUri = lib.mkOption {
15 type = lib.types.str;
16 default = "qemu:///system";
17 description = "Libvirt URI from which to extract metrics";
18 };
19 };
20 serviceOpts = {
21 serviceConfig = {
22 ExecStart = ''
23 ${lib.getExe pkgs.prometheus-libvirt-exporter} \
24 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
25 --libvirt.uri ${cfg.libvirtUri} ${lib.concatStringsSep " " cfg.extraFlags}
26 '';
27 };
28 };
29}