Cpanel Mail Exporter
https://github.com/pndhkm/cpanel_mail_exporter
cPanel Mail Exporter
cPanel Mail Exporter is a tool that fetches email logs from a WHM/cPanel server and exposes them as Prometheus metrics.
WHM API Configuration
Enabled Features
- Perform cPanel API and UAPI functions through the WHM API
cpanel-api
- Track Email
track-email
- Troubleshoot Mail Delivery
mailcheck
Usage
Run the cpanel_mail_exporter
binary with the required command-line arguments:
./cpanel_mail_exporter --apikey="your-api-key" --listen="localhost:9197" --endpoint="your-whm-endpoint:2087"
Command-Line Arguments
Argument | Description | Example Value |
---|---|---|
--apikey | WHM API key for authentication. | "your-api-key" |
--endpoint | WHM API endpoint URL (include the port, usually 2087 ). | "your-whm-endpoint:2087" |
--listen | Address and port to expose Prometheus metrics. | "localhost:9197" |
Example
./cpanel_mail_exporter --apikey="$apikeywhm" --listen="localhost:9197" --endpoint="$url-whm:2087"
Prometheus Configuration
- job_name: 'cpanel_mail_exporter'
scrape_interval: 60s
metrics_path: /metrics
static_configs:
- targets: ['localhost:9197']
labels:
instance: 'serverx'
Grafana
Dashboard ID:
22796
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
See
- Prometheus for the metrics framework.
- cPanel/WHM for the API.
Data source config
Collector config:
Upload an updated version of an exported dashboard.json file from Grafana
Revision | Description | Created | |
---|---|---|---|
Download |