The sansay exporter allows sansay probing of endpoints over HTTP, HTTPS. Much of this code was taken from snmp_exporter.
Download the most suitable binary from the releases tab
Then:
./sansay_exporter <flags>
Note: You may want to enable ipv6 in your docker configuration
docker run --rm -d -p 9116:9116 --name sansay_exporter
Visiting http://localhost:9116/sansay?target=localhost:8888 will return metrics against localhost:8888.
IMPORTANT NOTE: For the SOAP interface to work correctly took a modification to the gowsdl library, which was made in the vendored version.
Therefore, to build and run successfully you MUST use the vendored version:
$ go build -mod=vendor -ldflags '-X main.Version=x.x'
After a successful local build:
docker build -t sansay_exporter .
sansay exporter is configured via command-line flags (such as what port to listen on, and the logging format and level).
To view all available command-line flags, run ./sansay_exporter -h
.
The timeout of each probe is automatically determined from the scrape_timeout
in the Prometheus config, slightly reduced to allow for network delays.
If not specified, it defaults to 10 seconds.
The sansay exporter needs to be passed the target as a parameter, this can be done with relabelling.
Example config:
scrape_configs:
- job_name: 'sansay'
metrics_path: /sansay
params:
username: ['user']
password: ['password']
static_configs:
- targets:
- localhost:8888
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116 # The sansay exporter's real hostname:port.