diff --git a/Dockerfile b/Dockerfile index 7718492..7f27ffa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,25 @@ -FROM ndiazg/nginx-prometheus-exporter as mtail +FROM alpine:3.8 as mtail + +ENV GOPATH /go +ENV PATH /go/bin:$PATH + +RUN apk add --no-cache --update musl musl-dev go git bash make + +RUN mkdir -p /go/src/github.com/google/ && \ + git clone https://github.com/google/mtail.git /go/src/github.com/google/mtail && \ + cd /go/src/github.com/google/mtail && \ + git checkout v3.0.0-rc17 && \ + make install_deps && make install + +RUN ls -la /go/bin FROM fish/nginx-exporter:v0.1.0 as status -FROM alpine:3.7 +FROM alpine:3.8 RUN apk add --no-cache supervisor -COPY --from=mtail /usr/local/bin/mtail /usr/local/bin/mtail +COPY --from=mtail /go/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 diff --git a/README.md b/README.md index 5df373d..d506eac 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A meta nginx exporter that combines two different exporters ## References * The mtail programm is based on - [ndiazg/nginx-prometheus-exporter](https://github.com/ndiazg/nginx-prometheus-exporter). + [google/mtail](https://github.com/google/mtail). * The status page exporter is from [discordianfish/nginx_exporter](https://github.com/discordianfish/nginx_exporter). * The exporter merger is from @@ -92,7 +92,7 @@ The exporter provides three metric endpoints: - `3093` -- mtail exporter - `9113` -- status page exporter -- `9397` -- merged mertrics from mtail and status page exporter +- `9397` -- merged metrics from mtail and status page exporter ### Kubernetes diff --git a/assets/nginx.mtail b/assets/nginx.mtail index 492d137..b0ac633 100644 --- a/assets/nginx.mtail +++ b/assets/nginx.mtail @@ -29,8 +29,8 @@ counter nginx_request_duration_milliseconds_count by vhost, method, code nginx_response_size_bytes_sum[$vhost][tolower($request_method)][$status][tolower($upstream_cache_status)] += $bytes_sent - nginx_request_duration_milliseconds_count[$vhost][tolower($request_method)][$status][tolower($upstream_cache_status)]++ - nginx_request_duration_milliseconds_sum[$vhost][tolower($request_method)][$status] += $request_seconds * 1000 + $request_milliseconds < 100 + nginx_request_duration_milliseconds_count[$vhost][tolower($request_method)][$status]++ + nginx_request_duration_milliseconds_sum[$vhost][tolower($request_method)][$status] += $request_seconds * 1000 + $request_milliseconds $request_seconds * 1000 + $request_milliseconds < 100 { nginx_request_duration_milliseconds_bucket["100"][$vhost][tolower($request_method)][$status]++ @@ -87,7 +87,4 @@ counter nginx_request_duration_milliseconds_count by vhost, method, code } nginx_request_duration_milliseconds_bucket["+Inf"][$vhost][tolower($request_method)][$status]++ - - nginx_request_duration_milliseconds_sum["+Inf"][$vhost][tolower($request_method)][$status] += $request_seconds * 1000 + $request_milliseconds - }