1
0
mirror of https://github.com/ribbybibby/ssl_exporter.git synced 2025-02-16 19:47:42 +02:00

It looks like there's a standard approach most Prometheus exporters use when building Dockerfiles, so I'm going to adhere to that. Rather than building the binary inside the container, it's built outside and then copied into the bin dir.

This commit is contained in:
Rob Best 2017-12-02 19:03:36 +00:00
parent a3d8b34adf
commit 1bc71085ad
2 changed files with 8 additions and 18 deletions

View File

@ -1,20 +1,5 @@
FROM golang:1.8.3-alpine3.6 as builder
FROM quay.io/prometheus/busybox:latest
ENV GOOS=linux GOARCH=amd64 GOPATH=/go
COPY ssl_exporter /bin/ssl_exporter
WORKDIR /go/src/github.com/ribbybibby/ssl_exporter
RUN apk --no-cache --quiet add git
RUN go get "github.com/prometheus/client_golang/prometheus" "gopkg.in/alecthomas/kingpin.v2" "github.com/sirupsen/logrus"
COPY . /go/src/github.com/ribbybibby/ssl_exporter
RUN go build
FROM alpine:3.6
RUN apk add --quiet --no-cache ca-certificates tzdata && rm -rf /var/cache/apk/*
COPY --from=builder /go/src/github.com/ribbybibby/ssl_exporter/ssl_exporter /ssl_exporter
ENTRYPOINT ["/ssl_exporter"]
ENTRYPOINT ["/bin/ssl_exporter"]

View File

@ -9,6 +9,11 @@ Whatever it is, the SSL exporter gives you visibility over those dimensions at t
## Building
make
./ssl_exporter <flags>
### Docker
make all docker
docker run -p 9219:9219 ssl-exporter:master <flags>
Similarly to the blackbox_exporter, visiting [http://localhost:9219/probe?target=https://example.com](http://localhost:9219/probe?target=https://example.com) will return certificate metrics for example.com. The ```ssl_https_connect_success``` metric indicates if the probe has been successful.
## Flags