diff options
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters.md')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.md | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.md b/nixos/modules/services/monitoring/prometheus/exporters.md index 34fadecadc74..b344534f6aee 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.md +++ b/nixos/modules/services/monitoring/prometheus/exporters.md @@ -9,7 +9,8 @@ One of the most common exporters is the [node exporter](https://github.com/prometheus/node_exporter), it provides hardware and OS metrics from the host it's running on. The exporter could be configured as follows: -``` +```nix +{ services.prometheus.exporters.node = { enable = true; port = 9100; @@ -23,6 +24,7 @@ running on. The exporter could be configured as follows: openFirewall = true; firewallFilter = "-i br0 -p tcp -m tcp --dport 9100"; }; +} ``` It should now serve all metrics from the collectors that are explicitly enabled and the ones that are @@ -35,7 +37,8 @@ configuration see `man configuration.nix` or search through the [available options](https://nixos.org/nixos/options.html#prometheus.exporters). Prometheus can now be configured to consume the metrics produced by the exporter: -``` +```nix +{ services.prometheus = { # ... @@ -49,7 +52,8 @@ Prometheus can now be configured to consume the metrics produced by the exporter ]; # ... - } + }; +} ``` ## Adding a new exporter {#module-services-prometheus-exporters-new-exporter} @@ -75,7 +79,7 @@ example: `nixos/modules/services/monitoring/prometheus/exporters/` directory, which will be called postfix.nix and contains all exporter specific options and configuration: - ``` + ```nix # nixpkgs/nixos/modules/services/prometheus/exporters/postfix.nix { config, lib, pkgs, options }: @@ -148,7 +152,7 @@ example: Should an exporter option change at some point, it is possible to add information about the change to the exporter definition similar to `nixpkgs/nixos/modules/rename.nix`: -``` +```nix { config, lib, pkgs, options }: with lib; |