2024-03-21 04:26:03 +00:00
|
|
|
{ config, lib, pkgs, options, ... }:
|
2020-07-16 18:37:09 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.prometheus.exporters.modemmanager;
|
2024-04-24 18:41:17 +00:00
|
|
|
inherit (lib) mkOption types concatStringsSep;
|
2020-07-16 18:37:09 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
port = 9539;
|
|
|
|
extraOpts = {
|
|
|
|
refreshRate = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "5s";
|
2024-04-13 12:54:15 +00:00
|
|
|
description = ''
|
2020-07-16 18:37:09 +00:00
|
|
|
How frequently ModemManager will refresh the extended signal quality
|
|
|
|
information for each modem. The duration should be specified in seconds
|
|
|
|
("5s"), minutes ("1m"), or hours ("1h").
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serviceOpts = {
|
|
|
|
serviceConfig = {
|
|
|
|
# Required in order to authenticate with ModemManager via D-Bus.
|
|
|
|
SupplementaryGroups = "networkmanager";
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.prometheus-modemmanager-exporter}/bin/modemmanager_exporter \
|
|
|
|
-addr ${cfg.listenAddress}:${toString cfg.port} \
|
|
|
|
-rate ${cfg.refreshRate} \
|
|
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
|
|
'';
|
2021-08-08 14:48:49 +00:00
|
|
|
RestrictAddressFamilies = [
|
|
|
|
# Need AF_UNIX to collect data
|
|
|
|
"AF_UNIX"
|
|
|
|
];
|
2020-07-16 18:37:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|