Skip to content

Latest commit

 

History

History
133 lines (104 loc) · 2.68 KB

README.md

File metadata and controls

133 lines (104 loc) · 2.68 KB

System Monitoring

A lightweight system monitoring tool that tracks CPU, memory, and disk usage across your infrastructure. When resource usage exceeds defined thresholds, it creates incidents in BetterStack.

Features

  • CPU usage monitoring
  • Memory usage monitoring
  • Disk usage monitoring (root and mounted volumes)
  • Automatic incident creation and resolution
  • Configurable thresholds via CLI
  • Docker-based deployment

Command Line Usage

The monitoring tool is configured through command-line flags:

monitoring [flags]

Flags:
  -url string
        BetterStack webhook URL (required)
  -interval int
        Check interval in seconds (default: 300)
  -cpu-limit float
        CPU usage threshold percentage (default: 90)
  -memory-limit float
        Memory usage threshold percentage (default: 90)
  -disk-limit float
        Disk usage threshold percentage (default: 85)
  -help
        Display help information

Examples

# Basic usage with required URL
monitoring --url=https://betterstack.com/webhook/xyz

# Custom thresholds
monitoring --url=https://betterstack.com/webhook/xyz \
          --cpu-limit=95 \
          --memory-limit=85 \
          --disk-limit=80

# More frequent checks (every minute)
monitoring --url=https://betterstack.com/webhook/xyz --interval=60

Docker Deployment

Using Docker Run

docker run -d \
  --name monitoring \
  --privileged \
  --pid=host \
  -v /:/host:ro \
  ghcr.io/appwrite/monitoring:latest \
  monitoring \
  --url=https://betterstack.com/webhook/xyz \
  --interval=300 \
  --cpu-limit=90 \
  --memory-limit=90 \
  --disk-limit=85

Using Docker Compose

The docker-compose.yml file is configured with default parameters that you can modify as needed:

docker-compose up -d

To modify the parameters, edit the command section in docker-compose.yml:

command:
  - monitoring
  - "--url=https://betterstack.com/webhook/xyz"
  - "--interval=10"
  - "--cpu-limit=90"
  - "--memory-limit=80"
  - "--disk-limit=85"

Building from Source

  1. Clone the repository:
git clone https://github.com/appwrite/monitoring.git
cd monitoring
  1. Build the binary:
go build -o monitoring
  1. Run the monitoring tool:
monitoring --url=https://betterstack.com/webhook/xyz

Development

Requirements

  • Go 1.21 or later
  • Docker and Docker Compose (for containerized deployment)

Local Development

  1. Install dependencies:
go mod download
  1. Build and run:
go build -o monitoring
monitoring --url=https://betterstack.com/webhook/xyz

Docker Development

docker compose up -d

License

MIT License - see the LICENSE file for details