diff options
author | Gabriel Fontes <hi@m7.rs> | 2023-05-30 12:29:25 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-06-03 03:13:09 +0000 |
commit | dff2e184f42537f1f67d20a98442f2bc17eabf23 (patch) | |
tree | d6c247ceb25c7350822ff45097766bf5a0c7945d /nixos/modules/services | |
parent | ee9d2678d77cf9359df58b16570daf8a1d8ac9d8 (diff) | |
download | nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar.gz nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar.bz2 nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar.lz nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar.xz nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.tar.zst nixlib-dff2e184f42537f1f67d20a98442f2bc17eabf23.zip |
nixos/prometheus.exporters.graphite: init
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/graphite.nix | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index fd40dce1410c..235296168934 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -35,6 +35,7 @@ let "dovecot" "fastly" "fritzbox" + "graphite" "influxdb" "ipmi" "json" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/graphite.nix b/nixos/modules/services/monitoring/prometheus/exporters/graphite.nix new file mode 100644 index 000000000000..34a887104212 --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/graphite.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, options }: + +let + cfg = config.services.prometheus.exporters.graphite; + format = pkgs.formats.yaml { }; +in +{ + port = 9108; + extraOpts = { + graphitePort = lib.mkOption { + type = lib.types.port; + default = 9109; + description = lib.mdDoc '' + Port to use for the graphite server. + ''; + }; + mappingSettings = lib.mkOption { + type = lib.types.submodule { + freeformType = format.type; + options = { }; + }; + default = { }; + description = lib.mdDoc '' + Mapping configuration for the exporter, see + <https://github.com/prometheus/graphite_exporter#yaml-config> for + available options. + ''; + }; + }; + serviceOpts = { + serviceConfig = { + ExecStart = '' + ${pkgs.prometheus-graphite-exporter}/bin/graphite_exporter \ + --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ + --graphite.listen-address ${cfg.listenAddress}:${toString cfg.graphitePort} \ + --graphite.mapping-config ${format.generate "mapping.yml" cfg.mappingSettings} \ + ${lib.concatStringsSep " \\\n " cfg.extraFlags} + ''; + }; + }; +} |