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

Commit

Permalink
Compile mtail
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernhaeuser committed Nov 14, 2018
1 parent 303207b commit f298b1d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 2 additions & 5 deletions assets/nginx.mtail
Original file line number Diff line number Diff line change
Expand Up @@ -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]++
Expand Down Expand Up @@ -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

}

0 comments on commit f298b1d

Please sign in to comment.