grommunio-exporter


Namegrommunio-exporter JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/netinvent/grommunio_exporter
SummaryGrommunio email system data exporter for Prometheus
upload_time2024-11-11 12:19:56
maintainerNone
docs_urlNone
authorNetInvent - Orsiris de Jong
requires_python>=3.6
licenseGPLv3
keywords mail grommunio prometheus linux cli grafana
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Grommunio exporter for Prometheus
[![License](https://img.shields.io/badge/license-GPLv3-blu.svg)](https://opensource.org/licenses/GPL-3.0)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/netinvent/grommunio_exporter.svg)](http://isitmaintained.com/project/netinvent/grommunio_exporter "Percentage of issues still open")
[![GitHub Release](https://img.shields.io/github/release/netinvent/grommunio_exporter.svg?label=Latest)](https://github.com/netinvent/grommunio_exporter/releases/latest)
[![Linux linter](https://github.com/netinvent/grommunio_exporter/actions/workflows/pylint-linux.yaml/badge.svg)](https://github.com/netinvent/grommunio_exporter/actions/workflows/pylint-linux.yaml)


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.


### Grafana Dashboard

You can find an [example dashboard](examples/grafana_dashboard_v0.2.1.json) in the examples directory

![image](examples/grafana_dashboard_v0.1.0.png)
![image](examples/grafana_dashboard_v0.1.0b.png)

### 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
```

#### Special notes for Grommunio appliances
Note that on Grommunio appliances based on OpenSuSE 15.5, 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](examples/grommunio_exporter.service) 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_mailbox_count`
- `grommunio_shared_mailbox_count`

The follwoing 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`


### 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 api concurrency
- grommunio hostname
- path to grommunio-admin

### Troubeshooting

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.

In order to be quick, `grommunio_exporter` uses concurrency to the grommunio_api.
By default, this concurrency is set to 4. You can increase the concurrency if querying is to slow.
Nevertheless, you should never query more than every 5 minutes to keep the server load down.

You can set the following scrape settings in the prometheus job:
```
scrape_interval: 300s
scrape_timeout: 240s
```

### 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  

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/netinvent/grommunio_exporter",
    "name": "grommunio-exporter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "mail, grommunio, prometheus, linux, cli, grafana",
    "author": "NetInvent - Orsiris de Jong",
    "author_email": "contact@netinvent.fr",
    "download_url": "https://files.pythonhosted.org/packages/a1/3d/0d50283fbb0213980b55d2de85315a753e92033163dd525a72f4229e54e5/grommunio_exporter-0.3.0.tar.gz",
    "platform": null,
    "description": "# Grommunio exporter for Prometheus\r\n[![License](https://img.shields.io/badge/license-GPLv3-blu.svg)](https://opensource.org/licenses/GPL-3.0)\r\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/netinvent/grommunio_exporter.svg)](http://isitmaintained.com/project/netinvent/grommunio_exporter \"Percentage of issues still open\")\r\n[![GitHub Release](https://img.shields.io/github/release/netinvent/grommunio_exporter.svg?label=Latest)](https://github.com/netinvent/grommunio_exporter/releases/latest)\r\n[![Linux linter](https://github.com/netinvent/grommunio_exporter/actions/workflows/pylint-linux.yaml/badge.svg)](https://github.com/netinvent/grommunio_exporter/actions/workflows/pylint-linux.yaml)\r\n\r\n\r\nThis program exposes Grommunio email system metrics for Prometheus  \r\nSince we already have node_exporter for system metrics and postfix_exporter for email deliverability metrics, this closes the gap with mailbox metrics.\r\n\r\n\r\n### Grafana Dashboard\r\n\r\nYou can find an [example dashboard](examples/grafana_dashboard_v0.2.1.json) in the examples directory\r\n\r\n![image](examples/grafana_dashboard_v0.1.0.png)\r\n![image](examples/grafana_dashboard_v0.1.0b.png)\r\n\r\n### Automatic installation\r\n\r\nOn current Grommunio appliances based on OpenSuSE, you can use the following all-in-one installer script\r\n```\r\ncurl -sSfL https://raw.githubusercontent.com/netinvent/grommunio_exporter/refs/heads/main/install.sh | sh -\r\n```\r\n\r\n### Manual Install\r\n\r\nEasiest way to install grommunio_exporter is to use python pip:\r\n```\r\npython3 -m pip install grommunio_exporter\r\n```\r\n\r\n#### Special notes for Grommunio appliances\r\nNote that on Grommunio appliances based on OpenSuSE 15.5, you'll have to install pip first and update wheel package via the following commands.\r\nAlso 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). \r\nLastly, the message `pygobject 3.42.2 requires pycairo>=1.16.0, which is not installed.` can be ignored on these systems.  \r\n```\r\nzypper install -y python3-pip\r\npython3 -m pip install --upgrade pip setuptools wheel\r\npython3 -m pip install grommunio_exporter\r\n```\r\n\r\nInstalling via pip will create `/usr/bin/grommunio_exporter`. This file can be run manually for testing purposes, or run as service.\r\n\r\nThe exporter needs to be installed on the host that has grommunio-admin cli interface.  \r\nOnce installed, you can create a systemd service file from the [systemd unit file](examples/grommunio_exporter.service) in the example dir.  \r\nOnce the service is running, you may query the exporter with:\r\n```\r\ncurl http://localhost:9769/metrics\r\n```\r\n\r\n### Firewall\r\n\r\nThe default exporter-port is 9799/tcp, which you can change in the config file.\r\nKeep in mind that you need to create a firewall rule if you want to query it's output.\r\n\r\nYou can create the firewall rule with the following command on a Grommunio appliance\r\n```\r\nfirewall-cmd --add-port=9799/tcp --permanent && firewall-cmd --reload\r\n```\r\n\r\n### Metrics\r\n\r\nThe exporter currently produces the following metrics:  \r\n\r\n- `grommunio_api_status` is 0 when no errors where found in api calls\r\n- `grommunio_mailbox_count`\r\n- `grommunio_shared_mailbox_count`\r\n\r\nThe follwoing metrics are per user and have labels `hostname,domain,username`:\r\n\r\n- `grommunio_mailbox_messagesize`\r\n- `grommunio_mailbox_storage_quota_limit`\r\n- `grommunio_mailbox_prohibit_receive_limit`\r\n- `grommunio_mailbox_prohibit_send_quota`\r\n- `grommunio_mailbox_creation_time`\r\n\r\n\r\n### Alert rules:\r\n\r\n```\r\n    - alert: Storage Quota\r\n      expr: (1-((grommunio_mailbox_storage_quota_limit - grommunio_mailbox_messagesize)/grommunio_mailbox_storage_quota_limit))*100 > 95\r\n      for: 5m\r\n\r\n    - alert: Prohibit Send Quota\r\n      expr: (1-((grommunio_mailbox_prohibit_send_quota - grommunio_mailbox_messagesize)/grommunio_mailbox_prohibit_send_quota))*100 > 95\r\n      for: 5m\r\n\r\n    - alert: Prohibit Receive Quota\r\n      expr:  (1-((grommunio_mailbox_prohibit_receive_limit - grommunio_mailbox_messagesize)/grommunio_mailbox_prohibit_receive_limit))*100 > 95\r\n      for: 5m\r\n```\r\n\r\n### Customization\r\n\r\nYou may create a `grommunio_exporter.yaml` that can be added to the exporter via `--config-file=/etc/grommunio_exporter.yaml` argument.  \r\nThis file can override the following:\r\n- http listen ip\r\n- http listen port\r\n- http authentication\r\n- grommunio api concurrency\r\n- grommunio hostname\r\n- path to grommunio-admin\r\n\r\n### Troubeshooting\r\n\r\nThis program has currently been tested on grommunio-admin-api-1.16.8.\r\n\r\nBy default, the exporter will log to `/var/log/grommunio_exporter.log`  \r\nYou can override this in the config file.\r\n\r\nYou may also run the exporter with `--debug` in order to gain more information.\r\n\r\nIn order to be quick, `grommunio_exporter` uses concurrency to the grommunio_api.\r\nBy default, this concurrency is set to 4. You can increase the concurrency if querying is to slow.\r\nNevertheless, you should never query more than every 5 minutes to keep the server load down.\r\n\r\nYou can set the following scrape settings in the prometheus job:\r\n```\r\nscrape_interval: 300s\r\nscrape_timeout: 240s\r\n```\r\n\r\n### Misc\r\n\r\nThis version of the grommunio exporter uses the locally installed grommunio-admin cli interface instead of the REST API.  \r\nPros:\r\n- No need for authentication\r\n\r\nCons:\r\n- Not all commands output parseable json\r\n- Probably slower than REST UI\r\n\r\nIf the project gains some traction, we can add REST UI support.\r\n\r\n### License\r\n\r\nLicensed under GPLv3.0... Contributions are welcome  \r\n(C) 2024 NetInvent SASU  \r\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Grommunio email system data exporter for Prometheus",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/netinvent/grommunio_exporter"
    },
    "split_keywords": [
        "mail",
        " grommunio",
        " prometheus",
        " linux",
        " cli",
        " grafana"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d95f6f54b67ba1b03ec01120ca93fc05c600bbef5860e8a876d3df56fe97bcb",
                "md5": "558427910c605e1dc5312983265c0e5e",
                "sha256": "8476ebe918b8df076247968598255ab0123b63cc7f124b84529582a86644b727"
            },
            "downloads": -1,
            "filename": "grommunio_exporter-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "558427910c605e1dc5312983265c0e5e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 29144,
            "upload_time": "2024-11-11T12:19:54",
            "upload_time_iso_8601": "2024-11-11T12:19:54.529766Z",
            "url": "https://files.pythonhosted.org/packages/6d/95/f6f54b67ba1b03ec01120ca93fc05c600bbef5860e8a876d3df56fe97bcb/grommunio_exporter-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a13d0d50283fbb0213980b55d2de85315a753e92033163dd525a72f4229e54e5",
                "md5": "820ded516dfd991741a67c51835d7d87",
                "sha256": "de90a92f7b31543dbd385845e18739e6255f13f2c074fecb9263c225ae18acaa"
            },
            "downloads": -1,
            "filename": "grommunio_exporter-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "820ded516dfd991741a67c51835d7d87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 28245,
            "upload_time": "2024-11-11T12:19:56",
            "upload_time_iso_8601": "2024-11-11T12:19:56.151547Z",
            "url": "https://files.pythonhosted.org/packages/a1/3d/0d50283fbb0213980b55d2de85315a753e92033163dd525a72f4229e54e5/grommunio_exporter-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 12:19:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "netinvent",
    "github_project": "grommunio_exporter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "grommunio-exporter"
}
        
Elapsed time: 1.34577s