Skip to content

Commit 7a9b351

Browse files
committed
Update README
Update README.md with instructions on how to build the exporter binary and run it.
1 parent 6d03566 commit 7a9b351

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

README.md

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ NGINX Prometheus exporter makes it possible to monitor NGINX or NGINX Plus using
88

99
[NGINX](http://nginx.org) exposes a handful of metrics via the [stub_status page](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html#stub_status). [NGINX Plus](https://www.nginx.com/products/nginx/) provides a richer set of metrics via the [API](https://nginx.org/en/docs/http/ngx_http_api_module.html) and the [monitoring dashboard](https://www.nginx.com/products/nginx/live-activity-monitoring/). NGINX Prometheus exporter fetches the metrics from a single NGINX or NGINX Plus, converts the metrics into appropriate Prometheus metrics types and finally exposes them via an HTTP server to be collected by [Prometheus](https://prometheus.io/).
1010

11-
**Note**: Currently it is only supported to run NGINX Prometheus Exporter in a Docker container.
12-
1311
## Getting Started
1412

15-
In this section, we show how to quickly run NGINX Prometheus Exporter in a container for NGINX or NGINX Plus.
13+
In this section, we show how to quickly run NGINX Prometheus Exporter for NGINX or NGINX Plus.
1614

1715
### A Note about NGINX Ingress Controller
1816

@@ -24,10 +22,9 @@ We assume that you have already installed Prometheus and NGINX or NGINX Plus. Ad
2422
* Expose the built-in metrics in NGINX/NGINX Plus:
2523
* For NGINX, expose the [stub_status page](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html#stub_status) at `/stub_status` on port `8080`.
2624
* For NGINX Plus, expose the [API](https://nginx.org/en/docs/http/ngx_http_api_module.html#api) at `/api` on port `8080`.
27-
* Install Docker on the server where you’re planning to run the exporter.
2825
* Configure Prometheus to scrape metrics from the server with the exporter. Note that the default scrape port of the exporter is `9113` and the default metrics path -- `/metrics`.
2926

30-
### Running the Exporter in a Container
27+
### Running the Exporter in a Docker Container
3128

3229
To start the exporter we use the [docker run](https://docs.docker.com/engine/reference/run/) command.
3330

@@ -43,6 +40,22 @@ To start the exporter we use the [docker run](https://docs.docker.com/engine/ref
4340
```
4441
where `<nginx-plus>` is the IP address/DNS name, through which NGINX Plus is available.
4542
43+
### Running the Exporter Binary
44+
45+
* To export NGINX metrics, run:
46+
```
47+
$ nginx-prometheus-exporter -nginx.scrape-uri http://<nginx>:8080/stub_status
48+
```
49+
where `<nginx>` is the IP address/DNS name, through which NGINX is available.
50+
51+
* To export NGINX Plus metrics:
52+
```
53+
$ nginx-prometheus-exporter -nginx.plus -nginx.scrape-uri http://<nginx-plus>:8080/api
54+
```
55+
where `<nginx-plus>` is the IP address/DNS name, through which NGINX Plus is available.
56+
57+
**Note**. The `nginx-prometheus-exporter` is not a daemon. To run the exporter as a system service (daemon), configure the init system of your Linux server (such as systemd or Upstart) accordingly. Alternatively, you can run the exporter in a Docker container.
58+
4659
## Usage
4760
4861
### Command-line Arguments
@@ -79,27 +92,39 @@ Usage of ./nginx-prometheus-exporter:
7992
8093
### Troubleshooting
8194
82-
The exporter logs errors to the standard output. If the exporter doesn’t work as expected, check its logs using [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) command.
95+
The exporter logs errors to the standard output. When using Docker, if the exporter doesn’t work as expected, check its logs using [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) command.
8396
8497
## Releases
8598
86-
For each release, we publish the corresponding Docker image at `nginx/nginx-prometheus-exporter` [DockerHub repo](https://hub.docker.com/r/nginx/nginx-prometheus-exporter/). See the GitHub [releases page](https://github.com/nginxinc/nginx-prometheus-exporter/releases) for the list of all releases and the [CHANGELOG.md](CHANGELOG.md) for the changelog.
99+
For each release, we publish the corresponding Docker image at `nginx/nginx-prometheus-exporter` [DockerHub repo](https://hub.docker.com/r/nginx/nginx-prometheus-exporter/) and the binaries on the GitHub [releases page](https://github.com/nginxinc/nginx-prometheus-exporter/releases).
87100
88-
## Building the Container Image
101+
## Building the Exporter
89102
90-
You can build the exporter image using the provided Makefile. Before building the image, make sure the following software is installed on your machine:
103+
You can build the exporter using the provided Makefile. Before building the exporter, make sure the following software is installed on your machine:
91104
* make
92-
* Docker
93105
* git
106+
* Docker for building the container image
107+
* Go for building the binary
108+
109+
### Building the Docker Image
94110
95-
To build the image, run:
111+
To build the Docker image with the exporter, run:
96112
```
97113
$ make container
98114
```
99115
100-
Note:
101-
* golang is not required, as the exporter binary is built in a Docker container. See the [Dockerfile](Dockerfile).
102-
* The Makefile supports a few variables which can override its default behaviour. See [its content](Makefile).
116+
Note: go is not required, as the exporter binary is built in a Docker container. See the [Dockerfile](Dockerfile).
117+
118+
### Building the Binary
119+
120+
To build the binary, run:
121+
```
122+
$ make
123+
```
124+
125+
Note: the binary is built for the OS/arch of your machine. To build binaries for other platforms, see the [Makefile](Makefile).
126+
127+
The binary is built with the name `nginx-prometheus-exporter`.
103128
104129
## Support
105130

0 commit comments

Comments
 (0)