-
Notifications
You must be signed in to change notification settings - Fork 31
Add Fedora 43 test container with supervisord-managed Check_MK agent #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| FROM fedora:43 | ||
|
|
||
| LABEL maintainer="henri@nagstamon.de" | ||
| LABEL description="Fedora 43 with Check_MK agent running via supervisord on port 6556" | ||
|
|
||
| # Install required packages (no xinetd as per requirements) | ||
| RUN dnf -y update && \ | ||
| dnf -y install \ | ||
| supervisor \ | ||
| nmap-ncat \ | ||
| && \ | ||
| dnf clean all | ||
|
|
||
| # Copy and install Check_MK agent from repository | ||
| COPY check_mk_agent.linux /usr/bin/check_mk_agent | ||
| RUN chmod +x /usr/bin/check_mk_agent | ||
|
|
||
| # Create a wrapper script to run check_mk_agent as a TCP service on port 6556 | ||
| RUN printf '#!/bin/bash\n\ | ||
| # Run check_mk_agent as a TCP service on port 6556 using netcat\n\ | ||
| while true; do\n\ | ||
| /usr/bin/nc -l -p 6556 -c '\''/usr/bin/check_mk_agent'\'' || sleep 1\n\ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't supervisord be listening too? do we need netcat?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because if we use netcat there will be no need to run supervisor at all? |
||
| done\n' > /usr/local/bin/check_mk_agent_tcp && \ | ||
| chmod +x /usr/local/bin/check_mk_agent_tcp | ||
|
|
||
| # Copy supervisord configuration files | ||
| COPY supervisord-checkmk.conf /etc/supervisord.conf | ||
|
|
||
| # Create log directory for supervisor | ||
| RUN mkdir -p /var/log/supervisor | ||
|
|
||
| # Expose check_mk_agent port | ||
| EXPOSE 6556 | ||
|
|
||
| # Start supervisord | ||
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Dockerfile_fedora-43 | ||
|
|
||
| This Dockerfile creates a Fedora 43 container with Check_MK agent running via supervisord on port 6556 for testing purposes. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Base Image**: Fedora 43 | ||
| - **No xinetd**: Uses supervisord instead of xinetd for process management | ||
| - **Check_MK Agent**: Official Check_MK agent (version 2.3.0) listening on port 6556 | ||
| - **Supervisord**: Manages the check_mk_agent process with automatic restart capability | ||
|
|
||
| ## Files | ||
|
|
||
| - `Dockerfile_fedora-43`: The main Dockerfile | ||
| - `supervisord-checkmk.conf`: Supervisord configuration file | ||
| - `check_mk_agent.linux`: Official Check_MK agent script from CheckMK repository | ||
|
|
||
| ## Building the Image | ||
|
|
||
| ```bash | ||
| docker build -f Dockerfile_fedora-43 -t fedora43-checkmk:latest . | ||
| ``` | ||
|
|
||
| ## Running the Container | ||
|
|
||
| ```bash | ||
| docker run -d --name checkmk-agent -p 6556:6556 fedora43-checkmk:latest | ||
| ``` | ||
|
|
||
| ## Testing the Agent | ||
|
|
||
| You can test the agent by connecting to port 6556: | ||
|
|
||
| ```bash | ||
| echo | nc localhost 6556 | ||
| ``` | ||
|
|
||
| Or using telnet: | ||
|
|
||
| ```bash | ||
| telnet localhost 6556 | ||
| ``` | ||
|
|
||
| ## Managing the Agent | ||
|
|
||
| Check the status of the agent: | ||
|
|
||
| ```bash | ||
| docker exec checkmk-agent supervisorctl status | ||
| ``` | ||
|
|
||
| Restart the agent: | ||
|
|
||
| ```bash | ||
| docker exec checkmk-agent supervisorctl restart check_mk_agent | ||
| ``` | ||
|
|
||
| View logs: | ||
|
|
||
| ```bash | ||
| docker logs checkmk-agent | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| The container uses the following architecture: | ||
|
|
||
| 1. **supervisord** runs as PID 1 and manages all processes | ||
| 2. **check_mk_agent_tcp** wrapper script listens on port 6556 using netcat | ||
| 3. When a connection is made, netcat executes `/usr/bin/check_mk_agent` | ||
| 4. The agent returns system information in Check_MK format | ||
|
|
||
| ## Notes | ||
|
|
||
| - The agent runs as root to access system information | ||
| - Supervisord automatically restarts the agent if it crashes | ||
| - The netcat loop ensures the agent continues listening even if a connection fails | ||
| - No xinetd is installed, making the container more lightweight |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the rpm file supplied in this repo