Admin Guide
User management, audit logs, remote commands, and billing management.
This page covers features available only to administrators (Admin role).
User Management
ServerBee supports multiple users with two roles:
| Role | Permissions |
|---|---|
| Admin | Full management: users, server config, alert rules, notifications, audit logs, etc. |
| Member | Read-only: view Dashboard, server details, Ping results |
Managing Users
Go to Settings → Users:
- Create user: Enter username, password, and role
- Edit role: Change a user's role (Admin/Member)
- Delete user: Remove a user account (cannot delete the last Admin)
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/users | GET | List all users |
/api/users | POST | Create a user |
/api/users/{id} | GET | Get user details |
/api/users/{id} | PUT | Update user role |
/api/users/{id} | DELETE | Delete a user |
Audit Logs
ServerBee automatically records audit logs for critical operations, helping administrators track security events.
Recorded Events
- User login (success/failure)
- Password changes
- 2FA enable/disable
- Terminal connect/disconnect
- Capability denial events
Viewing Audit Logs
Go to Settings → Audit Logs:
- Browse all audit records (paginated)
- View user, action type, details, IP address, and timestamp
API Endpoint
GET /api/audit-logs?limit=50&offset=0Returns a paginated audit log list. Each entry contains:
{
"id": 1,
"user_id": "user-uuid",
"action": "login",
"detail": "Login successful",
"ip": "192.168.1.100",
"created_at": "2026-03-14T10:30:00Z"
}Audit logs are retained for 180 days by default (configurable via retention.audit_logs_days).
Remote Commands
Administrators can dispatch commands to online servers and retrieve execution results.
Usage
- Go to Settings → Tasks
- Enter the command to execute
- Select target servers (multi-select supported)
- Click Execute
Execution Flow
- Server creates a Task record
- Sends the command to each target agent via WebSocket
- Agent executes the command, reports stdout/stderr and exit_code
- Results are stored in the
task_resultstable
Limitations
- Command execution timeout: 300 seconds
- Requires
execcapability (CAP_EXEC) on target servers - Servers without CAP_EXEC receive a synthetic result:
exit_code = -2, message: "Capability disabled" - Only Admin role can create tasks
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/tasks | POST | Create and dispatch a command |
/api/tasks/{id} | GET | Get task details |
/api/tasks/{id}/results | GET | Get execution results |
Request body for creating a one-shot task:
{
"command": "uptime",
"server_ids": ["server-id-1", "server-id-2"],
"timeout": 60
}Scheduled Tasks
Scheduled tasks extend remote commands with cron-based execution, retries, and run history.
Creating a Scheduled Task
- Go to Settings → Tasks.
- Switch to the scheduled task section.
- Enter a name, command, cron expression, target servers, timeout, retry count, and retry interval.
- Save the task. Enabled tasks are registered with the server-side scheduler immediately.
Scheduled tasks use the server's scheduler.timezone setting when calculating next_run_at.
Fields
| Field | Description |
|---|---|
name | Display name for the scheduled task |
task_type | Use scheduled for cron tasks; omitted/default is oneshot |
cron_expression | Cron expression parsed by the server scheduler |
command | Shell command sent to each target agent |
server_ids | Target servers |
timeout | Per-attempt command timeout in seconds; default execution timeout is 300 seconds |
retry_count | Number of retry attempts after the first attempt; must be 0-10 |
retry_interval | Seconds to wait between retries; must be at least 1 |
enabled | Disabled tasks are removed from the scheduler and do not run automatically |
Execution Behavior
- Each scheduled trigger creates a
run_idused to group results from all target servers and retry attempts. - ServerBee prevents overlapping runs of the same scheduled task. If the previous run is still active, the new trigger is skipped.
POST /api/tasks/{id}/runstarts a manual run and skips retry logic.- Disabling or deleting a task cancels its active run.
- Results include an
attemptnumber so you can distinguish retries.
Synthetic exit codes:
| Exit code | Meaning |
|---|---|
-2 | CAP_EXEC disabled or blocked by agent-local capability policy |
-3 | Server offline or dispatch failed |
-4 | No agent response before timeout |
API Example
{
"task_type": "scheduled",
"name": "Daily disk check",
"command": "df -h",
"server_ids": ["server-id-1"],
"cron_expression": "0 0 8 * * *",
"timeout": 120,
"retry_count": 2,
"retry_interval": 60
}Relevant endpoints:
| Endpoint | Method | Description |
|---|---|---|
/api/tasks?type=scheduled | GET | List scheduled tasks |
/api/tasks | POST | Create one-shot or scheduled task |
/api/tasks/{id} | PUT | Update task fields, enable/disable, and scheduler registration |
/api/tasks/{id} | DELETE | Delete a task and cancel active execution |
/api/tasks/{id}/run | POST | Manually run a task |
/api/tasks/{id}/results | GET | Fetch task results grouped by task/run/attempt |
Billing Information
Administrators can record billing details for each server to track VPS costs and expiration dates.
Managing Billing Info
- Go to server detail page → click Edit
- Fill in the "Billing" section:
| Field | Description |
|---|---|
price | Price amount |
billing_cycle | Billing cycle (monthly/quarterly/yearly, etc.) |
currency | Currency unit (CNY/USD, etc.) |
expired_at | Expiration date |
traffic_limit | Traffic limit in bytes |
Expiration Alerts
Create an expiration alert rule to receive notifications before a server expires:
- Go to Settings → Alerts
- Create a new rule with metric type expiration
- Set the threshold to the number of days before expiration (e.g., 7 for 7-day advance notice)
- Link a notification group
Traffic Alerts
Use transfer_in_cycle / transfer_out_cycle / transfer_all_cycle alert types to monitor cumulative traffic within the current billing cycle. See Alerts for details.
Cost Insights
Once price and billing_cycle are filled in, ServerBee derives cost-aware signals from the recorded billing inputs and the agent's reported resources, utilization, and uptime. Insights are surfaced in three places:
- Servers list cost cell -- The
/serverstable shows the monthly-equivalent cost and a value grade chip per server, so cost lives next to CPU/memory/disk/traffic instead of being hidden in the edit dialog - Dashboard server card -- Each server card shows a compact cost signal with a footnote summarizing burn rate and value grade. The signal is hidden when cost config is missing or invalid
- Per-server cost insights panel -- The server detail page renders the full breakdown: monthly-equivalent cost, billing-cycle elapsed/remaining cost and burn percent, days remaining, normalized resource unit costs (per CPU core, per GB memory, per GB disk, per TB traffic limit), and the value score with reasons and confidence
Value Score
Each configured server gets a numeric score (0-100) and a grade:
| Grade | Score range | Meaning |
|---|---|---|
excellent | ≥ 90 | Strong value for the resources you are paying for |
good | ≥ 75 | Solid value with minor inefficiencies |
okay | ≥ 60 | Reasonable but with room to optimize |
poor | ≥ 40 | Likely overpaying for what you actually use |
waste | < 40 | Significant idle burn or expensive per-resource pricing |
The score combines three components: per-resource unit cost percentile against peers in the same currency, utilization (idle CPU/memory and missing network/disk-IO activity contribute to idle_burn / sleeping_money), and reliability over the last 30 days (uptime ratio drives healthy_uptime / low_uptime). A confidence field (high / medium / low) reflects how much data was available, and the panel surfaces qualitative reasons such as expensive_cpu, good_memory_value, expired_billing, free_or_zero_price, or insufficient_data.
Validation
The cost insights API rejects bad billing inputs before scoring. Invalid configurations are returned with an invalid_reason of missing_price, missing_billing_cycle, invalid_billing_cycle, or invalid_price. The UI labels these rows as "invalid card cost config" rather than silently scoring zero.
API
For automation, the same data is exposed read-only at GET /api/cost/overview (fleet-wide currency totals + per-server summaries) and GET /api/servers/{id}/cost-insights (full per-server breakdown). See the API Reference for authentication details.
Agent Registration Management
Admins can manage first-time agent onboarding directly from the UI:
Discovery Key
Go to Settings to show, copy, or regenerate the auto-discovery key. Regenerating the key invalidates the previous key for future registrations, but already connected agents keep working because they use their own stored tokens.
Clean Up Unconnected Placeholders
When failed onboarding leaves behind offline New Server placeholders, the Servers page shows a Clean up unconnected action. It removes only never-initialized offline placeholders and deliberately keeps online-but-uninitialized agents.