User Tools
development:applications:prometheus-smtp-exporter
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| development:applications:prometheus-smtp-exporter [2017/12/05 11:51] – adsilva | development:applications:prometheus-smtp-exporter [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Prometheus SMTP Exporter ====== | ||
| + | |||
| + | We use [[https:// | ||
| + | |||
| + | |||
| + | mailexporter is a platform specific binary which must be built and deployed on the server where SMTP is running. It basically provides an HTTP endpoint with all the statistics related to the SMTP server. This end point is fetched/ | ||
| + | |||
| + | For more information on how to build mailexporter, | ||
| + | refer: [[https:// | ||
| + | |||
| + | |||
| + | The set up is very straight forward, | ||
| + | |||
| + | After building the appropriate binary, place it in an appropriate directory. usually "/ | ||
| + | |||
| + | **Note:** The binaries are not cross-platform compatible. Either build it on the same machine where you want to run the exporter or add a cross-compile directive when building it locally. | ||
| + | |||
| + | Building it locally for linux, will look something like this: | ||
| + | |||
| + | < | ||
| + | brew install golang | ||
| + | mkdir ~/go && export GOPATH=$HOME/ | ||
| + | go get github.com/ | ||
| + | cd ~/ | ||
| + | go get ./... | ||
| + | env GOOS=linux GOARCH=amd64 go build mailexporter.go | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== Mailexporter configuration ====== | ||
| + | |||
| + | By defaut, mailexporter reads / | ||
| + | |||
| + | <code yaml> | ||
| + | # time between two monitoring-attempts | ||
| + | monitoringinterval: | ||
| + | |||
| + | # Time until mail must have arrived after sending for positive outcome | ||
| + | mailchecktimeout: | ||
| + | |||
| + | servers: | ||
| + | - name: localhost | ||
| + | server: localhost | ||
| + | port: 587 # port to use on Server for SMTP | ||
| + | login: monitoring | ||
| + | passphrase: 123password | ||
| + | from: monitoring@helper1.com | ||
| + | to: monitoring@example.com | ||
| + | detectiondir: | ||
| + | </ | ||
| + | ====== Prometheus Configuration ====== | ||
| + | |||
| + | Once mailexporter is running and it is confirmed that the endpoint is available, we can configure Prometheus as follows: | ||
| + | |||
| + | <code yaml> | ||
| + | - job_name: 'SMTP stats' | ||
| + | scrape_interval: | ||
| + | static_configs: | ||
| + | - targets: | ||
| + | - ' | ||
| + | </ | ||
| + | |||
| + | For more information on how to setup your own rules in the Errigal environment, | ||
| + | refer: [[https:// | ||