From 3f94c66ee121a2fdb136741c3685195c6d1db643 Mon Sep 17 00:00:00 2001 From: WilliButz Date: Fri, 1 Jan 2021 23:59:06 +0100 Subject: nixos/prometheus-json-exporter: update modules & tests, add release notes --- .../monitoring/prometheus/exporters/json.nix | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'nixos/modules/services/monitoring/prometheus/exporters/json.nix') diff --git a/nixos/modules/services/monitoring/prometheus/exporters/json.nix b/nixos/modules/services/monitoring/prometheus/exporters/json.nix index bd0026b55f7..24364aababd 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/json.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/json.nix @@ -4,32 +4,42 @@ 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} \ + ${pkgs.prometheus-json-exporter}/bin/json_exporter \ + --config.file ${escapeShellArg cfg.configFile} \ + --web.listen-address="${cfg.listenAddress}:${toString cfg.port}" \ ${concatStringsSep " \\\n " cfg.extraFlags} ''; }; }; + imports = [ + (mkRemovedOptionModule [ "url" ] '' + This option was removed. The URL of the endpoint serving JSON + must now be provided to the exporter by prometheus via the url + parameter target. + + In prometheus a scrape URL would look like this: + + http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/endpoint + + + For more information, take a look at the + official documentation of the json_exporter. + '') + ({ options.warnings = options.warnings; options.assertions = options.assertions; }) + ]; } -- cgit 1.4.1 From 6e43cc7fb0f22a88a989583ccf50e56f7f72ad6a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 3 Jan 2021 19:04:33 +0100 Subject: nixos/prometheus-exporters: minor doc improvements * Content of `programlisting` shouldn't be indented, otherwise it's weirdly indented in the output. * Use `` in the release notes: then users can directly go to the option documentation when reading release notes. * Don't use docbook tags in `mkRemovedOptionModule`: it's only used during evaluation where docbook isn't rendered. --- nixos/doc/manual/release-notes/rl-2103.xml | 4 ++-- .../services/monitoring/prometheus/exporters/json.nix | 12 +++++------- .../services/monitoring/prometheus/exporters/rspamd.nix | 11 +++++------ 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'nixos/modules/services/monitoring/prometheus/exporters/json.nix') diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml index 0475c365504..76aa3d839bf 100644 --- a/nixos/doc/manual/release-notes/rl-2103.xml +++ b/nixos/doc/manual/release-notes/rl-2103.xml @@ -304,7 +304,7 @@ /probe endpoint. In the prometheus scrape configuration the scrape target might look like this: - http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/endpoint +http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/endpoint @@ -313,7 +313,7 @@ in the corresponding NixOS test. - These changes also affect services.prometheus.exporters.rspamd, which is + These changes also affect , which is just a preconfigured instance of the json exporter. diff --git a/nixos/modules/services/monitoring/prometheus/exporters/json.nix b/nixos/modules/services/monitoring/prometheus/exporters/json.nix index 24364aababd..1800da69a25 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/json.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/json.nix @@ -4,7 +4,6 @@ with lib; let cfg = config.services.prometheus.exporters.json; - in { port = 7979; @@ -30,15 +29,14 @@ in (mkRemovedOptionModule [ "url" ] '' This option was removed. The URL of the endpoint serving JSON must now be provided to the exporter by prometheus via the url - parameter target. + parameter `target'. In prometheus a scrape URL would look like this: - - http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/endpoint - - For more information, take a look at the - official documentation of the json_exporter. + http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/endpoint + + For more information, take a look at the official documentation + (https://github.com/prometheus-community/json_exporter) of the json_exporter. '') ({ options.warnings = options.warnings; options.assertions = options.assertions; }) ]; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix index 84e7ba3554b..78fe120e4d9 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix @@ -85,15 +85,14 @@ in (mkRemovedOptionModule [ "url" ] '' This option was removed. The URL of the rspamd metrics endpoint must now be provided to the exporter by prometheus via the url - parameter target. + parameter `target'. In prometheus a scrape URL would look like this: - - http://some.rspamd-exporter.host:7980/probe?target=http://some.rspamd.host:11334/stat - - For more information, take a look at the - official documentation of the json_exporter. + http://some.rspamd-exporter.host:7980/probe?target=http://some.rspamd.host:11334/stat + + For more information, take a look at the official documentation + (https://github.com/prometheus-community/json_exporter) of the json_exporter. '') ({ options.warnings = options.warnings; options.assertions = options.assertions; }) ]; -- cgit 1.4.1