Cpanel Mail Exporter

https://github.com/pndhkm/cpanel_mail_exporter

Cpanel Mail Exporter screenshot 1
Cpanel Mail Exporter screenshot 2
Cpanel Mail Exporter screenshot 3
Cpanel Mail Exporter screenshot 4
Cpanel Mail Exporter screenshot 5

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

  1. Perform cPanel API and UAPI functions through the WHM API cpanel-api
  2. Track Email track-email
  3. 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

ArgumentDescriptionExample Value
--apikeyWHM API key for authentication."your-api-key"
--endpointWHM API endpoint URL (include the port, usually 2087)."your-whm-endpoint:2087"
--listenAddress 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

or manually import

Contributing

Contributions are welcome! Please open an issue or submit a pull request.


See

Revisions
RevisionDescriptionCreated

Get this dashboard

Import the dashboard template

or

Download JSON

Datasource
Dependencies