diff --git a/Dockerfile b/Dockerfile index f16a300..7718492 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 7c8e55b..96b1945 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ # 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 @@ -17,6 +15,8 @@ A meta nginx exporter that combines two different exporters [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 @@ -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 @@ -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 @@ -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: @@ -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 diff --git a/assets/merger.yaml b/assets/merger.yaml new file mode 100644 index 0000000..c577c8f --- /dev/null +++ b/assets/merger.yaml @@ -0,0 +1,3 @@ +exporters: +- url: http://localhost:3093/metrics +- url: http://localhost:9113/metrics diff --git a/assets/supervisord.conf b/assets/supervisord.conf index 1b7f8b0..9919fe7 100644 --- a/assets/supervisord.conf +++ b/assets/supervisord.conf @@ -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 @@ -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 @@ -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