aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix')
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix b/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix
new file mode 100644
index 00000000000..bd0026b55f7
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/json.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, options }:
+
+with lib;
+
+let
+ cfg = config.services.prometheus.exporters.json;
+in
+{
+ port = 7979;
+ extraOpts = {
+ url = mkOption {
+ type = types.str;
+ description = ''
+ URL to scrape JSON from.
+ '';
+ };
+ configFile = mkOption {
+ type = types.path;
+ description = ''
+ Path to configuration file.
+ '';
+ };
+ listenAddress = {}; # not used
+ };
+ serviceOpts = {
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.prometheus-json-exporter}/bin/prometheus-json-exporter \
+ --port ${toString cfg.port} \
+ ${cfg.url} ${escapeShellArg cfg.configFile} \
+ ${concatStringsSep " \\\n " cfg.extraFlags}
+ '';
+ };
+ };
+}