gridserver-exporter

command module
v0.0.0-...-42a5429 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

README

GridServer Exporter for Prometheus

This is a simple server that scrapes GridServer reporting statistics and exports them via HTTP for Prometheus consumption. It is based on the official HAProxy Exporter.

Getting Started

To run it:

gridserver-exporter -u URL [flags]

Help on flags:

gridserver-exporter -h

Usage

There are three supported sources of reporting information: the GridServer reporting database, the Web Services API, and a mock data source that returns random values. The source type is specified by the schema in the url parameter.

To use the reporting database:

gridserver-exporter -u oracle://username:password@host[:port]/sid
gridserver-exporter -u sqlserver://username:password@host[:port]/instance?database=databasename
gridserver-exporter -u postgres://username:password@host[:port]/databasename

To use the Web Services API:

gridserver-exporter -u http://username:password@host[:port][/path]
gridserver-exporter -u https://username:password@host[:port][/path]

To use the mock data source:

gridserver-exporter -u mock://

The port and path in the URLs are optional. If they are not specified, the GridServer (for Web Services) or database driver (for the reporting database) defaults will be used.

GridServer reporting database

The supported GridServer reporting databases are Oracle, SQL Server and PostgreSQL. The URL scheme will determine the driver used. The database schema used will be the default for the database, but can be overridden by the schema parameter.

gridserver-exporter -u oracle://username:password@host/sid -s schema
Oracle

The Oracle support uses the godror package.

Note that the username & password are colon-separated in the "url" parameter, not slash-separated as in the godror package documentation.

gridserver-exporter -u oracle://username:password@host/sid

For Oracle specific options, see the godror Readme file.

SQL Server

The SQL Server support uses the go-mssqldb package.

gridserver-exporter -u sqlserver://username:password@host/instance?database=databasename

For SQL Server specific options, see the go-mssqldb Readme file.

PostgreSQL

The PostgreSQL support uses the pq package, which enables TLS by default. If the PostgreSQL server does not use TLS, it can be disabled with the sslmode query parameter.

gridserver-exporter -u postgres://username:password@host/databasename?sslmode=disable

For PostgreSQL specific options, see the pq package documentation.

GridServer Web Services API

The GridServer Web Services API can be accessed over HTTP or HTTPS. The URL supplied must specify the Director, as Brokers do not support the BrokerAdmin service.

gridserver-exporter -u http://username:password@host[:port][/path]

TLS certificate validation is enabled by default. It can be disabled using the no-tls-verify flag:

gridserver-exporter -u https://username:password@host --no-tls-verify
Mock data

The mock data source is useful for testing purposes (e.g. testing Prometheus or Grafana) as it does not require a GridServer installation.

gridserver-exporter -u mock://
Building

The godror package depends on ODPI, which has installation requirements.

The compile-time version information can be set with ldflags:

BRANCH=$(git rev-parse --abbrev-ref HEAD)
REVISION=$(git rev-parse HEAD)
DATE=$(date +%F)
go build -ldflags "-X github.com/prometheus/common/version.Branch=$BRANCH \
-X github.com/prometheus/common/version.Revision=$REVISION \
-X github.com/prometheus/common/version.BuildDate=$DATE \
-X github.com/prometheus/common/version.BuildUser=$USER"
Vendoring

If the dependencies are vendored, go mod vendor will skip the odpi directory because it does not contain any .go files. This may be resolved with:

go get && cp -r ~/go/pkg/mod/github.com/godror/godror@v0.15.0/odpi vendor/github.com/godror/godror/godror@v0.15.0/
Configuring

The once parameter causes an immediate fetch of statistics, followed by an exit. It is useful for validating credentials and configuration options.

gridserver-exporter -u http://username:password@host --once

Known Issues

  • The Oracle Instant Client installs signal handlers which may cause crashes when CTRL-C is entered. Adding the following flags to the sqlnet.ora file on the system may prevent the crashes.
DIAG_ADR_ENABLED=OFF
DIAG_DDE_ENABLED=FALSE
DIAG_SIGHANDLER_ENABLED=FALSE
  • The timeout parameter is ignored by the SQL client functionality.

License

Apache License 2.0, see LICENSE.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL