Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BDSM Server Protocol Draft #10

Closed
0x4c756e61 opened this issue Jan 28, 2024 · 2 comments
Closed

BDSM Server Protocol Draft #10

0x4c756e61 opened this issue Jan 28, 2024 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@0x4c756e61
Copy link
Owner

0x4c756e61 commented Jan 28, 2024

This protocol defines the communication mechanism between a client and server for monitoring system information. The server runs on a specified port and is protected by a password. The client sends a GET request to the server's /api endpoint, providing the password as an authentication header. The expected response is a JSON object containing various system metrics.

Server Configuration

  • Port Configuration: The server runs on port 3040 by default, but it can be configured using the PORT environment variable.

  • Password Protection: The server is protected by a password, and the password is set using the PASSWORD environment variable.

API Endpoint

  • Endpoint: /api
  • Method: GET
  • Authentication: Password provided in the Authorization header.

Expected Response

The server responds with a JSON object containing the following system metrics:

Response Fields

Response Fields

  • software

    • version: String representing the server software version.
  • server

    • id: String identifying the server.

    • uptime: Integer representing the server uptime in seconds.

    • hostname: String representing the server hostname.

    • cpu

      • usage: Integer representing the CPU usage percentage.
      • arch: String representing the CPU architecture.
      • model: String representing the CPU model.
    • ram

      • percent: Integer representing the percentage of RAM used.
      • free: Integer representing available RAM in kilobytes.
      • max: Integer representing the maximum amount of RAM in kilobytes.
    • os

      • type: String representing the operating system type.
      • platform: String representing the operating system platform.
      • version: String representing the operating system version.
      • release: String representing the operating system release version.

Example Usage

Request

GET http://<server-ip>:<server-port>/api
Authorization: Bearer <password>

Response

{
    "software": {
      "version": "1.0.1",
    },
    "server": {
      "id": "Home PI",
      "uptime": 1456,
      "hostname": "Raspberry-PI",
      "cpu": {
        "usage": 12,
        "arch": "aarch64",
        "model": "Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz",
      },
      "ram": {
        "percent": 8,
        "free": 2048000,
        "max": 2560000,
      },
      "os": {
        "type": "Linux",
        "platform": "Linux",
        "version": "#1 SMP Sat, 27 Jan 2024 11:57:00 +0000 x86_64 GNU/Linux",
        "release": "6.6.14-1-clear"
    }
  }
}
@0x4c756e61 0x4c756e61 added the documentation Improvements or additions to documentation label Jan 28, 2024
@0x4c756e61 0x4c756e61 self-assigned this Jan 28, 2024
@0x4c756e61 0x4c756e61 moved this to In progress in BDSM Server ZIG Jan 28, 2024
@0x4c756e61 0x4c756e61 pinned this issue Jan 28, 2024
@0x4c756e61
Copy link
Owner Author

The response field was updated to organize the information into more specific categories, such as software, server, cpu, ram, and os, providing a clearer representation of the server's response

@0x4c756e61 0x4c756e61 moved this from In progress to Done in BDSM Server ZIG Jan 28, 2024
@0x4c756e61
Copy link
Owner Author

The protocol draft has been reviewed and accepted, as such client and server implementations will have to follow the new protocol specification. If further discussion is needed, this issue will be reopened.

Closing as done for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Done
Development

No branches or pull requests

1 participant