From 0cd0769bf551a45d1a991cd99be30fb9ca74112c Mon Sep 17 00:00:00 2001 From: Simon Hirschmann Date: Mon, 29 May 2023 18:13:40 +0200 Subject: [PATCH] Add option to run as docker container --- Dockerfile | 15 +++++++++++++++ README.md | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..084ad69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM golang:1.19 + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY *.go ./ +COPY vigor/* ./vigor/ +RUN CGO_ENABLED=0 GOOS=linux go build -o /vigor-exporter + +EXPOSE 9103 + +# Run +ENTRYPOINT ["/vigor-exporter"] \ No newline at end of file diff --git a/README.md b/README.md index f1e62c4..192ef28 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,15 @@ A (crusty) DrayTek Vigor 130 (and others) exporter for prometheus. This can be used to scrape your Vigor modem for some connection metrics. ## Build + ``` go build . ``` ## Usage Information + +### Run directly + ``` ./vigor-exporter --help -host string @@ -22,3 +26,17 @@ go build . The exporter is listening on `*:9103` and provides metrics at the `/metrics` path. + +### Run with docker + +``` +docker build -t vigor . + +docker run vigor + -host string + hostname/ip the Vigor is reachable on + -password string + password to authenticate to the Vigor + -username string + username to authenticate to the Vigor +```