Skip to main content

Proxmox Mail Gateway

Monitoring Connector Assets​

Monitored Objects​

The Monitoring Connector Proxmox Mail Gateway collects metrics for:

  • Mail
  • Version

Collected Metrics​

Metric nameDescriptionUnit
mails.incoming.countNumber of incoming mails
mails.outgoing.countNumber of outgoing mails
mails.traffic.in.bytespersecondIncoming mail trafficB/s
mails.traffic.out.bytespersecondOutgoing mail trafficB/s
mails.spam.incoming.countNumber of incoming spam mails
mails.spam.outgoing.countNumber of outgoing spam mails
mails.virus.incoming.countNumber of incoming virus mails
mails.virus.outgoing.countNumber of outgoing virus mails

Prerequisites​

To control your Proxmox Mail Gateway, the Rest API must be configured.

E.g: https://pmg.proxmox.com/pmg-docs/api-viewer/index.html

Setup​

  1. Install the Centreon Plugin on every Poller:
yum install centreon-plugin-Applications-Proxmox-Mg-Api
  1. On the Centreon Web interface in Configuration > Monitoring Connector Manager, install the Proxmox Mail Gateway Monitoring Connector

Host configuration​

  • Add a new Host and apply the App-Proxmox-Mg-Api-custom Host Template

Once the template applied, some Macros have to be configured:

MandatoryNameDescription
XPROXMOXMGAPIPORTPort used (Default: 8006)
XPROXMOXMGAPIPROTOSpecify https if needed (Default: 'https')
XPROMOXMGAPIURLPATHApi endpoint (Default: '/api2/json')
XPROXMOXMGAPIUSERNAMEApi username
XPROXMOXMGAPIPASSWORDApi password
XPROMOXMGAPIREALMApi realm (Default: 'pmg')
PROXMOXMGAPIEXTRAOPTIONSAny extra option you may want to add to the command (eg. a --verbose flag)

How to test the Plugin and what are the main options for?​

Once the Plugin installed, log into your Poller using the centreon-engine user account and test by running the following command (Parameters such as api-username or api-passwordhave to be adjusted):

/usr/lib/centreon/plugins/centreon_proxmox_mg_api.pl \
--plugin=apps::proxmox::mg::restapi::plugin \
--mode=mail \
--hostname='10.30.2.79' \
--port='8006' \
--proto='https' \
--api-username='myapiusername' \
--api-password='myapipassword' \
--hours=1 \
--timespan=1800 \
--verbose

Output example:

OK: Mail statistics are ok | 'mails.incoming.count'=71;;;0; 'mails.outgoing.count'=31;;;0; 'mails.traffic.in.bytespersecond'=4255.35B/s;;;0; 'mails.traffic.out.bytespersecond'=2780.03B/s;;;0; 'mails.spam.incoming.count'=5;;;0; 'mails.spam.outgoing.count'=0;;;0; 'mails.virus.incoming.count'=0;;;0; 'mails.virus.outgoing.count'=0;;;0;
checking mail statistics
number of mails incoming: 71, outgoing: 31
traffic in: 4.16 KB/s, out: 2.71 KB/s
number of spam mails incoming: 5, outgoing: 0
number of virus mails incoming: 0, outgoing: 0

The command above monitors mails statistics (--mode=mail).

It uses api-username (--api-username='myapiusername'), an api-password (--api-password='myapipassword') and it connects to the host 10.30.2.79 (--hostname='10.30.2.79') on the port 8006 (--port='8006') using https (--proto='https').

All the options that can be used with this plugin can be found over the --help command:

/usr/lib/centreon/plugins/centreon_proxmox_mg_api.pl \
--plugin=apps::proxmox::mg::restapi::plugin \
--mode=mail \
--help

Troubleshooting​

UNKNOWN: 500 Can't connect to 10.30.2.79:8006​

This error message means that the Centreon Plugin couldn't successfully connect to the Proxmox Mail Gateway API. Check that no third party device (such as a firewall) is blocking the request. A proxy connection may also be necessary to connect to the API. This can be done by using the --proxyurl='http://proxy.mycompany:8080' option in the command.

UNKNOWN: 501 Protocol scheme 'connect' is not supported​

When using a proxy to connect to the Proxmox Mail Gateway API, this error message means that the Centreon Plugin library does not support the proxy connection protocol.

In order to prevent this issue, use the curl HTTP backend by adding the following option to the command: --http-backend='curl'.