Skip to main content

Grommunio email system data exporter for Prometheus

Project description

Grommunio exporter for Prometheus

License Percentage of issues still open GitHub Release Linux linter

This program exposes Grommunio email system metrics for Prometheus
Since we already have node_exporter for system metrics and postfix_exporter for email deliverability metrics, this closes the gap with mailbox metrics.

Requirements

  • Grommunio 2.x
  • python >= 3.7

Grafana Dashboard

You can find an example dashboard in the examples directory

image image

Automatic installation

On current Grommunio appliances based on OpenSuSE, you can use the following all-in-one installer script

curl -sSfL https://raw.githubusercontent.com/netinvent/grommunio_exporter/refs/heads/main/install.sh | sh -

Manual Install

Easiest way to install grommunio_exporter is to use python pip:

python3 -m pip install grommunio_exporter

Upgrading

Upgrading can be done via following command lines

python3 -m pip install --upgrade grommunio_exporter
systemctl restart grommunio_exporter

Special notes for Grommunio appliances

Note that on Grommunio appliances based on OpenSuSE 15.6, you'll have to install pip first and update wheel package via the following commands. Also note that installing the requested requirements for grommunio_exporter will fail if pip and wheel package isn't up to date in the Grommunio appliance (zypper installs pip 10.0.1, and pip 21.3.1 is required). Lastly, the message pygobject 3.42.2 requires pycairo>=1.16.0, which is not installed. can be ignored on these systems.

zypper install -y python3-pip
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install grommunio_exporter

Installing via pip will create /usr/bin/grommunio_exporter. This file can be run manually for testing purposes, or run as service.

The exporter needs to be installed on the host that has grommunio-admin cli interface.
Once installed, you can create a systemd service file from the systemd unit file in the example dir.
Once the service is running, you may query the exporter with:

curl http://localhost:9769/metrics

Firewall

The default exporter-port is 9799/tcp, which you can change in the config file. Keep in mind that you need to create a firewall rule if you want to query it's output.

You can create the firewall rule with the following command on a Grommunio appliance

firewall-cmd --add-port=9799/tcp --permanent && firewall-cmd --reload

Metrics

The exporter currently produces the following metrics:

  • grommunio_api_status is 0 when no errors where found in api calls
  • grommunio_exporter_version is 0 when version successfully reported
  • grommunio_gromox_version is 0 when version successfully reported
  • grommunio_admin_version is 0 when version successfully reported
  • grommunio_mailbox_count
  • grommunio_shared_mailbox_count

The following metrics are per user and have labels hostname,domain,username:

  • grommunio_mailbox_messagesize
  • grommunio_mailbox_storage_quota_limit
  • grommunio_mailbox_prohibit_receive_limit
  • grommunio_mailbox_prohibit_send_quota
  • grommunio_mailbox_creation_time
  • gauge_grommunio_mailbox_out_of_office_state

Alert rules:

    - alert: Storage Quota
      expr: (1-((grommunio_mailbox_storage_quota_limit - grommunio_mailbox_messagesize)/grommunio_mailbox_storage_quota_limit))*100 > 95
      for: 5m

    - alert: Prohibit Send Quota
      expr: (1-((grommunio_mailbox_prohibit_send_quota - grommunio_mailbox_messagesize)/grommunio_mailbox_prohibit_send_quota))*100 > 95
      for: 5m

    - alert: Prohibit Receive Quota
      expr:  (1-((grommunio_mailbox_prohibit_receive_limit - grommunio_mailbox_messagesize)/grommunio_mailbox_prohibit_receive_limit))*100 > 95
      for: 5m

Customization

You may create a grommunio_exporter.yaml that can be added to the exporter via --config-file=/etc/grommunio_exporter.yaml argument.
This file can override the following:

  • http listen ip
  • http listen port
  • http authentication
  • grommunio hostname

Troubleshooting

This program has currently been tested on grommunio-admin-api-1.16.8.

By default, the exporter will log to /var/log/grommunio_exporter.log
You can override this in the config file.

You may also run the exporter with --debug in order to gain more information.

You can set the following scrape settings in the prometheus job:

scrape_interval: 300s
scrape_timeout: 240s

Troubleshooting python pip on Grommunio Appliances

There maybe errors with python 3.6 pip that is installed in Grommunio appliances based on OpenSuse 15.5/15.6. If running pip shows the following error:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/site-packages/pip/__main__.py", line 16, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "/usr/lib/python3.6/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
    from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
  File "/usr/lib/python3.6/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
    from pip._internal.models.scheme import SCHEME_KEYS, Scheme
ImportError: cannot import name 'SCHEME_KEYS'

You may want to reinstall a newer version of pip with the following command:

rm -rf /usr/lib/python3.6/site-packages/setuptools*
rm -rf /usr/lib/python3.6/site-packages/pip*
python3 -m ensurepip

Misc

This version of the grommunio exporter uses the locally installed grommunio-admin cli interface instead of the REST API.
Pros:

  • No need for authentication

Cons:

  • Not all commands output parseable json
  • Probably slower than REST UI

If the project gains some traction, we can add REST UI support.

License

Licensed under GPLv3.0... Contributions are welcome
(C) 2024 NetInvent SASU

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grommunio_exporter-0.6.0.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grommunio_exporter-0.6.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file grommunio_exporter-0.6.0.tar.gz.

File metadata

  • Download URL: grommunio_exporter-0.6.0.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.10

File hashes

Hashes for grommunio_exporter-0.6.0.tar.gz
Algorithm Hash digest
SHA256 69d368f5056ea5728302c3810b85e7730005cd6f93b2e39acd31be53698b1442
MD5 7804ef410f3cb52cf8d5f6e6c5b76cb1
BLAKE2b-256 2da2ae28c5bf04e1eb425f158386c2c2502c96017ff741ddc3cdece22eb7f485

See more details on using hashes here.

File details

Details for the file grommunio_exporter-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for grommunio_exporter-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ccf40ad9bd3fd73f320a862477c7fc31ea8d0ea7cf2dec2bafa9f231a280df5
MD5 aa032d0776afb4aba1c64f467ad75ce2
BLAKE2b-256 b6f435436c5a3b9542c4b596cf470f4ee14b7636d5b3e4d7808867e84c6cfdc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page