rlm-prometheus


Namerlm-prometheus JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://pypi.org/project/rlm-prometheus/
SummaryPrometheus metrics collector and exporter for RLM (Reprise License Manager)
upload_time2024-09-20 20:04:51
maintainerNone
docs_urlNone
authorNiko Ehrenfeuchter
requires_python<4.0,>=3.9
licenseGPL-3.0-or-later
keywords prometheus metrics license-metrics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📊 RLM-Prometheus 📊

[Prometheus][1] exporter providing metrics from a Reprise License Manager (RLM)
instance.

Currently tested on [Debian Linux][4] only, but as it is based on pure
[CPython][5] it should potentially also work on Windows - YMMV.

## ⚙🔧 Installation ⚙🔧

Example installation on Debian / Ubuntu:

```bash
# required for creating Python virtualenvs:
apt update
apt install -y python3-venv

# create a virtualenv in /opt:
python3 -m venv /opt/rlm-prometheus

# update 'pip' and install the 'rlm-prometheus' package:
/opt/rlm-prometheus/bin/pip install --upgrade pip
/opt/rlm-prometheus/bin/pip install rlm-prometheus
```

## 🏃 Running in foreground mode 🏃

This is mostly relevant for testing configuration settings and checking if the
exporter works as expected - to do this either activate the previously created
Python environment or call the `rlm_exporter` script using the full path to that
environment.

For convenience it is reasonable to use a configuration file in such a situation
instead of setting all the environment variables manually. Simply copy the
[config-example.yaml][3] file to e.g. `config.yaml` and adjust the settings
there. Then run the exporter like this:

```bash
rlm_exporter -vvv --config config.yaml
```

The exporter running in foreground can be terminated as usual via `Ctrl+C`.

## 👟 Running as a service 👟

```bash
adduser --system rlmexporter
cp -v /opt/rlm-prometheus/lib/python*/site-packages/resources/systemd/rlm-prometheus.service  /etc/systemd/system/
systemctl daemon-reload
systemctl edit rlm-prometheus.service
```

The last command will open an editor with the override configuration of the
service's unit file. Add a section like this **at the top** of the override
file, with the bare minimum of setting `RLM_ISV` and most likely also `RLM_URI`.
For other options available check for the commented-out lines further down in
the unit file setting environment variables starting with `RLM_`. Please note
that on *Ubuntu 20.04* the `systemct edit` command will present you with an
empty file, so you will have to copy the respective lines from below or the
provided *central* unit file.

```text
[Service]
### specific configuration for the RLM exporter service:
Environment=RLM_ISV=example_isv
Environment=RLM_URI=http://license-server.example.xy:5054
```

Finally enable the service and start it right away. The second line will show
the log messages on the console until `Ctrl+C` is pressed. This way you should
be able to tell if the service has started up properly and is providing metrics
on the configured port:

```bash
systemctl enable --now rlm-prometheus.service
journalctl --follow --unit rlm-prometheus
```

Open ports for the `rlm-prometheus` exporter:

```bash
SOURCE="any"  # <-- put an IP address here to restrict access more
ufw allow from $SOURCE to any port 8909
```

## 🔥🧱 Firewall settings for RLM on Windows 🔥🧱

For the metrics collection it is obviously necessary the exporter can gather
data from your RLM instance. The standard approach is to send requests to RLM's
built-in web server. By default access to it is blocked and those restrictions
should not be lifted more than necessary.

There is an example snippet in [Open-RlmFirewallPort.ps1][2] that demonstrates
how to adjust the Windows firewall so the collector's host IP address is allowed
to connect to RLM.

## 👾 CAUTION: memory leak in RLM 👾

Repeatedly requesting data (e.g. every 5 minutes) from RLM's built-in web server
has shown to increase its memory consumption in a linear fashion over time on
our side. This indicates a memory leak in RLM, which eventually made the license
service fail silently.

To avoid (or rather work around) this, we did set up a scheduled task on the
server hosting the RLM service that is restarting the service once a night while
also rotating its corresponding log files at the same time.

Example code on how to achieve this via PowerShell is provided in
[Restart-RlmService.ps1][6].

## 🆙 Upgrading 🆙

Assuming the exporter has been installed as described above, an upgrade to a
newer version could be done like this:

