Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from rebuy-de/use-merger
Browse files Browse the repository at this point in the history
use exporter-merger
  • Loading branch information
svenwltr authored Feb 14, 2018
2 parents 8ba3928 + 09da425 commit 8a36a3f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ FROM fish/nginx-exporter:v0.1.0 as status

FROM alpine:3.7

RUN set -x \
&& apk add --no-cache \
supervisor
RUN apk add --no-cache supervisor

COPY --from=mtail /usr/local/bin/mtail /usr/local/bin/mtail
COPY --from=status /usr/local/bin/nginx_exporter /usr/local/bin/nginx_exporter
COPY assets/merger.yaml /etc/exporter-merger.yaml
COPY assets/supervisord.conf /etc/supervisord.conf
COPY assets/nginx.mtail /etc/mtail/nginx.mtail
ADD https://github.com/rebuy-de/exporter-merger/releases/download/v0.1.0/exporter-merger-v0.1.0-linux-amd64 /usr/local/bin/exporter-merger

RUN chmod +x /usr/local/bin/exporter-merger

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# nginx-exporter

[![Build Status](https://travis-ci.org/rebuy-de/nginx-exporter.svg?branch=master)](https://travis-ci.org/rebuy-de/nginx-exporter)
[![Docker Repository](https://quay.io/repository/rebuy/nginx-exporter/status "Docker Repository")](https://quay.io/repository/rebuy/nginx-exporter)
[![license](https://img.shields.io/github/license/rebuy-de/nginx-exporter.svg)]()
[![GitHub release](https://img.shields.io/github/release/rebuy-de/nginx-exporter.svg)]()

A meta nginx exporter that combines two different exporters

> **Development Status** *nginx-exporter* is currently **NOT WORKING AS
> EXPECTED**, because it is not possible to specify multiple ports
> ([prometheus/prometheus#3756](https://github.com/prometheus/prometheus/issues/3756))
> for a single Pod. Anyway, using it outside Kubernetes should still work.
> **Development Status** *nginx-exporter* is in an early development phase.
> Expect breaking changes any time.
## References

* The mtail programm is based on
[ndiazg/nginx-prometheus-exporter](https://github.com/ndiazg/nginx-prometheus-exporter).
* The status page exporter is from
[discordianfish/nginx_exporter](https://github.com/discordianfish/nginx_exporter).
* The exporter merger is from
[rebuy-de/exporter-merger](https://github.com/rebuy-de/exporter-merger).


## Available Metrics
Expand All @@ -30,7 +30,7 @@ All metrics provide these labels: `vhost`, `method`, `code`, `content_type`.
* `nginx_response_size_bytes_sum` – Sum of all response body sizes.

The `le` label can be used to generate a histogram. The buckets currently have a
fixed size (`100ms`, `200ms`, `300ms`, `500ms`, `800ms`, `1300ms`, `2100ms`).
fixed size (`100ms`, `200ms`, `300ms`, `500ms`, `800ms`, `1300ms`, `2100ms`, `5400ms`, `7500ms`).

### From status page

Expand Down Expand Up @@ -88,10 +88,11 @@ This exporter is configured via environment variables:

### Prometheus

The exporter provides two metric endpoints:
The exporter provides three metric endpoints:

- `3093` -- mtail exporter
- `9113` -- status page exporter
- `9397` -- merged mertrics from mtai and status page exporter

### Kubernetes

Expand All @@ -118,7 +119,7 @@ spec:
app: my-nginx
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "3093;9113" # this doesn't work
prometheus.io/port: "9397"

spec:
containers:
Expand All @@ -133,8 +134,7 @@ spec:
image: quay.io/rebuy/nginx-exporter:v1.0.0

ports:
- containerPort: 3093
- containerPort: 9113
- containerPort: 9397

env:
- name: NGINX_ACCESS_LOGS
Expand Down
3 changes: 3 additions & 0 deletions assets/merger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exporters:
- url: http://localhost:3093/metrics
- url: http://localhost:9113/metrics
11 changes: 9 additions & 2 deletions assets/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[supervisord]
nodaemon=true

[program:merger]
command=/usr/local/bin/exporter-merger
--listen-port 9397
--config-path /etc/exporter-merger.yaml
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:mtail]
command=/usr/local/bin/mtail
-v=2
Expand All @@ -9,7 +18,6 @@ command=/usr/local/bin/mtail
-progs /etc/mtail
-logs
%(ENV_NGINX_ACCESS_LOGS)s

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
Expand All @@ -18,7 +26,6 @@ stderr_logfile_maxbytes=0
[program:status]
command=/usr/local/bin/nginx_exporter
-nginx.scrape_uri=%(ENV_NGINX_STATUS_URI)s

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
Expand Down

0 comments on commit 8a36a3f

Please sign in to comment.