Skip to main content

Minimon

minimon is a 'minimal' (as in minimal music) IT monitoring tool for the command line.

Compared to lots of other IT monitoring solutions it has the following main attributes:

  • It follows a 'configuration as application' approach, i.e. instead of configuring your monitoring via UI you will 'write' your whole executable application yourself! (see example below for clarification)
  • It's ultra-flexible by being more an 'automation with functional pipes' framework letting you do anything you can automate rather than a configurable application
  • It's minimal also in terms of a hobby project. Don't expect something which competes with Checkmk, Prometheus, etc.
  • Since you have to implement / modify the main executable using plain Python (in contrast to configuring some black box application), you might get into Python programming rather quickly as a side effect.

There are some technical properties and maxims you might be interested in as well:

  • textual / rich based
  • Heavy use of asynchronous programming
  • Functional approaches wherever possible
  • asyncssh instead of paramiko

Installation

While you can just clone and use minimon, the intended way to use it is to install it from PyPI.org or run it from inside a virtual environment.

Install it locally using pip:

[<PYTHON> -m] pip[3] install [--user] [--upgrade] minimon

Currently you need at least Python v3.10+ installed in order to run minimon. In case your system provides older versions only, consider using pyenv to install any other version next to your system-Python.

Example

The following snippet is taken from a recent minimon installation folder, e.g. ~/.local/lib/python3.11/site-packages/minimon/sites/mvm.py and shows a poorly minimalistic but working example of a fully functional minimon site:

from minimon import *
from minimon.plugins import df, ps

with Monitor("MVM"):

    @view(("host", [Host("localhost")]))
    async def local_resources(host: Host) -> AInsights:
        """This async generator will be invoked by the above `view` and run continuously to
        gather and yield monitoring data"""
        async for insight in Bundler(
            ps=ps.generate(host) | ps.parse() | ps.check(),
            df=df.generate(host) | df.parse() | df.check(),
        ):
            yield insight

Create/copy your own file to test and modify:

mkdir minimon-sites                                                                                                 130 ↵
cp ~/.local/lib/python3.11/site-packages/minimon/sites/mvm.py minimon-sites
chmod +x minimon-sites/mvm.py

Start it by executing

minimon-sites/mvm.py

Why (do I do this?)

  • async
  • functional
  • testability
  • bullet proof

Todo

Core / enabler:

  • Fix: CTRL-C hang due to non terminated tasks

  • Read ssh passwords once on startup

  • Provide a way to use data propagating through functions by different consumers

  • Provide monadic (async) function chaining

  • Support for endless processes ("dmesg -w")

  • View: arbitrary number of parameters (0, 1, 2 for now)

  • Host-config: parametrize check-pipe

  • Fix: Styled log output, see https://stackoverflow.com/questions/77716718

  • Show Links (e.g. to monitoring)

  • Mature hierarchic error handling/propagation and restart management

  • Capture and persist metrics

  • Recognize (dis)appearance of found entities (df-mountpoints, network adapters, etc)

  • Support for remote APIs

  • Support for multi line scripts

  • Support for optional su -c ..

  • Recognize check state transitions -> notifications

  • Provide ways to interact

  • Improve logging: to file, log threads, log task context

  • Let core run in background

  • Check windows support

  • research: send mails

Visuals

  • visualize metrics

Reactions (automatic actions)

  • send build break notifications
  • run scripts open/close branches

Actions (user interaction)

  • rebuild failed jobs
  • kill/delete containers/volumes/tags/images
  • open/close branches
  • cleanup workspace(s)

SSH-Plugins:

  • disk space
  • ram
  • cpu usage over time
  • network usage per process
  • android: check battery
  • docker: number containers/images/volumes/networks/build cache
  • wrong permissions/ownerships /home/jenkins -user root
  • unused directories

API-Plugins:

  • docker: per container: cpu / ram / runtime
  • jenkins-jobs
    • job tree
    • warning about certain job results (sheriffing)
    • branch sheriffing state
  • [ ]job <=> containers association
  • [ ]nexus artifacts

Development & Contribution

Setup

For active development you need to have poetry and pre-commit installed

python3 -m pip install --upgrade --user poetry pre-commit
poetry self add poetry-bumpversion
git clone git@projects.om-office.de:frans/minimon.git
cd minimon
pre-commit install
# if you need a specific version of Python inside your dev environment
poetry env use ~/.pyenv/versions/3.10.4/bin/python3
poetry install

Workflow

  • Create/test/commit changes and check commits via pre-commit
  • after work is done locally:
    • bump version using poetry version patch
    • build and check a package
poetry build && \
twine check dist/* &&
python3 -m pip uninstall -y minimon && \
python3 -m pip install --user dist/minimon-$(grep -E "^version.?=" pyproject.toml | cut -d '"' -f 2)-py3-none-any.whl
  • check installed package
  • publish the new package poetry publish --build
  • commit new version && push

License

For all code contained in this repository the rules of GPLv3 apply unless otherwise noted. That means that you can do what you want with the source code as long as you make the files with their original copyright notice and all modifications available.

See GNU / GPLv3 for details.

This project is not free for machine learning. If you're using any content of this repository to train any sort of machine learned model (e.g. LLMs), you agree to make the whole model trained with this repository and all data needed to train (i.e. reproduce) the model publicly and freely available (i.e. free of charge and with no obligation to register to any service) and make sure to inform the author (me, frans.fuerst@protonmail.com) via email how to get and use that model and any sources needed to train it.

Good to know

Gather some information

sshd for Android

  • SimpleSSH
  • host <IP> -> hostname
  • scp -P2222 ~/.ssh/id_ed25519.pub <HOST>:authorized_keys
  • ssh -p2222 <HOST> "su -c 'dmesg -w'"
  • ssh -p2222 <HOST> "su -c 'df'"
  • ssh -p2222 <HOST> "su -c 'top'"
  • ssh -p2222 <HOST> "su -c 'dumpsys battery'"

Metadata

Release files for minimon 0.1.7

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

Source distribution (sdist)

Source distribution for minimon 0.1.7
File Size Uploaded Provenance
minimon-0.1.7.tar.gz 31.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 71.1 kB

Release files / minimon-0.1.7.tar.gz

Download URL minimon-0.1.7.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
150c18a9eddef22194d25b3bd81a5d68628a50bd5fa6370b1a271f64b39926ac
BLAKE2b-256 checksum
How to use checksums
30328e5bde5cb93a79368d178c8b92fec69430e5c7e55dc6485a8ec7ab1d2793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.4 Linux/6.6.8-200.fc39.x86_64

Release files / minimon-0.1.7-py3-none-any.whl

Download URL minimon-0.1.7-py3-none-any.whl
Size 39.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3644e5ef1ac4c7f44028fe483d17243fefa84f8198ce5663908801689ab770a0
BLAKE2b-256 checksum
How to use checksums
b6a13d313874c4a8c749406577ee0d8e73dce9cc5096fd3fba340409def8ec9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.4 Linux/6.6.8-200.fc39.x86_64

Security for minimon 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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