### Start and Run HotHost Server with Docker Source: https://context7.com/devforth/hothost/llms.txt This section provides commands to start the HotHost server using Docker Compose or plain Docker. It includes instructions for creating a data directory and running the container with necessary environment variables and port mappings. The `--restart=always` flag ensures the container restarts automatically. ```bash # Start the server docker-compose up -d # Or using plain Docker mkdir -p /www/hothostdata docker run -d --name=hothost-web \ -v /www/hothostdata:/var/lib/hothost/data/ \ --env HOTHOST_WEB_ADMIN_USERNAME=admin \ --env HOTHOST_WEB_ADMIN_PASSWORD=your_secure_password \ --env HOTHOST_WEB_PUBLIC_VIEW_ENABLED=false \ --restart=always \ --env HOTHOST_WEB_PORT=8007 \ -p 8007:8007 \ devforth/hothost-web ``` -------------------------------- ### Pure Docker Installation for HotHost Web Server Source: https://github.com/devforth/hothost/blob/main/README.md This command installs and runs the HotHost web server as a standalone Docker container. It sets up persistent storage, configures administrative credentials, and maps the web server port. ```bash mkdir -p /www/hothostdata docker run -d --name=hothost-web \ -v /www/hothostdata:/var/lib/hothost/data/ \ --env HOTHOST_WEB_ADMIN_USERNAME=admin \ --env HOTHOST_WEB_ADMIN_PASSWORD=!!!CHANGE_ME!!! \ --env HOTHOST_WEB_PUBLIC_VIEW_ENABLED=false \ --restart=always \ --env HOTHOST_WEB_PORT=8007 \ -p 8007:8007 \ devforth/hothost-web ``` -------------------------------- ### Report Process Data for RAM Analysis via Agent API (Bash) Source: https://context7.com/devforth/hothost/llms.txt This example demonstrates how an agent sends process information, specifically top RAM-consuming processes, to the HotHost server. It uses `curl` to make a POST request to the `/api/process/:secret` endpoint with a JSON payload including system RAM status and a map of process IDs to their command lines. This data aids in historical process analysis. ```bash # POST /api/process/:secret # Send process information for RAM analysis curl -X POST "https://your-hothost-server.com/api/process/YOUR_AGENT_SECRET" \ -H "Content-Type: application/json" \ -d '{ "IS_RESTART": "0", "SYSTEM_FREE_RAM": "4294967296", "SYSTEM_TOTAL_RAM": "8589934592", "SYSTEM_TOTAL_PROCESSES": "125", "PROCESS": { "524288": "/usr/bin/node server.js", "262144": "/usr/sbin/mysqld", "131072": "/usr/bin/python3 app.py", "65536": "nginx: worker process" } }' # Response: "OK" ``` -------------------------------- ### Docker Compose Setup for HotHost Web Server Source: https://github.com/devforth/hothost/blob/main/README.md This snippet shows how to integrate the HotHost web server into an existing Docker Compose stack. It configures essential environment variables for administration and port mapping, along with persistent storage for data. ```yaml version: '3.5' services: hothost-web: image: devforth/hothost-web restart: always environment: - HOTHOST_WEB_ADMIN_USERNAME=admin - HOTHOST_WEB_ADMIN_PASSWORD=!!!CHANGE_ME!!! - HOTHOST_WEB_PORT=8007 - HOTHOST_WEB_PUBLIC_VIEW_ENABLED=false ports: - 8007:8007 volumes: - v-hothost-data:/var/lib/hothost/data/ volumes: v-hothost-data: ``` -------------------------------- ### Report Host System Data via Agent API (Bash) Source: https://context7.com/devforth/hothost/llms.txt This example shows how an agent can report system metrics to the HotHost server using a `curl` command. It sends a POST request to the `/api/data/:secret` endpoint with a JSON payload containing detailed host and system information. The response is expected to be 'OK' upon successful submission. ```bash # POST /api/data/:secret # Send host system data to the HotHost server curl -X POST "https://your-hothost-server.com/api/data/YOUR_AGENT_SECRET" \ -H "Content-Type: application/json" \ -d '{ "HOST_NAME": "production-server-1", "HOST_OS_NAME": "Ubuntu", "HOST_OS_VERSION": "22.04", "HOST_PUBLIC_IP": "203.0.113.50", "HOST_PUBLIC_IP_COUNTRY": "US", "SYSTEM_KERNEL_NAME": "Linux", "SYSTEM_KERNEL_VERSION": "5.15.0-generic", "SYSTEM_ARCHITECTURE": "x86_64", "SYSTEM_CPU_MODEL": "Intel(R) Xeon(R) CPU @ 2.20GHz", "SYSTEM_CPU_LOGICAL_CPU_COUNT": "4", "SYSTEM_TOTAL_RAM": "8589934592", "SYSTEM_FREE_RAM": "4294967296", "SYSTEM_TOTAL_SWAP": "2147483648", "SYSTEM_FREE_SWAP": "2147483648", "DISK_USED": "21474836480", "DISK_AVAIL": "85899345920", "MONITOR_INTERVAL": "60" }' # Response: "OK" ``` -------------------------------- ### GET /api/v2/getProcess/:hostId/:timeStep/ Source: https://context7.com/devforth/hothost/llms.txt Retrieves historical process snapshots for a specific host at a given time offset. ```APIDOC ## GET /api/v2/getProcess/:hostId/:timeStep/ ### Description Fetches a snapshot of running processes and RAM usage for a host at a specific time offset in minutes. ### Method GET ### Endpoint /api/v2/getProcess/:hostId/:timeStep/ ### Parameters #### Path Parameters - **hostId** (string) - Required - The UUID of the host - **timeStep** (number) - Required - Time offset in minutes ### Response #### Success Response (200) - **process** (array) - List of running processes - **totalRamUsage** (string) - Total RAM consumption ``` -------------------------------- ### Nginx Proxy Configuration for HotHost Source: https://github.com/devforth/hothost/blob/main/README.md An example Nginx configuration to proxy HTTPS traffic to the HotHost web server running on localhost:8007. This setup is useful for securing the HotHost interface with SSL certificates and a custom domain. ```nginx server { listen 443; server_name subdomain.yourdomain.com; ssl_certificate wildcard.crt; ssl_certificate_key wildcard.key; charset utf-8; client_max_body_size 75M; gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 8; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_min_length 256; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon; location / { proxy_read_timeout 220s; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://127.0.0.1:8007; } } ``` -------------------------------- ### Deploy HotHost Agent with Docker in Bash Source: https://context7.com/devforth/hothost/llms.txt Provides instructions for deploying the HotHost monitoring agent using Docker. It specifies the necessary volume mounts, environment variables, and restart policy for the container. ```bash # Using Docker agent docker run -d --name=hothost-agent \ -v /proc:/host/proc:ro \ -v /etc/os-release:/host/etc/os-release:ro \ -v /etc/hostname:/host/etc/hostname:ro \ --env HOTHOST_AGENT_SECRET=your_agent_secret \ --env HOTHOST_SERVER_BASE=https://your-hothost-server.com \ --env HOTHOST_MONITOR_INTERVAL=60 \ --restart=always \ devforth/hothost-agent # Or using crontab with curl (minimal setup) # Add to crontab: */1 * * * * /path/to/hothost-agent.sh #!/bin/bash HOTHOST_AGENT_SECRET="your_secret" HOTHOST_SERVER_BASE="https://your-hothost-server.com" ``` -------------------------------- ### Deploy HotHost Server with Docker Compose Source: https://context7.com/devforth/hothost/llms.txt This snippet demonstrates how to deploy the HotHost web server using Docker Compose. It defines the service, image, restart policy, environment variables for configuration, and volume for data persistence. Ensure to replace placeholder passwords with secure ones. ```yaml version: '3.5' services: hothost-web: image: devforth/hothost-web restart: always environment: - HOTHOST_WEB_ADMIN_USERNAME=admin - HOTHOST_WEB_ADMIN_PASSWORD=your_secure_password - HOTHOST_WEB_PORT=8007 - HOTHOST_WEB_PUBLIC_VIEW_ENABLED=false ports: - 8007:8007 volumes: - v-hothost-data:/var/lib/hothost/data/ volumes: v-hothost-data: ``` -------------------------------- ### Settings API Source: https://context7.com/devforth/hothost/llms.txt Configure global monitoring thresholds for disk, RAM, SSL expiration, and alert intervals. ```APIDOC ## GET /api/v2/getSettings ### Description Retrieve the current global settings for monitoring. ### Method GET ### Endpoint /api/v2/getSettings ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., "successful"). - **code** (integer) - The HTTP status code. - **data** (object) - An object containing the global settings. - **ram_threshold** (integer) - The RAM usage percentage threshold for warnings. - **ram_stabilization_lvl** (integer) - The stabilization level for RAM warnings. - **disk_threshold** (integer) - The disk usage percentage threshold for warnings. - **disk_stabilization_lvl** (integer) - The stabilization level for disk warnings. - **host_is_down_confirmations** (integer) - The number of confirmations required to consider a host down. - **http_issue_confirmations** (integer) - The number of confirmations required to consider an HTTP issue. - **days_for_ssl_expire** (integer) - The number of days before SSL certificate expiration to trigger an alert. - **hours_for_next_alert** (integer) - The minimum hours between subsequent alerts. #### Response Example ```json { "status": "successful", "code": 200, "data": { "ram_threshold": 90, "ram_stabilization_lvl": 3, "disk_threshold": 90, "disk_stabilization_lvl": 1, "host_is_down_confirmations": 1, "http_issue_confirmations": 1, "days_for_ssl_expire": 14, "hours_for_next_alert": 12 } } ``` ``` ```APIDOC ## POST /api/v2/edit_settings ### Description Edit the global monitoring settings. *(Specific fields and their types are not detailed in the provided text, but would typically mirror the fields returned by `getSettings`)* ### Method POST ### Endpoint /api/v2/edit_settings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body *(Details not provided in the source text. Expected to contain fields to update global settings.)* ### Response *(Response details not provided in the source text)* ``` -------------------------------- ### Manage Notification Plugins Source: https://context7.com/devforth/hothost/llms.txt Provides endpoints to list, configure, enable, and disable notification plugins for various alert channels like Slack, Telegram, and Email. Each plugin can be configured with specific parameters and event triggers. ```bash # List all available plugins curl -X GET "https://your-hothost-server.com/api/v2/plugins/" \ -b cookies.txt ``` ```bash # Get plugin configuration details curl -X GET "https://your-hothost-server.com/api/v2/plugin/slack-notifications/" \ -b cookies.txt ``` ```bash # Configure and enable a plugin curl -X POST "https://your-hothost-server.com/api/v2/plugin/slack-notifications/" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "params[webhook]": "https://hooks.slack.com/services/T00/B00/XXX", "events[disk_is_almost_full]": "on", "events[host_is_offline]": "on", "events[ram_is_almost_full]": "on", "events[http_host_down]": "on", "events[ssl_is_almost_expire]": "on", "notify": true }' ``` ```bash # Disable a plugin curl -X POST "https://your-hothost-server.com/api/v2/plugin_disable/" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "id": "slack-notifications" }' ``` -------------------------------- ### Manage Per-Host Settings Overrides Source: https://context7.com/devforth/hothost/llms.txt Allows for the retrieval and saving of host-specific threshold overrides that take precedence over global settings. This is useful for fine-tuning monitoring for individual servers. ```bash # Get per-host threshold settings curl -X POST "https://your-hothost-server.com/api/v2/get_host_overrides" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "id": "host-uuid" }' ``` ```bash # Save per-host threshold overrides curl -X POST "https://your-hothost-server.com/api/v2/save_host_overrides" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "id": "host-uuid", "settings": { "ram_threshold": 95, "disk_threshold": 80, "host_is_down_confirmations": 3 } }' ``` -------------------------------- ### POST /api/v2/edit_settings Source: https://context7.com/devforth/hothost/llms.txt Updates the global monitoring thresholds and stabilization levels for the HotHost system. ```APIDOC ## POST /api/v2/edit_settings ### Description Updates global monitoring thresholds and stabilization levels for system alerts. ### Method POST ### Endpoint /api/v2/edit_settings ### Request Body - **disk_threshold** (number) - Required - Percentage threshold for disk usage - **ram_threshold** (number) - Required - Percentage threshold for RAM usage - **host_is_down_confirmations** (number) - Required - Number of checks before confirming host down ### Response #### Success Response (200) - **status** (string) - Success status - **code** (number) - HTTP status code ``` -------------------------------- ### Collect and Report System Metrics via Shell Source: https://context7.com/devforth/hothost/llms.txt This script gathers disk and memory usage statistics from the host system and transmits them to the HotHost server via a POST request. It requires the HOTHOST_SERVER_BASE and HOTHOST_AGENT_SECRET environment variables to be configured. ```bash DISK_USED=$(df / | tail -n 1 | awk '{print $3 * 1024}') DISK_AVAIL=$(df / | tail -n 1 | awk '{print $4 * 1024}') TOTAL_RAM=$(grep MemTotal /proc/meminfo | awk '{print $2 * 1024}') FREE_RAM=$(grep MemAvailable /proc/meminfo | awk '{print $2 * 1024}') HOSTNAME=$(cat /etc/hostname) curl -X POST "$HOTHOST_SERVER_BASE/api/data/$HOTHOST_AGENT_SECRET" \ -H "Content-Type: application/json" \ -d "{ \"HOST_NAME\": \"$HOSTNAME\", \"SYSTEM_TOTAL_RAM\": \"$TOTAL_RAM\", \"SYSTEM_FREE_RAM\": \"$FREE_RAM\", \"DISK_USED\": \"$DISK_USED\", \"DISK_AVAIL\": \"$DISK_AVAIL\", \"MONITOR_INTERVAL\": \"60\" }" ``` -------------------------------- ### Manage Global Settings via cURL Source: https://context7.com/devforth/hothost/llms.txt Retrieves or updates global monitoring thresholds for resources like RAM, disk, and SSL expiration. Changes affect alert triggers across the system. ```bash curl -X GET "https://your-hothost-server.com/api/v2/getSettings" -b cookies.txt curl -X POST "https://your-hothost-server.com/api/v2/edit_settings" ``` -------------------------------- ### POST /api/v2/add_user Source: https://context7.com/devforth/hothost/llms.txt Creates a new administrative user for the HotHost dashboard. ```APIDOC ## POST /api/v2/add_user ### Description Registers a new admin user in the system. ### Method POST ### Endpoint /api/v2/add_user ### Request Body - **user** (object) - Required - Contains username and password ### Response #### Success Response (200) - **status** (string) - Success status ``` -------------------------------- ### Develop Custom Webhook Plugin in JavaScript (ESM) Source: https://context7.com/devforth/hothost/llms.txt Demonstrates the structure for a custom notification plugin using ECMAScript Modules (ESM). It includes hooks for enabling/disabling the plugin, sending messages to a webhook, and handling events. ```javascript // server/src/plugins/custom-webhook.js import hbs from 'handlebars'; export default { id: 'custom-webhook', name: 'Custom Webhook', description: 'Send alerts to custom webhook endpoint', iconUrlOrBase64: "data:image/svg+xml;base64,...", longDescriptionMD: ` ## Setup guide Configure your webhook URL to receive JSON payloads. `, supportedEvents: [ 'disk_is_almost_full', 'disk_usage_recovered', 'host_is_offline', 'host_is_online', 'ram_is_almost_full', 'ram_usage_recovered', 'http_host_down', 'http_host_up', 'ssl_is_almost_expire' ], params: [ { id: "webhookUrl", name: "Webhook URL", required: true, inputType: "url", type: "str" } ], async sendMessage(settings, text) { const { webhookUrl } = settings.params; await fetch(webhookUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ source: 'HotHost', message: text || 'Test notification from HotHost' }) }); }, async onPluginEnabled() { this.hbs = hbs.create(); }, async onPluginDisabled() { // Cleanup if needed }, async handleEvent({ eventType, data, settings }) { const template = this.hbs.compile( settings.params[`${eventType}_message`] || `Event: ${eventType}`, { noEscape: true } ); const text = template(data); await this.sendMessage(settings, text); } }; ``` -------------------------------- ### Manage User Accounts Source: https://context7.com/devforth/hothost/llms.txt Provides API endpoints for managing additional admin users on the HotHost dashboard. This includes listing existing users, creating new users with specified credentials, and deleting users. ```bash # List all users curl -X GET "https://your-hothost-server.com/api/v2/getUsers" \ -b cookies.txt ``` ```bash # Create a new user curl -X POST "https://your-hothost-server.com/api/v2/add_user" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "user": { "username": "operator", "password": "secure_password_123" } }' ``` ```bash # Delete a user curl -X POST "https://your-hothost-server.com/api/v2/remove_user" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "id": "user-uuid" }' ``` -------------------------------- ### Configure HotHost Server Environment Variables Source: https://context7.com/devforth/hothost/llms.txt This snippet lists essential environment variables for configuring the HotHost server and its agents. It covers authentication details, server port, public access settings, JWT secret, agent-specific secrets, server URL, and monitoring intervals. These variables control the behavior and connectivity of the HotHost instance. ```bash # Required environment variables HOTHOST_WEB_ADMIN_USERNAME=admin # Admin login username HOTHOST_WEB_ADMIN_PASSWORD=secure_pass # Admin login password HOTHOST_WEB_PORT=8007 # Server port (default: 8007) HOTHOST_WEB_PUBLIC_VIEW_ENABLED=false # Allow unauthenticated viewing HOTHOST_WEB_JWT_SECRET=optional_secret # JWT secret (auto-generated if not set) # Agent environment variables HOTHOST_AGENT_SECRET= # Secret from HotHost web UI HOTHOST_SERVER_BASE=https://your-domain.com # HotHost server URL HOTHOST_MONITOR_INTERVAL=60 # Polling interval in seconds ``` -------------------------------- ### Configure Slack Notifications in JavaScript Source: https://context7.com/devforth/hothost/llms.txt Defines the structure for the Slack notification plugin, including supported events and customizable message templates. It specifies parameters like the webhook URL and default message formats for various events. ```javascript const slackPlugin = { id: 'slack-notifications', name: 'Slack Notifications', supportedEvents: [ 'disk_is_almost_full', 'disk_usage_recovered', 'host_is_offline', 'host_is_online', 'ram_is_almost_full', 'ram_usage_recovered', 'http_host_down', 'http_host_up', 'ssl_is_almost_expire' ], params: [ { id: "webhook", name: "Slack Web Hook URL", required: true, type: "str" }, { id: "disk_is_almost_full_message", default_value: "⚠️ {{ HOST_NAME }}: Disk is almost full ({{ HOST_PUBLIC_IP }}) \n {{DISK_USED}} / {{DISK_TOTAL}}. Please clean it up", type: "text" } // Additional message templates for each event... ] }; // Message template variables available: // {{ HOST_NAME }} - Hostname // {{ HOST_LABEL }} - Custom label // {{ HOST_PUBLIC_IP }} - Public IP address // {{ DISK_USED }} - Used disk space // {{ DISK_TOTAL }} - Total disk space // {{ RAM_USED }} - Used RAM // {{ RAM_TOTAL }} - Total RAM // {{ EVENT_DURATION }} - Duration of the event // {{ EVENT_REASON }} - Reason for HTTP events // {{ CERT_VALID_UNTIL }} - SSL certificate expiration date ``` -------------------------------- ### Authenticate User and Manage Session via Authentication API (Bash) Source: https://context7.com/devforth/hothost/llms.txt This snippet illustrates how to authenticate users and manage sessions using the HotHost Authentication API. It shows `curl` commands for logging in to obtain a JWT cookie and for logging out to clear the session. The login request includes username and password, and the response contains status and code, setting a `__hhjwt` cookie. ```bash # POST /api/v2/login # Authenticate and receive JWT cookie curl -X POST "https://your-hothost-server.com/api/v2/login" \ -H "Content-Type: application/json" \ -c cookies.txt \ -d '{ "username": "admin", "password": "your_password" }' # Response: # { # "status": "successful", # "code": 200 # } # Sets cookie: __hhjwt (valid for 1 hour) # POST /api/v2/logout # Clear authentication session curl -X POST "https://your-hothost-server.com/api/v2/logout" \ -b cookies.txt # Response: # { # "status": "successful", # "code": 200 # } ``` -------------------------------- ### Retrieve Process History Source: https://context7.com/devforth/hothost/llms.txt Fetches historical process data, specifically RAM consumption, for a given host at a specified time offset. This is useful for analyzing performance trends and identifying memory leaks. ```bash # Get process snapshot at a specific time offset (in minutes) curl -X GET "https://your-hothost-server.com/api/v2/getProcess/host-uuid/30/" \ -b cookies.txt ``` -------------------------------- ### POST /api/v2/save_host_overrides Source: https://context7.com/devforth/hothost/llms.txt Configures host-specific threshold overrides that take precedence over global settings. ```APIDOC ## POST /api/v2/save_host_overrides ### Description Saves per-host threshold overrides to customize monitoring for specific nodes. ### Method POST ### Endpoint /api/v2/save_host_overrides ### Request Body - **id** (string) - Required - Unique host UUID - **settings** (object) - Required - Object containing specific threshold overrides ### Response #### Success Response (200) - **status** (string) - Success status ``` -------------------------------- ### Configure Telegram Notifications in JavaScript Source: https://context7.com/devforth/hothost/llms.txt Sets up the Telegram notification plugin, requiring a bot token and chat ID. It outlines the necessary parameters for connecting to the Telegram API and sending alerts. ```javascript // Telegram plugin setup const telegramPlugin = { id: 'telegram-notifications', name: 'Telegram Notifications', params: [ { id: "botToken", name: "Telegram Token created by BotFather", required: true, type: "str" }, { id: "telegramChatId", name: "Telegram Chat ID", required: true, type: "str" } // Message templates same as Slack... ] }; // Setup steps: // 1. Message @BotFather on Telegram with /newbot // 2. Copy the bot token (e.g., 512345678:AABBCC11DD2233...) // 3. Get your chat ID by messaging @userinfobot // 4. Configure the plugin with both values ``` -------------------------------- ### Host Management API Source: https://context7.com/devforth/hothost/llms.txt Add, remove, and configure monitored hosts with labels and notification settings. ```APIDOC ## POST /api/v2/add_monitor ### Description Create a new host monitor entry. ### Method POST ### Endpoint /api/v2/add_monitor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body *(Details not provided in the source text, but typically includes host identification details)* ### Response #### Success Response (200) Returns the updated monitoring data array, including the newly added host and its secret. *(Specific response structure not detailed)* ``` ```APIDOC ## POST /api/v2/remove_host ### Description Remove a host from monitoring. ### Method POST ### Endpoint /api/v2/remove_host ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (string) - Required - The unique identifier of the host to remove. ### Request Example ```json { "id": "550e8400-e29b-41d4-a716-446655440000" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., "successful"). - **code** (integer) - The HTTP status code. #### Response Example ```json { "status": "successful", "code": 200 } ``` ``` ```APIDOC ## POST /api/v2/add_label ### Description Add a descriptive label to a host. ### Method POST ### Endpoint /api/v2/add_label ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (string) - Required - The unique identifier of the host to label. - **label** (string) - Required - The descriptive label to assign to the host. ### Request Example ```json { "id": "550e8400-e29b-41d4-a716-446655440000", "label": "Production Database Server" } ``` ### Response *(Response details not provided in the source text)* ``` -------------------------------- ### HTTP Monitor API Source: https://context7.com/devforth/hothost/llms.txt Create and manage HTTP/HTTPS endpoint monitors with status code checks, keyword detection, and SSL monitoring. ```APIDOC ## POST /api/v2/add_http_monitor ### Description Create a new HTTP endpoint monitor. This endpoint can be used for various monitoring types including status code checks, keyword detection, and SSL monitoring. ### Method POST ### Endpoint /api/v2/add_http_monitor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **URL** (string) - Required - The URL to monitor. - **monitor_type** (string) - Required - The type of monitoring to perform. Accepted values: "status_code", "keyword_exist", "keyword_not_exist", "rss_parser". - **monitor_interval** (integer) - Required - The interval in seconds between checks. - **enable_auth** (boolean) - Optional - Whether to use basic authentication for the request. Defaults to false. - **key_word** (string) - Optional - The keyword to search for when `monitor_type` is "keyword_exist" or "keyword_not_exist". - **caseInsensitive** (boolean) - Optional - Whether the keyword search should be case-insensitive. Relevant when `key_word` is provided. - **login** (string) - Optional - The username for basic authentication, required if `enable_auth` is true. - **password** (string) - Optional - The password for basic authentication, required if `enable_auth` is true. ### Request Example (Status Code Check) ```json { "URL": "https://api.example.com/health", "monitor_type": "status_code", "monitor_interval": 60, "enable_auth": false } ``` ### Request Example (Keyword Check) ```json { "URL": "https://example.com", "monitor_type": "keyword_exist", "key_word": "Welcome", "caseInsensitive": true, "monitor_interval": 120, "enable_auth": false } ``` ### Request Example (Basic Auth) ```json { "URL": "https://protected.example.com", "monitor_type": "status_code", "monitor_interval": 60, "enable_auth": true, "login": "api_user", "password": "api_password" } ``` ### Response *(Response details not provided in the source text)* ``` ```APIDOC ## GET /api/v2/http-monitor ### Description Retrieve all configured HTTP monitors. ### Method GET ### Endpoint /api/v2/http-monitor ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., "success"). - **code** (integer) - The HTTP status code. - **data** (array) - An array of HTTP monitor objects. - **id** (string) - Unique identifier for the monitor. - **url** (string) - The URL being monitored. - **label** (string) - A descriptive label for the monitor. - **status** (boolean) - The current status of the monitor (true for up, false for down). - **sslWarning** (boolean) - Indicates if there is an SSL certificate warning. - **certificateExpireDate** (string) - The expiration date of the SSL certificate. - **interval** (integer) - The monitoring interval in seconds. #### Response Example ```json { "status": "success", "code": 200, "data": [ { "id": "monitor-uuid", "url": "https://api.example.com/health", "label": "API Health", "status": true, "sslWarning": false, "certificateExpireDate": "2025-12-31", "interval": 60 } ] } ``` ``` ```APIDOC ## POST /api/v2/remove_http_monitor ### Description Remove an HTTP monitor. ### Method POST ### Endpoint /api/v2/remove_http_monitor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (string) - Required - The unique identifier of the HTTP monitor to remove. ### Request Example ```json { "id": "monitor-uuid" } ``` ### Response *(Response details not provided in the source text)* ``` -------------------------------- ### Process Data API Source: https://context7.com/devforth/hothost/llms.txt Report top RAM-consuming processes to enable historical process analysis over the last 48 hours. This endpoint is used to send process information for RAM analysis. ```APIDOC ## POST /api/process/:secret ### Description Send process information for RAM analysis. ### Method POST ### Endpoint /api/process/:secret ### Parameters #### Path Parameters - **secret** (string) - Required - The secret key for agent authentication. #### Request Body - **IS_RESTART** (string) - Required - Indicates if this is a restart (e.g., '0' for no, '1' for yes). - **SYSTEM_FREE_RAM** (string) - Required - Free RAM in bytes. - **SYSTEM_TOTAL_RAM** (string) - Required - Total RAM in bytes. - **SYSTEM_TOTAL_PROCESSES** (string) - Required - Total number of running processes. - **PROCESS** (object) - Required - An object containing process information where keys are PIDs and values are command lines. - **PID** (string) - The process ID. - **COMMAND** (string) - The command line of the process. ### Request Example ```json { "IS_RESTART": "0", "SYSTEM_FREE_RAM": "4294967296", "SYSTEM_TOTAL_RAM": "8589934592", "SYSTEM_TOTAL_PROCESSES": "125", "PROCESS": { "524288": "/usr/bin/node server.js", "262144": "/usr/sbin/mysqld", "131072": "/usr/bin/python3 app.py", "65536": "nginx: worker process" } } ``` ### Response #### Success Response (200) - **Response** (string) - OK ``` -------------------------------- ### Retrieve Monitoring Data via cURL Source: https://context7.com/devforth/hothost/llms.txt Fetches the current status of all monitored hosts, including resource usage and system information. Requires authentication via cookies. ```bash curl -X GET "https://your-hothost-server.com/api/v2/getMonitoringData" -b cookies.txt ``` -------------------------------- ### Updating HotHost Docker Image Source: https://github.com/devforth/hothost/blob/main/README.md Command to pull the latest HotHost Docker image. After pulling, the existing container needs to be recreated to use the updated image. ```bash docker pull devforth/hothost-web:latest ``` -------------------------------- ### Monitoring Data API Source: https://context7.com/devforth/hothost/llms.txt Retrieve current status of all monitored hosts including resource usage, warnings, and system information. ```APIDOC ## GET /api/v2/getMonitoringData ### Description Fetch all host monitoring data. This endpoint requires authentication or public view to be enabled. ### Method GET ### Endpoint /api/v2/getMonitoringData ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) An array of objects, where each object represents the monitoring data for a host. - **id** (string) - Unique identifier for the host. - **icon_name** (string) - Name of the icon representing the host's OS. - **online** (boolean) - Indicates if the host is currently online. - **hostname** (string) - The hostname of the monitored server. - **label** (string) - A descriptive label for the host. - **public_ip** (string) - The public IP address of the host. - **country** (string) - The country where the host is located. - **os_name** (string) - The name of the operating system. - **os_version** (string) - The version of the operating system. - **cpu_name** (string) - The name/model of the CPU. - **cpu_count** (string) - The number of CPU cores. - **ram_total** (string) - Total RAM available on the host. - **ram_used** (string) - Amount of RAM currently in use. - **ram_used_percentage** (string) - Percentage of RAM currently in use. - **ram_warning** (boolean) - Indicates if RAM usage has triggered a warning. - **disk_total** (string) - Total disk space available. - **disk_used** (string) - Amount of disk space currently in use. - **disk_warning** (boolean) - Indicates if disk usage has triggered a warning. - **isSwap** (boolean) - Indicates if swap space is configured. - **swap_total** (string) - Total swap space available. - **swap_used** (string) - Amount of swap space currently in use. #### Response Example ```json [ { "id": "550e8400-e29b-41d4-a716-446655440000", "icon_name": "ubuntu", "online": true, "hostname": "production-server-1", "label": "Main API Server", "public_ip": "203.0.113.50", "country": "US", "os_name": "Ubuntu", "os_version": "22.04", "cpu_name": "Intel(R) Xeon(R) CPU @ 2.20GHz", "cpu_count": "4", "ram_total": "8.00 GiB", "ram_used": "4.00 GiB", "ram_used_percentage": "50", "ram_warning": false, "disk_total": "100.00 GiB", "disk_used": "20", "disk_warning": false, "isSwap": true, "swap_total": "2.00 GiB", "swap_used": "0" } ] ``` ``` -------------------------------- ### Define Monitoring Events and Template Data Source: https://context7.com/devforth/hothost/llms.txt This JavaScript snippet defines the available server and HTTP monitoring event types that trigger notifications. It also outlines the structure of event data objects available for use in alert notification templates. ```javascript // Server monitoring events const serverEvents = { 'disk_is_almost_full': 'Disk usage exceeds threshold', 'disk_usage_recovered': 'Disk usage returned below threshold', 'host_is_offline': 'Host stopped reporting metrics', 'host_is_online': 'Host resumed reporting after being offline', 'ram_is_almost_full': 'RAM usage exceeds threshold', 'ram_usage_recovered': 'RAM usage returned below threshold' }; // HTTP monitoring events const httpEvents = { 'http_host_down': 'HTTP endpoint check failed', 'http_host_up': 'HTTP endpoint recovered', 'ssl_is_almost_expire': 'SSL certificate expiring soon' }; // Event data available in templates const eventData = { HOST_NAME: 'server-hostname', HOST_LABEL: 'Custom label', HOST_PUBLIC_IP: '203.0.113.50', DISK_USED: '20.00 GiB', DISK_TOTAL: '100.00 GiB', RAM_USED: '4.00 GiB', RAM_TOTAL: '8.00 GiB', EVENT_DURATION: '2h 30m', EVENT_REASON: 'Response status code is 500', CERT_VALID_UNTIL: '2025-12-31T00:00:00.000Z' }; ``` -------------------------------- ### Manage HTTP Endpoint Monitors via cURL Source: https://context7.com/devforth/hothost/llms.txt Allows creation, retrieval, and deletion of HTTP/HTTPS monitors. Supports various monitor types like status code checks and keyword detection, with optional basic authentication. ```bash curl -X POST "https://your-hothost-server.com/api/v2/add_http_monitor" -H "Content-Type: application/json" -b cookies.txt -d '{"URL": "https://api.example.com/health", "monitor_type": "status_code", "monitor_interval": 60, "enable_auth": false}' curl -X GET "https://your-hothost-server.com/api/v2/http-monitor" -b cookies.txt curl -X POST "https://your-hothost-server.com/api/v2/remove_http_monitor" -H "Content-Type: application/json" -b cookies.txt -d '{"id": "monitor-uuid"}' ``` -------------------------------- ### Authentication API Source: https://context7.com/devforth/hothost/llms.txt Authenticate users and obtain JWT tokens for accessing protected API endpoints. This API includes endpoints for both login and logout. ```APIDOC ## POST /api/v2/login ### Description Authenticate users and receive a JWT cookie. ### Method POST ### Endpoint /api/v2/login ### Parameters #### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ### Request Example ```json { "username": "admin", "password": "your_password" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the login attempt (e.g., "successful"). - **code** (integer) - The HTTP status code. - **__hhjwt** (cookie) - A cookie containing the JWT token, valid for 1 hour. #### Response Example ```json { "status": "successful", "code": 200 } ``` ## POST /api/v2/logout ### Description Clear the authentication session by logging out the user. ### Method POST ### Endpoint /api/v2/logout ### Response #### Success Response (200) - **status** (string) - Indicates the status of the logout attempt (e.g., "successful"). - **code** (integer) - The HTTP status code. #### Response Example ```json { "status": "successful", "code": 200 } ``` ``` -------------------------------- ### Manage Host Monitors via cURL Source: https://context7.com/devforth/hothost/llms.txt Endpoints for adding, removing, and labeling monitored hosts. These operations require a JSON payload and authenticated cookie sessions. ```bash curl -X POST "https://your-hothost-server.com/api/v2/add_monitor" -H "Content-Type: application/json" -b cookies.txt curl -X POST "https://your-hothost-server.com/api/v2/remove_host" -H "Content-Type: application/json" -b cookies.txt -d '{"id": "550e8400-e29b-41d4-a716-446655440000"}' curl -X POST "https://your-hothost-server.com/api/v2/add_label" -H "Content-Type: application/json" -b cookies.txt -d '{"id": "550e8400-e29b-41d4-a716-446655440000", "label": "Production Database Server"}' ``` -------------------------------- ### Update Global Monitoring Thresholds Source: https://context7.com/devforth/hothost/llms.txt Updates the global monitoring thresholds for disk and RAM usage, as well as confirmation levels for various alerts. This endpoint affects all hosts unless overridden by per-host settings. ```bash curl -X POST "https://your-hothost-server.com/api/v2/edit_settings" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "disk_threshold": 85, "disk_stabilization_lvl": 2, "ram_threshold": 85, "ram_stabilization_lvl": 5, "host_is_down_confirmations": 2, "http_issue_confirmations": 2, "days_for_ssl_expire": 21, "hours_for_next_alert": 6 }' ``` -------------------------------- ### Agent Data API Source: https://context7.com/devforth/hothost/llms.txt The agent reports system metrics to the server via a POST request with comprehensive system information. This endpoint is used to send host system data to the HotHost server. ```APIDOC ## POST /api/data/:secret ### Description Send host system data to the HotHost server. ### Method POST ### Endpoint /api/data/:secret ### Parameters #### Path Parameters - **secret** (string) - Required - The secret key for agent authentication. #### Request Body - **HOST_NAME** (string) - Required - The name of the host being monitored. - **HOST_OS_NAME** (string) - Required - The operating system name of the host. - **HOST_OS_VERSION** (string) - Required - The operating system version of the host. - **HOST_PUBLIC_IP** (string) - Required - The public IP address of the host. - **HOST_PUBLIC_IP_COUNTRY** (string) - Required - The country of the public IP address. - **SYSTEM_KERNEL_NAME** (string) - Required - The kernel name of the system. - **SYSTEM_KERNEL_VERSION** (string) - Required - The kernel version of the system. - **SYSTEM_ARCHITECTURE** (string) - Required - The system architecture. - **SYSTEM_CPU_MODEL** (string) - Required - The CPU model of the system. - **SYSTEM_CPU_LOGICAL_CPU_COUNT** (string) - Required - The number of logical CPU cores. - **SYSTEM_TOTAL_RAM** (string) - Required - Total RAM in bytes. - **SYSTEM_FREE_RAM** (string) - Required - Free RAM in bytes. - **SYSTEM_TOTAL_SWAP** (string) - Required - Total swap space in bytes. - **SYSTEM_FREE_SWAP** (string) - Required - Free swap space in bytes. - **DISK_USED** (string) - Required - Disk space used in bytes. - **DISK_AVAIL** (string) - Required - Disk space available in bytes. - **MONITOR_INTERVAL** (string) - Required - The monitoring interval in seconds. ### Request Example ```json { "HOST_NAME": "production-server-1", "HOST_OS_NAME": "Ubuntu", "HOST_OS_VERSION": "22.04", "HOST_PUBLIC_IP": "203.0.113.50", "HOST_PUBLIC_IP_COUNTRY": "US", "SYSTEM_KERNEL_NAME": "Linux", "SYSTEM_KERNEL_VERSION": "5.15.0-generic", "SYSTEM_ARCHITECTURE": "x86_64", "SYSTEM_CPU_MODEL": "Intel(R) Xeon(R) CPU @ 2.20GHz", "SYSTEM_CPU_LOGICAL_CPU_COUNT": "4", "SYSTEM_TOTAL_RAM": "8589934592", "SYSTEM_FREE_RAM": "4294967296", "SYSTEM_TOTAL_SWAP": "2147483648", "SYSTEM_FREE_SWAP": "2147483648", "DISK_USED": "21474836480", "DISK_AVAIL": "85899345920", "MONITOR_INTERVAL": "60" } ``` ### Response #### Success Response (200) - **Response** (string) - OK ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.