```bash
/opt/rlm-prometheus/bin/pip install --upgrade rlm-prometheus
# check the changelog for potentially new configuration settings, integrate them
# by calling `systemctl edit rlm-prometheus.service` if necessary and finally
# restart the service:
systemctl restart rlm-prometheus.service
```

[1]: https://prometheus.io/
[2]: resources/powershell/Open-RlmFirewallPort.ps1
[3]: resources/config-example.yaml
[4]: https://debian.org/
[5]: https://github.com/python/cpython
[6]: resources/powershell/Restart-RlmService.ps1

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/rlm-prometheus/",
    "name": "rlm-prometheus",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "prometheus, metrics, license-metrics",
    "author": "Niko Ehrenfeuchter",
    "author_email": "nikolaus.ehrenfeuchter@unibas.ch",
    "download_url": "https://files.pythonhosted.org/packages/59/ee/e074685811de043642a1e9874964a7a9c345a4be9f270f6374987aec4361/rlm_prometheus-0.4.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\udcca RLM-Prometheus \ud83d\udcca\n\n[Prometheus][1] exporter providing metrics from a Reprise License Manager (RLM)\ninstance.\n\nCurrently tested on [Debian Linux][4] only, but as it is based on pure\n[CPython][5] it should potentially also work on Windows - YMMV.\n\n## \u2699\ud83d\udd27 Installation \u2699\ud83d\udd27\n\nExample installation on Debian / Ubuntu:\n\n```bash\n# required for creating Python virtualenvs:\napt update\napt install -y python3-venv\n\n# create a virtualenv in /opt:\npython3 -m venv /opt/rlm-prometheus\n\n# update 'pip' and install the 'rlm-prometheus' package:\n/opt/rlm-prometheus/bin/pip install --upgrade pip\n/opt/rlm-prometheus/bin/pip install rlm-prometheus\n```\n\n## \ud83c\udfc3 Running in foreground mode \ud83c\udfc3\n\nThis is mostly relevant for testing configuration settings and checking if the\nexporter works as expected - to do this either activate the previously created\nPython environment or call the `rlm_exporter` script using the full path to that\nenvironment.\n\nFor convenience it is reasonable to use a configuration file in such a situation\ninstead of setting all the environment variables manually. Simply copy the\n[config-example.yaml][3] file to e.g. `config.yaml` and adjust the settings\nthere. Then run the exporter like this:\n\n```bash\nrlm_exporter -vvv --config config.yaml\n```\n\nThe exporter running in foreground can be terminated as usual via `Ctrl+C`.\n\n## \ud83d\udc5f Running as a service \ud83d\udc5f\n\n```bash\nadduser --system rlmexporter\ncp -v /opt/rlm-prometheus/lib/python*/site-packages/resources/systemd/rlm-prometheus.service  /etc/systemd/system/\nsystemctl daemon-reload\nsystemctl edit rlm-prometheus.service\n```\n\nThe last command will open an editor with the override configuration of the\nservice's unit file. Add a section like this **at the top** of the override\nfile, with the bare minimum of setting `RLM_ISV` and most likely also `RLM_URI`.\nFor other options available check for the commented-out lines further down in\nthe unit file setting environment variables starting with `RLM_`. Please note\nthat on *Ubuntu 20.04* the `systemct edit` command will present you with an\nempty file, so you will have to copy the respective lines from below or the\nprovided *central* unit file.\n\n```text\n[Service]\n### specific configuration for the RLM exporter service:\nEnvironment=RLM_ISV=example_isv\nEnvironment=RLM_URI=http://license-server.example.xy:5054\n```\n\nFinally enable the service and start it right away. The second line will show\nthe log messages on the console until `Ctrl+C` is pressed. This way you should\nbe able to tell if the service has started up properly and is providing metrics\non the configured port:\n\n```bash\nsystemctl enable --now rlm-prometheus.service\njournalctl --follow --unit rlm-prometheus\n```\n\nOpen ports for the `rlm-prometheus` exporter:\n\n```bash\nSOURCE=\"any\"  # <-- put an IP address here to restrict access more\nufw allow from $SOURCE to any port 8909\n```\n\n## \ud83d\udd25\ud83e\uddf1 Firewall settings for RLM on Windows \ud83d\udd25\ud83e\uddf1\n\nFor the metrics collection it is obviously necessary the exporter can gather\ndata from your RLM instance. The standard approach is to send requests to RLM's\nbuilt-in web server. By default access to it is blocked and those restrictions\nshould not be lifted more than necessary.\n\nThere is an example snippet in [Open-RlmFirewallPort.ps1][2] that demonstrates\nhow to adjust the Windows firewall so the collector's host IP address is allowed\nto connect to RLM.\n\n## \ud83d\udc7e CAUTION: memory leak in RLM \ud83d\udc7e\n\nRepeatedly requesting data (e.g. every 5 minutes) from RLM's built-in web server\nhas shown to increase its memory consumption in a linear fashion over time on\nour side. This indicates a memory leak in RLM, which eventually made the license\nservice fail silently.\n\nTo avoid (or rather work around) this, we did set up a scheduled task on the\nserver hosting the RLM service that is restarting the service once a night while\nalso rotating its corresponding log files at the same time.\n\nExample code on how to achieve this via PowerShell is provided in\n[Restart-RlmService.ps1][6].\n\n## \ud83c\udd99 Upgrading \ud83c\udd99\n\nAssuming the exporter has been installed as described above, an upgrade to a\nnewer version could be done like this:\n\n```bash\n/opt/rlm-prometheus/bin/pip install --upgrade rlm-prometheus\n# check the changelog for potentially new configuration settings, integrate them\n# by calling `systemctl edit rlm-prometheus.service` if necessary and finally\n# restart the service:\nsystemctl restart rlm-prometheus.service\n```\n\n[1]: https://prometheus.io/\n[2]: resources/powershell/Open-RlmFirewallPort.ps1\n[3]: resources/config-example.yaml\n[4]: https://debian.org/\n[5]: https://github.com/python/cpython\n[6]: resources/powershell/Restart-RlmService.ps1\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Prometheus metrics collector and exporter for RLM (Reprise License Manager)",
    "version": "0.4.0",
    "project_urls": {
        "Changelog": "https://github.com/imcf/rlm-prometheus/blob/main/CHANGELOG.md",
        "Homepage": "https://pypi.org/project/rlm-prometheus/",
        "Organisation Homepage": "https://imcf.one/",
        "Repository": "https://github.com/imcf/rlm-prometheus",
        "Twitter": "https://twitter.com/imcf_basel"
    },
    "split_keywords": [
        "prometheus",
        " metrics",
        " license-metrics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4e1583676ae32eb6b6606448ec6585bb20f0b1a8d85fa7fc97fa089ff85fcd6",
                "md5": "46022c21f9702e1247ba2baa46d9b98e",
                "sha256": "097f361232089b4142a974a0166c861da7d1df04967779f814bdd7238aa2a734"
            },
            "downloads": -1,
            "filename": "rlm_prometheus-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "46022c21f9702e1247ba2baa46d9b98e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 24385,
            "upload_time": "2024-09-20T20:04:50",
            "upload_time_iso_8601": "2024-09-20T20:04:50.250386Z",
            "url": "https://files.pythonhosted.org/packages/b4/e1/583676ae32eb6b6606448ec6585bb20f0b1a8d85fa7fc97fa089ff85fcd6/rlm_prometheus-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59eee074685811de043642a1e9874964a7a9c345a4be9f270f6374987aec4361",
                "md5": "e2911d95ec9cbf059f412e3b1530c3e1",
                "sha256": "7f153c6b40a22a8dd278c5200ac72274f20531831a0ecfb5cc244e99a90314f8"
            },
            "downloads": -1,
            "filename": "rlm_prometheus-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e2911d95ec9cbf059f412e3b1530c3e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 23203,
            "upload_time": "2024-09-20T20:04:51",
            "upload_time_iso_8601": "2024-09-20T20:04:51.858578Z",
            "url": "https://files.pythonhosted.org/packages/59/ee/e074685811de043642a1e9874964a7a9c345a4be9f270f6374987aec4361/rlm_prometheus-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-20 20:04:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "imcf",
    "github_project": "rlm-prometheus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rlm-prometheus"
}
        
Elapsed time: 1.29978s