Closed nlamirault closed 5 years ago
I try to use your exporter with a Sybase database: I make some changes to use golang 1.12 on the Dockerfiles :
$ diff --git a/Dockerfile b/Dockerfile │Dockerfile-buildexporter Documents/ index ddcd075..e6e853d 100644 │ nicolas lamska ~ Work dbms_exporter master $ mv ~/Doc --- a/Dockerfile │Dockerfile-buildexporter Documents/ +++ b/Dockerfile │ nicolas lamska ~ Work dbms_exporter master $ mv ~/Dockerfile-buildexporter Dockerfile-buil @@ -1,7 +1,8 @@ │dexporter # FROM scratch - doable if we're not using ODBC │ nicolas lamska ~ Work dbms_exporter master 1✎ $ git diff # Using golang simply because we already use it for Dockerfile-buildexporter, │diff --git a/Dockerfile-buildexporter b/Dockerfile-buildexporter # so this is less downloading. │index b701474..85676f6 100644 -FROM golang:1.7.1-wheezy │--- a/Dockerfile-buildexporter +FROM golang:1.12.4-stretch │+++ b/Dockerfile-buildexporter + │@@ -1,7 +1,13 @@ RUN apt-get update && apt-get -y install libodbc1 odbcinst libsybdb5 tdsodbc │-FROM golang:1.7.1-wheezy COPY freetds.conf /usr/local/etc/ │-RUN wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz COPY odbcinst.ini . │-RUN sh -c "tar zxf freetds-patched.tar.gz && cd freetds-1.* && ./configure && make install" diff --git a/Dockerfile-buildexporter b/Dockerfile-buildexporter │-RUN apt-get update && apt-get -y install unixodbc-dev index b701474..85676f6 100644 │+FROM golang:1.12.4-stretch --- a/Dockerfile-buildexporter │+ +++ b/Dockerfile-buildexporter │+RUN apt-get update && apt-get -y install unixodbc-dev libodbc1 odbcinst libsybdb5 tdsodbc freetds-dev @@ -1,7 +1,13 @@ │ RUN go get github.com/minus5/gofreetds -FROM golang:1.7.1-wheezy │ RUN go get github.com/alexbrainman/odbc -RUN wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz │ -RUN sh -c "tar zxf freetds-patched.tar.gz && cd freetds-1.* && ./configure && make install" │+WORKDIR / -RUN apt-get update && apt-get -y install unixodbc-dev │+ +FROM golang:1.12.4-stretch │+RUN wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz \ + │+ && tar zxf /freetds-patched.tar.gz \ +RUN apt-get update && apt-get -y install unixodbc-dev libodbc1 odbcinst libsybdb5 tdsodbc freetds-dev │+ && cd /freetds-1.* \ RUN go get github.com/minus5/gofreetds │+ && ./configure \ RUN go get github.com/alexbrainman/odbc │+ && make install │ nicolas lamska ~ Work dbms_exporter master 1✎ $ cat Dockerfile-buildexporter +WORKDIR / │───────┬───────────────────────────────────────────────────────────────────────────────────────────────── + │ │ File: Dockerfile-buildexporter +RUN wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz \ │───────┼───────────────────────────────────────────────────────────────────────────────────────────────── + && tar zxf /freetds-patched.tar.gz \ │ 1 ~ │ FROM golang:1.12.4-stretch + && cd /freetds-1.* \ │ 2 ~ │ + && ./configure \ │ 3 ~ │ RUN apt-get update && apt-get -y install unixodbc-dev libodbc1 odbcinst libsybdb5 tdsodbc freetd + && make install
Then i try to build and use :
$ make DRIVERS='freedts' LDFLAGS= docker-build docker build -f Dockerfile-buildexporter -t ncabatoff/dbms_exporter_builder:latest . Sending build context to Docker daemon 16.82MB Step 1/6 : FROM golang:1.12.4-stretch ---> b860ab44e93e Step 2/6 : RUN apt-get update && apt-get -y install unixodbc-dev libodbc1 odbcinst libsybdb5 tdsodbc freetds-dev ---> Using cache ---> cc1950a6a01f Step 3/6 : RUN go get github.com/minus5/gofreetds ---> Using cache ---> 52865b06bdf4 Step 4/6 : RUN go get github.com/alexbrainman/odbc ---> Using cache ---> dc253195aebe Step 5/6 : WORKDIR / ---> Using cache ---> 80b2e7e4bfa4 Step 6/6 : RUN wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz && tar zxf /freetds-patched.tar.gz && cd /freetds-1.* && ./configure && make install ---> Using cache ---> 29b22ab1a89f Successfully built 29b22ab1a89f Successfully tagged ncabatoff/dbms_exporter_builder:latest docker run --rm -v /home/nicolas/Work/dbms_exporter:/go/src/github.com/ncabatoff/dbms_exporter \ -v /home/nicolas/Work/dbms_exporter:/real_src \ -e SHELL_UID=1001 -e SHELL_GID=985 \ -w /go/src/github.com/ncabatoff/dbms_exporter \ ncabatoff/dbms_exporter_builder:latest \ /bin/bash -c 'make LDFLAGS="" DRIVERS="freedts" >&2 && chown $SHELL_UID:$SHELL_GID ./dbms_exporter' go vet . ./config ./common ./db ./recipes go test -v . ./config ./common ./db ./recipes ? github.com/ncabatoff/dbms_exporter [no test files] === RUN TestGetRecipesSimple --- PASS: TestGetRecipesSimple (0.00s) === RUN TestGetRecipesSimpleQuery --- PASS: TestGetRecipesSimpleQuery (0.00s) PASS ok github.com/ncabatoff/dbms_exporter/config 0.003s ? github.com/ncabatoff/dbms_exporter/common [no test files] ? github.com/ncabatoff/dbms_exporter/db [no test files] ? github.com/ncabatoff/dbms_exporter/recipes [no test files] docker build -t ncabatoff/dbms_exporter:latest . Sending build context to Docker daemon 16.82MB Step 1/8 : FROM golang:1.12.4-stretch ---> b860ab44e93e Step 2/8 : RUN apt-get update && apt-get -y install libodbc1 odbcinst libsybdb5 tdsodbc ---> Using cache ---> 608aa7992457 Step 3/8 : COPY freetds.conf /usr/local/etc/ ---> Using cache ---> 2f1f48236a6d Step 4/8 : COPY odbcinst.ini . ---> Using cache ---> 0ae6eb0775cf Step 5/8 : RUN odbcinst -i -d -f ./odbcinst.ini ---> Using cache ---> 1192ed4cd932 Step 6/8 : COPY dbms_exporter / ---> Using cache ---> 29ad94fec69e Step 7/8 : EXPOSE 9113 ---> Using cache ---> 4a4d2c152412 Step 8/8 : ENTRYPOINT [ "/dbms_exporter" ] ---> Using cache ---> 6fa2722e0621 Successfully built 6fa2722e0621 Successfully tagged ncabatoff/dbms_exporter:latest
$ DATA_SOURCE_NAME="compatibility_mode=sybase;user=guest;pwd=;server=127.0.0.1" ./dbms_exporter -driver freedts -queryfile sybase.yaml -log.level debug FATA[0000] driver "freedts" not supported in this build source=dbms_exporter.go:482
Any idea ? Thanks.
You have a typo in your command, -driver freedts should be -driver freetds.
-driver freedts
-driver freetds
Thanks. Sorry for noise.
I try to use your exporter with a Sybase database: I make some changes to use golang 1.12 on the Dockerfiles :
Then i try to build and use :
Any idea ? Thanks.