nixos/prometheus-nats-exporter: new module

This commit is contained in:
Jos van Bakel 2024-02-25 10:23:49 +01:00
parent 6347cd23dc
commit 2e10f813fe
No known key found for this signature in database
GPG Key ID: 570203BD852D182E
3 changed files with 37 additions and 0 deletions

View File

@ -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. -->

View File

@ -55,6 +55,7 @@ let
"modemmanager"
"mongodb"
"mysqld"
"nats"
"nextcloud"
"nginx"
"nginxlog"

View File

@ -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}
'';
};
};
}