diff options
author | Jos van Bakel <jos@codeaddict.org> | 2024-02-25 10:23:49 +0100 |
---|---|---|
committer | Jos van Bakel <jos@codeaddict.org> | 2024-04-10 17:12:49 +0200 |
commit | 2e10f813fe216bb6e6e62c28dee8bad53a13b661 (patch) | |
tree | 223bb6047e52d454cf4f5e1c21db3f83623219cc /nixos/modules/services/monitoring | |
parent | 6347cd23dcc2b020dd4ea5bfe5871be35e95ae63 (diff) |
nixos/prometheus-nats-exporter: new module
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/nats.nix | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 640c6c339cf62..0331a07b5109d 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -55,6 +55,7 @@ let "modemmanager" "mongodb" "mysqld" + "nats" "nextcloud" "nginx" "nginxlog" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/nats.nix b/nixos/modules/services/monitoring/prometheus/exporters/nats.nix new file mode 100644 index 0000000000000..83e60426f5ed2 --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/nats.nix @@ -0,0 +1,34 @@ +{ 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} + ''; + }; + }; +} |