summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-01-30 18:58:42 +0100
committerPol Dellaiera <pol.dellaiera@protonmail.com>2023-02-01 19:49:33 +0100
commit9f17e032e7e7c34ddf8c04472bee9d627951fc44 (patch)
tree6fc143f24d44fc26e6a68098a51090035610e768 /nixos/modules
parent79ce805761aa0acedb827141dee46c1ec0b059f4 (diff)
prometheus-shelly-exporter: add NixOS module
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters.nix1
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/shelly.nix27
2 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix
index f3fbfb149ad7..b2132b62d678 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -64,6 +64,7 @@ let
"rspamd"
"rtl_433"
"script"
+ "shelly"
"snmp"
"smartctl"
"smokeping"
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/shelly.nix b/nixos/modules/services/monitoring/prometheus/exporters/shelly.nix
new file mode 100644
index 000000000000..b9cfd1b1e84a
--- /dev/null
+++ b/nixos/modules/services/monitoring/prometheus/exporters/shelly.nix
@@ -0,0 +1,27 @@
+{ config, lib, pkgs, options }:
+
+with lib;
+
+let
+ cfg = config.services.prometheus.exporters.shelly;
+in
+{
+ port = 9784;
+ extraOpts = {
+ metrics-file = mkOption {
+ type = types.path;
+ description = lib.mdDoc ''
+ 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}
+ '';
+ };
+ };
+}