fix(roles/monitoring_plugins)!: align the source install with the packages - #315
Merged
Merged
Conversation
…kages The source install diverged from what build/install-plugins.sh and the one-liner installer produce, in five ways that each break a monitored host: - the venv was missing httpx, pymysql, pypsrp, PySmbClient and pywinrm. They enter through linuxfabrik-lib, which the role filters out of requirements.in because it deploys the library from GitHub. Install the library's own requirements.in alongside; the two lists overlap, so they need separate pip calls. A regression since the venv rewrite, which replaced the lockfile (carrying the resolved closure) with requirements.in - notification plugins went to notifications/ and event plugins nowhere. The packages and the shipped Director basket expect all of them flat in the plugin directory. Mirror build/install-plugins.sh, example included - modes came from the controller checkout, so a hardened umask left the plugins unreadable for the monitoring user. Force them via rsync --chmod and chmod the venv, without touching the shared plugin directory recursively (setuid check_icmp) - ansible.builtin.pip needs packaging or setuptools on the managed node, and the bash completion needs /etc/bash_completion.d to exist. Neither is present on a minimal installation - rsync pushed the controller's numeric owner and a freshly built staging tree's mtimes, so four tasks reported a change on every run Also drop a venv built with another Python, and abort when the checkout yields no plugins. The molecule scenario missed the missing dependencies because it runs cpu-usage, which only needs psutil, and asserts on tracebacks: lib.url imports httpx lazily and answers a missing module with a plain sentence. Add nginx-status, which reaches lib.url.fetch() with no arguments, no nginx and no internet access, and assert on the message instead of the exit code, since both outcomes are UNKNOWN. Verified with install_method 'source' against systemd containers of Rocky 8, 9 and 10, Debian 13 and Ubuntu 24.04: 292 plugins, changed=0 on the second run, and uptime plus githubstatus run as the monitoring user. The new assertion fails on a venv with httpx removed and passes after a re-run of the role.
NavidSassan
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pulls the source install of
monitoring_pluginsback in line with what the packages produce. Reference for the layout isbuild/install-plugins.shin the monitoring-plugins repo (what rpm and deb run), andtools/install-monitoring-pluginsfor the permission and venv handling.The
packagepath and Windows are untouched.What was broken
notifications/, event plugins nowhere/etc/bash_completion.dnot createdbash-completionpackagepython3-packagingmissingThe dependency defect is a regression: before the venv rewrite the role installed
lockfiles/pyXX/requirements.txt, which carries the resolved closure oflinuxfabrik-libincluding httpx. The rewrite replaced it withrequirements.inminuslinuxfabrik-liband dropped the transitive dependencies with it. It became visible whenlib.urlmoved to httpx on 2026-05-10.Why the test did not catch it
monitoring_plugins_source/verify.ymlrunscpu-usage, which only needs psutil, and asserts onTraceback/ModuleNotFoundError. Neither ever appears:lib/url.pyimports httpx lazily insidefetch()and answers a missing module with a plain sentence. This PR addsnginx-status, which reacheslib.url.fetch()with no arguments, without nginx and without the host needing internet access (its default URL is on localhost, so a refused connection is the expected result). The assertion goes by the message, since both outcomes are UNKNOWN and the exit code cannot tell them apart.Verified
install_method: 'source',version: 'dev'against systemd containers of Rocky 8, Rocky 9, Rocky 10, Debian 13 and Ubuntu 24.04:changed=0on the second run,uptimeandgithubstatusrun as the monitoring user (icinga/nagios),Molecule itself was not run (needs the libvirt VMs).
Two decisions worth a second opinion
requirements.inor the lockfiles. I kept the "newest unpinned" policy the role README promises and install the library'srequirements.inon top. The one-liner installer instead uses the hash-pinned lockfiles of both repos and then removeslinuxfabrik-libfrom the venv. Switching to the lockfiles would close this class of drift for good, since nothing would have to be filtered or reassembled, but it changes the documented policy.Not in this PR
install-monitoring-plugins.ps1verifies the Authenticode signature of the MSI before installing,windows-package.ymldoes not. Worth pulling through, but I have no Windows host to verify it on.tools/install-monitoring-pluginsitself does not deploy the event plugins, while the packages do. Currently one plugin (cloudflare-security-level). Upstream issue, not this repo.