Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Dockerfile_fedora-43
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

Copy link
Copy Markdown
Owner

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

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\

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't supervisord be listening too? do we need netcat?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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"]
78 changes: 78 additions & 0 deletions README_Dockerfile_fedora-43.md
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
Loading