1
0
mirror of https://github.com/nginxinc/nginx-prometheus-exporter.git synced 2025-04-27 21:36:48 +03:00
Luca Comellini f45b6fd440
Use web configuration from exporter-toolkit (#461)
Replaces manual implementation of TLS and adds Basic Auth.
2023-07-26 00:38:26 +00:00

1.3 KiB

NGINX Prometheus Exporter with Web Configuration for Basic Authentication

This example shows how to run NGINX Prometheus Exporter with web configuration. In this folder you will find an example configuration web-config.yml that enables basic authentication. It is configured to have a single user alice with password password.

The full documentation for the web configuration can be found here.

Prerequisites

  • NGINX Prometheus Exporter binary. See the main README for installation instructions.
  • NGINX or NGINX Plus running on the same machine.

Running NGINX Prometheus Exporter with Web Configuration in Basic Authentication mode

You can run NGINX Prometheus Exporter with web configuration in Basic Authentication mode using the following command:

nginx-prometheus-exporter --web.config.file=web-config.yml --nginx.scrape-uri="http://127.0.0.1:8080/stub_status"

Depending on your environment, you may need to specify the full path to the binary or change the path to the web configuration file.

Verification

Run curl -u alice:password http://localhost:9113/metrics to see the metrics exposed by the exporter. Without the -u flag, the request will fail with 401 Unauthorized.