mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-22 03:53:47 +00:00
Merge pull request #213534 from drupol/add-prometheus-shelly-exporter
prometheus-shelly-exporter: init at 1.0.0
This commit is contained in:
commit
34f5d8cd24
@ -64,6 +64,7 @@ let
|
||||
"rspamd"
|
||||
"rtl_433"
|
||||
"script"
|
||||
"shelly"
|
||||
"snmp"
|
||||
"smartctl"
|
||||
"smokeping"
|
||||
|
@ -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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -1060,6 +1060,20 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
shelly = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
metrics-file = "${pkgs.writeText "test.json" ''{}''}";
|
||||
};
|
||||
exporterTest = ''
|
||||
wait_for_unit("prometheus-shelly-exporter.service")
|
||||
wait_for_open_port(9784)
|
||||
wait_until_succeeds(
|
||||
"curl -sSf 'localhost:9784/metrics'"
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
script = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
24
pkgs/servers/monitoring/prometheus/shelly-exporter.nix
Normal file
24
pkgs/servers/monitoring/prometheus/shelly-exporter.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "shelly_exporter";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aexel90";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-L0TuBDq5eEahQvzqd1WuvmXuQbbblCM+Nvj15IybnVo=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-BCrge2xLT4b4wpYA+zcsH64a/nfV8+HeZF7L49p2gEw=";
|
||||
|
||||
passthru.tests = { inherit (nixosTests.prometheus-exporters) shelly; };
|
||||
|
||||
meta = with lib; {
|
||||
description = "Shelly humidity sensor exporter for prometheus";
|
||||
homepage = "https://github.com/aexel90/shelly_exporter";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [drupol];
|
||||
};
|
||||
}
|
@ -25094,6 +25094,7 @@ with pkgs;
|
||||
prometheus-rtl_433-exporter = callPackage ../servers/monitoring/prometheus/rtl_433-exporter.nix { };
|
||||
prometheus-sachet = callPackage ../servers/monitoring/prometheus/sachet.nix { };
|
||||
prometheus-script-exporter = callPackage ../servers/monitoring/prometheus/script-exporter.nix { };
|
||||
prometheus-shelly-exporter = callPackage ../servers/monitoring/prometheus/shelly-exporter.nix { };
|
||||
prometheus-smartctl-exporter = callPackage ../servers/monitoring/prometheus/smartctl-exporter { };
|
||||
prometheus-smokeping-prober = callPackage ../servers/monitoring/prometheus/smokeping-prober.nix { };
|
||||
prometheus-snmp-exporter = callPackage ../servers/monitoring/prometheus/snmp-exporter.nix { };
|
||||
|
Loading…
Reference in New Issue
Block a user