compiliere den prometheus oracledb-exporter
-
build a binary from: https://github.com/iamseth/oracledb_exporter#windows-binaries
to get a oracle db exporter for prometheus running on windows 64bit.
prepare
oracle insta client
-
download https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
-
instantclient-basic-windows.x64-21.3.0.0.0.zip
-
instantclient-sdk-windows.x64-21.3.0.0.0.zip
-
unzip
c++ compiler
-
download https://www.msys2.org/
-
install msys2-x86_64-20220503.exe
-
run pacman -S mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-
prefix=C:\_data\projects\oracle-exporter\instantclient_21_3/sdk version=21.3 build=client64 libdir=C:/_data/projects/oracle-exporter/instantclient_21_3/sdk/lib/msvc includedir=C:/_data/projects/oracle-exporter/instantclient_21_3/sdk/include glib_genmarshal=glib-genmarshal gobject_query=gobject-query glib_mkenums=glib-mkenums Name: oci8 Description: Oracle database engine Version: ${version} Libs: -L${libdir} -loci Libs.private: Cflags: -I${includedir}
experiment with front and backslashes where needed.
go environment
-
download https://go.dev/dl/
-
install go1.13.15.windows-amd64.msi (go1.18.2 did not work, faults on run)
actual code
compile
setx CGO_CFLAGS "C:/_data/projects/oracle-exporter/instantclient_21_3/sdk/include" setx CGO_LDFLAGS "-LC:/_data/projects/oracle-exporter/instantclient_21_3 -loci" setx PKG_CONFIG_PATH "C:/msys64/mingw64/lib/pkgconfig" setx path "%path%;C:\msys64\mingw64\bin"
check configuration:
pkg-config --cflags --libs oci8
build binary:
go build ./...
use
use oracledb_exporter.exe and default-metrics.toml lumped together with insta-client in one directory.
>set DATA_SOURCE_NAME=usr/pw@//host:port/instance >oracledb_exporter.exe --web.listen-address 0.0.0.0:9333 INFO[0000] Starting oracledb_exporter 0.0.0.dev source="main.go:588" INFO[0000] Successfully loaded default metrics from: default-metrics.toml source="main.go:563" INFO[0000] No custom metrics defined. source="main.go:578" INFO[0000] Listening on 0.0.0.0:9333 source="main.go:625"