first commit

This commit is contained in:
MCHost
2025-07-03 05:51:59 -04:00
commit 257406e32c
6 changed files with 835 additions and 0 deletions

95
README.md Normal file
View File

@ -0,0 +1,95 @@
# My-MC.Link Status
A real-time server monitoring application for Docker containers and system metrics, integrated with Netdata and Holesail process tracking. This project provides a web-based dashboard to monitor Docker container performance (CPU, memory, network) and host system metrics (CPU, RAM, network, disk I/O).
## Features
- **Docker Monitoring**: Tracks running containers, CPU usage, memory usage, and network traffic for containers prefixed with `/mc_`.
- **System Metrics**: Displays host CPU, RAM, network, and disk I/O metrics via Netdata integration.
- **Holesail Process Tracking**: Monitors the number of active Holesail processes.
- **Real-Time Updates**: Uses WebSocket to push updates every second to the frontend.
- **Interactive Charts**: Visualizes data with Chart.js for Docker network traffic and system metrics.
- **Responsive UI**: Styled with a Minecraft-themed design, including particle effects and gradient text.
## Prerequisites
- **Node.js**: Version 18 or higher.
- **Docker**: Installed and running with access to the Docker socket.
- **Netdata**: Installed and accessible via a URL specified in the environment variables.
- **Holesail**: Required for process tracking (optional, depending on usage).
## Installation
1. **Clone the Repository**:
```bash
git clone <repository-url>
cd my-mc-stats-website
```
2. **Install Dependencies**:
```bash
npm install
```
3. **Set Up Environment Variables**:
Create a `.env` file in the project root and configure the following:
```env
DOCKER_SOCKET_PATH=/var/run/docker.sock
NETDATA_URL=http://<your-netdata-host>:19999/api/v1
TOTAL_CORES=<number-of-cpu-cores>
PORT=3000
```
4. **Run the Application**:
- For production:
```bash
npm start
```
- For development (with hot reloading):
```bash
npm run dev
```
5. **Access the Dashboard**:
Open your browser and navigate to `http://localhost:3000` (or the port specified in `.env`).
## Project Structure
- **`system-status.js`**: The main server-side script that:
- Sets up an Express server and WebSocket connection.
- Fetches Docker container stats using `dockerode`.
- Retrieves Netdata metrics via HTTP requests.
- Tracks Holesail process counts.
- Sends real-time updates to clients via WebSocket.
- **`status.html`**: The frontend dashboard that:
- Displays Docker and system metrics in tables and charts.
- Uses Chart.js for data visualization.
- Connects to the WebSocket server for real-time updates.
- Includes Minecraft-themed styling and particle effects.
- **`package.json`**: Defines project metadata, scripts, and dependencies.
## Usage
- **Dashboard Overview**:
- **Docker Environment**: Shows total/running containers, CPU/memory usage, Holesail processes, disk usage, and AI fault counts.
- **Container Tables**: Lists Minecraft containers sorted by CPU and memory usage.
- **Host System Metrics**: Displays CPU, RAM, network, and disk I/O charts.
- **Monitoring**:
- Data updates every second via WebSocket.
- Network and disk metrics are smoothed for better visualization.
- Dynamic unit scaling (B/s, KB/s, MB/s, GB/s) for network and disk charts.
## Dependencies
- **axios**: For making HTTP requests to Netdata.
- **dockerode**: For interacting with the Docker API.
- **dotenv**: For loading environment variables.
- **express**: For the web server.
- **ws**: For WebSocket communication.
- **nodemon** (dev): For hot reloading during development.
## Acknowledgments
- Powered by [Holesail](https://holesail.io).
- Services donated by [SNXRaven](https://raven-scott.fyi).
- Built with [Chart.js](https://www.chartjs.org) and [Netdata](https://www.netdata.cloud).