Package: minimon
Minimonminimonis 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 applicationIt'sminimalalso 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/richbasedHeavy use of asynchronous programmingFunctional approaches wherever possibleasyncsshinstead ofparamikoInstallationWhile 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 usingpip:[<PYTHON>-m]pip[3]install[--user][--upgrade]minimonCurrently you need at least Pythonv3.10+installed in order to runminimon. In case your
system provides older versions only, consider usingpyenvto install any other version next
to your system-Python.ExampleThe following snippet is taken from a recentminimoninstallation folder, e.g.~/.local/lib/python3.11/site-packages/minimon/sites/mvm.pyand shows a poorly minimalistic but
working example of a fully functionalminimonsite:fromminimonimport*fromminimon.pluginsimportdf,pswithMonitor("MVM"):@view(("host",[Host("localhost")]))asyncdeflocal_resources(host:Host)->AInsights:"""This async generator will be invoked by the above `view` and run continuously togather and yield monitoring data"""asyncforinsightinBundler(ps=ps.generate(host)|ps.parse()|ps.check(),df=df.generate(host)|df.parse()|df.check(),):yieldinsightCreate/copy your own file to test and modify:mkdirminimon-sites130↵
cp~/.local/lib/python3.11/site-packages/minimon/sites/mvm.pyminimon-sites
chmod+xminimon-sites/mvm.pyStart it by executingminimon-sites/mvm.pyWhy (do I do this?)asyncfunctionaltestabilitybullet proofTodoCore / enabler:Fix: CTRL-C hang due to non terminated tasksRead ssh passwords once on startupProvide a way to use data propagating through functions by different consumersProvide monadic (async) function chainingSupport for endless processes ("dmesg -w")View: arbitrary number of parameters (0, 1, 2 for now)Host-config: parametrize check-pipeFix: Styled log output, seehttps://stackoverflow.com/questions/77716718Show Links (e.g. to monitoring)Mature hierarchic error handling/propagation and restart managementCapture and persist metricsRecognize (dis)appearance of found entities (df-mountpoints, network adapters, etc)Support for remote APIsSupport for multi line scriptsSupport for optionalsu -c ..Recognize check state transitions -> notificationsProvide ways to interactImprove logging: to file, log threads, log task contextLet core run in backgroundCheck windows supportresearch: send mailsVisualsvisualize metricsReactions (automatic actions)send build break notificationsrun scripts open/close branchesActions (user interaction)rebuild failed jobskill/delete containers/volumes/tags/imagesopen/close branchescleanup workspace(s)SSH-Plugins:disk spaceramcpu usage over timenetwork usage per processandroid: check batterydocker: number containers/images/volumes/networks/build cachewrong permissions/ownerships/home/jenkins -user rootunused directoriesAPI-Plugins:docker: per container: cpu / ram / runtimejenkins-jobsjob treewarning about certain job results (sheriffing)branch sheriffing state[ ]job <=> containers association[ ]nexus artifactsDevelopment & ContributionSetupFor active development you need to havepoetryandpre-commitinstalledpython3-mpipinstall--upgrade--userpoetrypre-commit
poetryselfaddpoetry-bumpversion
gitclonegit@projects.om-office.de:frans/minimon.gitcdminimon
pre-commitinstall# if you need a specific version of Python inside your dev environmentpoetryenvuse~/.pyenv/versions/3.10.4/bin/python3
poetryinstallWorkflowCreate/test/commit changes and check commits viapre-commitafter work is done locally:bump version usingpoetry version patchbuild and check a packagepoetrybuild&&\twinecheckdist/*&&python3-mpipuninstall-yminimon&&\python3-mpipinstall--userdist/minimon-$(grep-E"^version.?="pyproject.toml|cut-d'"'-f2)-py3-none-any.whlcheck installed packagepublish the new packagepoetry publish --buildcommit new version && pushLicenseFor 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.SeeGNU / GPLv3for 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 knowGather some informationfree -bdfdmesg -wlogcatdocker image list -aq | uniq | wcdocker container list -aq | wqhttps://www.baeldung.com/linux/get-cpu-usagevmstat -n 5ss --numeric --resolve --processes --infosshdfor AndroidSimpleSSHhost <IP>-> hostnamescp -P2222 ~/.ssh/id_ed25519.pub <HOST>:authorized_keysssh -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'"