feat(docker): support custom plugins and dependencies in centreon-engine container#3486
Open
Tpo76 wants to merge 3 commits into
Conversation
…ainer - Add /usr/lib/nagios/plugins/custom/ mount point for user scripts - Add 41-custom-deps.sh: installs APT packages from custom-deps.json at startup - Add 46-custom-deps-watcher_background.sh: hot-reloads custom-deps.json via inotify - Add check_custom_deps.py: validates and parses the apt package list
Contributor
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
MON-201883
Adds two mechanisms to let users extend the centreon-engine container with their own plugins and dependencies, without modifying the base image.
Changes
Custom scripts — volume mount point
A dedicated directory
/usr/lib/nagios/plugins/custom/is created and owned bycentreon-enginein the Dockerfile. Users mount their scripts there via docker-compose:Scripts must be executable (
chmod +x).Runtime APT dependencies —
custom-deps.jsonNew entrypoint script
41-custom-deps.sh(runs after40-engine.sh) reads/etc/centreon-engine/custom-deps.jsonat startup and installs the listed APT packages:{ "apt": ["snmp", "python3-requests", "libnet-snmp-perl"] }Package names are validated against Debian naming rules in
check_custom_deps.pybefore being passed toapt-get.Hot-reload is handled by
46-custom-deps-watcher_background.sh: same inotify pattern as the existing45-plugin-watcher_background.sh, re-installs whenevercustom-deps.jsonchanges.Mount in docker-compose:
No sudoers changes required —
apt/apt-getare already allowed.Custom image build
For pip3/cpan/compiled dependencies, users extend the published image:
Test plan
.debmount → unchanged behaviour/usr/lib/nagios/plugins/custom/my-script.shcustom-deps.jsonwith"apt": ["snmp"]→dpkg -l snmpshows installed after startupcustom-deps.jsonwhile container is running → package installs without restartcustom-deps.json→ skipped with warning, valid packages still installed🤖 Generated with Claude Code