2024-03-21 04:26:03 +00:00
|
|
|
{ config, lib, pkgs, options, ... }:
|
2023-01-30 17:58:42 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.prometheus.exporters.shelly;
|
2024-04-24 19:41:17 +01:00
|
|
|
inherit (lib) mkOption types;
|
2023-01-30 17:58:42 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
port = 9784;
|
|
|
|
extraOpts = {
|
|
|
|
metrics-file = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = ''
|
|
|
|
Path to the JSON file with the metric definitions
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serviceOpts = {
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.prometheus-shelly-exporter}/bin/shelly_exporter \
|
|
|
|
-metrics-file ${cfg.metrics-file} \
|
|
|
|
-listen-address ${cfg.listenAddress}:${toString cfg.port}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|