A lightweight, Docker-based Bash script that provides a quick health snapshot of a Linux system. Built as a DevOps learning project and designed for observability, monitoring, and infrastructure diagnostics. More about this project roadmap can be found here: Roadmap.sh Project Page
- OS and kernel information
- System uptime and load average
- Logged-in users
- Recent failed SSH login attempts
- Real CPU usage calculation
- Accurate memory usage (using
MemAvailable) - Disk usage for root filesystem
- Top CPU- and memory-consuming processes
- Bash
- Alpine Linux
- Docker
- Linux
/procfilesystem - WSL2 (Windows 11 compatible)
server-stats/
├── server-stats.sh
├── Dockerfile
├── .dockerignore
├── .gitignore
├── README.md
└── LICENSE
Tested on:
- Alpine Linux
- Ubuntu 18.04 / 20.04 / 22.04
- Debian 10 / 11 / 12
- RHEL / CentOS 7 / 8 / 9
Clone the repository:
git clone https://github.com/hackhawk-arch/server-stats.gitOr click the link to open it in your browser: Server Stats Repository
Navigate into the project directory:
cd server-statsMake the script executable:
chmod +x server-stats.shRun the script:
./server-stats.shThis script can be run inside a Docker container while still collecting Linux system metrics.
docker build -t server-stats .docker run --rm \
--pid=host \
server-stats
⚠️ Note: Access to host system metrics requires elevated permissions.
When running Docker on Windows 11 using WSL2, mounting /proc or /sys
from the host into the container is not supported.
For WSL2 environments, run the container using:
docker run --rm --pid=host server-statsWhen using WSL2, the reported metrics reflect the Linux (WSL) environment, not the Windows host operating system.
When editing server-stats.sh on Windows, ensure the file uses Unix (LF)
line endings. Windows-style CRLF line endings may cause syntax errors
when running inside Linux containers.
Recommended fix:
dos2unix server-stats.shThe script uses POSIX-compatible conditionals ([ ... ]) instead of
Bash-only syntax ([[ ... ]]) to ensure reliable execution across:
- Alpine Linux
- Minimal containers
- CI/CD runners
- WSL-based environments
This project demonstrates:
- Linux system internals awareness
- Bash scripting best practices
- Docker containerization
- Host vs container isolation understanding
- Cross-platform (Windows + Linux) compatibility
- Observability and monitoring fundamentals
- GitHub Actions CI (ShellCheck + Docker build)
- Docker Compose setup
- Cron-based execution
- Prometheus metrics exporter
- Publish image to Docker Hub