Skip to content

bluewave-labs/capture

Repository files navigation

Capture: Checkmate agent

Capture is a set of tools running on the server and providing information about underlying hardware to the Checkmate server.

API Responses

Endpoint Method Description
/health GET Returns 200 OK
/metrics GET Returns the all system metrics(cpu,memory,disk,host)
/metrics/cpu GET Returns the system cpu metrics
/metrics/memory GET Returns the system memory metrics
/metrics/disk GET Returns the system disk metrics
/metrics/host GET Returns the system host informations
/ws/metrics GET Returns the all system metrics(cpu,memory,disk,host) in every n seconds (n=2)

CPU Response

{
    "physical_core":     integer, // Physical cores
    "logical_core":      integer, // Logical cores aka Threads
    "frequency":         integer, // Frequency in mHz
    "current_frequency": integer, // Current Frequency in mHz
    "temperature":       float,   // Temperature in Celsius     
    "free_percent":      float,   // Free percentage           //* 1- Usage
    "usage_percent":     float    // Usage percentage          //* Total - Idle / Total
}

Memory Response

{
    "total_bytes":     integer, // Total space in bytes
    "available_bytes": integer, // Available space in bytes
    "used_bytes":      integer, // Used space in bytes      //* Total - Free - Buffers - Cached
    "usage_percent":   float    // Usage Percent            //* (Used / Total) * 100.0
}

Disk Response

[
    {
        "read_speed_bytes":  integer, // WIP
        "write_speed_bytes": integer, // WIP
        "total_bytes":       integer, // Total space of "/" in bytes
        "free_bytes":        integer, // Free space of "/" in bytes
        "usage_percent":     float    // Usage Percent of "/"
    }
]

Host Response

{
    "os":             string, // linux, darwin, windows
    "platform":       string, // arch, debian, suse...
    "kernel_version": string, // 6.10.10, 6.0.0, 6.10.0-zen...
}

Availability

CPU GNU/Linux Windows MacOS
Physical Core Count - -
Logical Core Count - -
Frequency - -
Current Frequency - -
Temperature - -
Free Percent - -
Usage Percent - -
Memory GNU/Linux Windows MacOS
Total Bytes - -
Available Bytes - -
Used Bytes - -
Usage Percent - -
Disk GNU/Linux Windows MacOS
Read Speed Bytes - - -
Write Speed Byres - - -
Total Bytes - -
Free Bytes - -
Usage Percent - -
Host GNU/Linux Windows MacOS
OS - -
Platform - -
Kernel Version - -

Requirements

Set Up Guide

  1. Git Clone

    git clone REPO_LINK
  2. Change your directory

    cd capture
  3. Install dependencies

    go mod download
  4. Build the project

    just build

    or

    go build -o capture ./cmd/capture/
  5. Run the project

    ./capture

    or

    go run ./cmd/capture/
  6. Environment Variables

    If you want to change the port or the API secret, you can use these environment variables:

    PORT = your_port
    API_SECRET = your_secret
    GIN_MODE = release/debug

    Usage:

    # API_SECRET is required
    PORT=8080 API_SECRET=your_secret GIN_MODE=release ./capture
    
    # Minimal required configuration
    API_SECRET=your_secret ./capture