Skip to content

cabrata/statsmonit

Repository files navigation

StatsMonit

License: MIT Node.js Platform Support Node.js CI

GitHub Stars GitHub Forks GitHub Issues GitHub Pull Requests

StatsMonit is a lightweight server monitoring tool built with Node.js and Socket.io. It provides real-time system statistics, including CPU usage, RAM usage, disk space, network activity, and uptime.

Demo

Image

Features

  • Real-time Monitoring: Get live updates every 3 seconds.
  • CPU Usage: Shows CPU load percentage and model details.
  • Memory Usage: Displays RAM consumption with detailed usage statistics.
  • Temperature: Displays CPU temperature in real-time
  • Disk Statistics: Provides total, used, and available disk space.
  • Network Traffic: Monitors incoming and outgoing network activity.
  • Cross-platform: Works on Linux, Windows, and macOS.

Installation

Prerequisites

  • Node.js (v18 or higher)
  • NPM (comes with Node.js)
  • g++ (to compile some packages)
  • cmake (to compile some packages)

🐳 Using Docker from GHCR (No Build Required)

You can pull the prebuilt image directly from GitHub Container Registry (GHCR) without building locally.

Pull the Image

docker pull ghcr.io/cabrata/statsmonit:latest

Run the Container

docker run -d \
  --name statsmonit \
  -p 8088:8088 \
  -e PORT=8088 \
  --restart unless-stopped \
  --privileged \
  ghcr.io/cabrata/statsmonit:latest

Then open:

http://localhost:8088

🧩 Using Docker Compose with GHCR

Instead of building locally, use the remote image:

services:
  statsmonit:
    image: ghcr.io/cabrata/statsmonit:latest
    container_name: statsmonit
    restart: unless-stopped
    ports:
      - "8088:8088"
    environment:
      - PORT=8088
    privileged: true

Run:

docker compose pull
docker compose up -d

πŸ–₯ Monitor Host System (Optional)

If you want to monitor the host system instead of the container, add:

    volumes:
      - /:/host:ro,rslave

Steps

  1. Clone this repository:

    git clone https://github.com/cabrata/statsmonit
  2. Navigate into the project folder:

    cd statsmonit
  3. Install dependencies:

    npm install
  4. (Optional) Configure environment variables: Create a .env file and specify the port (default: 8088).

    PORT=8088

Usage

Using Docker (Recommended)

You can easily run StatsMonit using Docker.

  1. Using Docker Compose:

    docker-compose up -d --build
  2. Using Docker CLI:

    docker build -t statsmonit .
    docker run -d -p 8088:8088 --name statsmonit statsmonit

Start the Server (Manual)

Run the following command to start the monitoring service:

npm start

or manually using:

node index.js

Access the Dashboard

Once the server is running, open your browser and visit:

http://localhost:8088

The server will continuously send system statistics to the client using WebSockets (Socket.io).

How It Works

  1. Server Setup

    • Uses Express.js to serve static files.
    • Runs an HTTP server with Socket.io for real-time communication.
  2. Data Collection

    • Uses OS module to fetch CPU, RAM, and system details.
    • Uses diskusage to check disk space.
    • Uses systeminformation to get CPU temperature data
    • Uses node-os-utils to fetch CPU and network statistics.
  3. Real-time Updates

    • The server collects system stats every 3 seconds.
    • Data is sent to connected clients via WebSockets.

πŸ— Build Tailwind CSS

If you are using Tailwind CSS for styling, you can compile the CSS using:

npm run build

This will generate a minified CSS file for production.

🀝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you find any improvements or bugs.

πŸ“œ License

This project is licensed under the MIT License.

Releases

No releases published

Packages

 
 
 

Contributors