Unverified Commit d2b7e679 authored by Aaron Andersen's avatar Aaron Andersen Committed by GitHub
Browse files

Merge pull request #291321 from c0deaddict/feature/nats-exporter

nixos/prometheus-nats-exporter: new module
parents 86e1157d 2e10f813
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m

- [Uni-Sync](https://github.com/EightB1ts/uni-sync), a synchronization tool for Lian Li Uni Controllers. Available as [hardware.uni-sync](#opt-hardware.uni-sync.enable)

- [prometheus-nats-exporter](https://github.com/nats-io/prometheus-nats-exporter), a Prometheus exporter for NATS. Available as [services.prometheus.exporters.nats](#opt-services.prometheus.exporters.nats.enable).

## Backward Incompatibilities {#sec-release-24.05-incompatibilities}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ let
    "modemmanager"
    "mongodb"
    "mysqld"
    "nats"
    "nextcloud"
    "nginx"
    "nginxlog"
+34 −0
Original line number Diff line number Diff line
{ config, lib, pkgs, options, ... }:

with lib;

let

  cfg = config.services.prometheus.exporters.nats;

in
{
  port = 7777;

  extraOpts = {
    url = mkOption {
      type = types.str;
      default = "http://127.0.0.1:8222";
      description = ''
        NATS monitor endpoint to query.
      '';
    };
  };

  serviceOpts = {
    serviceConfig = {
      ExecStart = ''
        ${pkgs.prometheus-nats-exporter}/bin/prometheus-nats-exporter \
          -addr ${cfg.listenAddress} \
          -port ${toString cfg.port} \
          ${concatStringsSep " \\\n  " cfg.extraFlags} \
          ${cfg.url}
      '';
    };
  };
}