Prometheus can scrape EmailEngine metrics from the /metrics
endpoint (e.g., http://127.0.0.1:3000/metrics
). These requests also require authorization, and you should generate an access token with the "Metrics" scope specifically for Prometheus.
Configuring Prometheus
To enable Prometheus to authenticate with EmailEngine, include the following configuration in the scrape_configs
section:
authorization:
type: Bearer
credentials: <token>
Full Example
Below is a complete example of a Prometheus scraping job for EmailEngine:
- job_name: 'emailengine'
scrape_interval: 10s
metrics_path: '/metrics'
scheme: 'http'
authorization:
type: Bearer
credentials: e209fc049632c....46dabbb7cd28
static_configs:
- targets: ['127.0.0.1:3000']
Testing with Curl
To check if the /metrics
endpoint is functioning, you can use a curl
command similar to regular API requests:
$ curl http://127.0.0.1:3000/metrics -H "Authorization: Bearer abcdef"
The response will contain metrics in the following format:
# HELP thread_starts Number of started threads
# TYPE thread_starts counter
thread_starts 7
# HELP thread_stops Number of stopped threads
# TYPE thread_stops counter
thread_stops 0
...