Skip to main content

uMonitor

This is a minimalistic python supervisor for your microservices.
Once started, it will launch all the services you've specified in the provided config file, and monitor their execution. Suppose you have following services in the config.json:

{
    "services" : [
        {
            "comment": "Another service to run and monitor.",
            "program" : "python3",
            "args" : ["other_script.py"],
            "persist"  : true,
            "cwd" : "/opt"
        },
        {
            "comment": "And this one should not be restarted",
            "program" : "bash",
            "args" : ["will_be_executed_with_bin_bash.sh"],
            "persist" : false,
            "cwd" : "/opt"
        }
    ]
}

Then the supervisor (uMonitor) will run the specified commands and for those which have persis set, will restart the described processes, whenever they fail/crash.

More complex: it also provides environment variables and venv-like behavior for the specified programs. See the config_example.json for more details.

{
    "comment": "Treat this as virtual environment, but not only for python.",
    "interpreters" : {
        "python3" : "/venv_some/bin/python3",
        "sh" : "/bin/sh",
        "bash" : "/bin/bash"
    },

    "comment": "Services to run and monitor.",
    "services" : [
        {
            "program" : "python3",
            "args" : ["script_1.py"],
            "comment": "Do not recover after crashes",
            "persist" : false,
            "cwd" : "/opt",
            "env" : {
                "PYTHONPATH" : [
                    "/opt/your_python_module/",
                    "/usr/local/another/module/",
                    "/joined_with/colon/will_be"
                ],
                "PATH": [
                    "/opt/prog_1/bin/",
                    "/home/username/.prog_2/bin/",
                    "/joined_with/colon/will_be"
                ],
                "ENVIRON_VARIABLE": [
                    "SINGLE_VALUE_42"
                ]
            }
        },
        {
            "comment": "Another service to run and monitor.",
            "program" : "python3",
            "args" : ["other_script.py"],
            "persist"  : true,
            "cwd" : "/opt"
        },
        {
            "comment": "And this one should not be restarted",
            "program" : "bash",
            "args" : ["will_be_executed_with_bin_bash.sh"],
            "persist" : false,
            "cwd" : "/opt"
        }
    ]
}

Installation:

  • Installation using pip:
python3 -m pip install umonitor
  • Installation using poetry:
poetry add umonitor

Usage example:

  • As a callable module:
python3 -m umonitor config.json
  • In a script:
import umonitor

monitor = umonitor.uMonitor("config.json")
monitor.run()

Release files for umonitor 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for umonitor 0.1.5
File Size Uploaded
uMonitor-0.1.5.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for umonitor 0.1.5
File Interpreter ABI Platform
uMonitor-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size:10.4 kB

Release files / uMonitor-0.1.5.tar.gz

Download URL uMonitor-0.1.5.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4de05cd1b774fa11afbec2a275deb7ad16ae9cf79a7e97bc4aefd7482212cf47
BLAKE2b-256 checksum
How to use checksums
b0d0ca90eddaefa7f82420f5981b20008696f1e475b13141e4b84a01301c1ab6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.7.12 Linux/5.4.0-87-generic

Release files / uMonitor-0.1.5-py3-none-any.whl

Download URL uMonitor-0.1.5-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5916e2430180bd9eceb5a6103102b4f6f3a99e0bccf6c3bb1f22eae450f4d2c1
BLAKE2b-256 checksum
How to use checksums
3e07f3f3962ad62dbeb609cd18cf47795312ebb06ad4687fecb74f739d932d08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.7.12 Linux/5.4.0-87-generic

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page