Configure Server Monitoring
Set up real-time server metrics in your Blazor dashboard with BptServerMonitor.
Overview
The BptServerMonitor component displays live CPU, GPU, memory, disk, and network metrics from one or more servers. It works with a lightweight monitoring service that runs on each target machine and pushes metrics to your Blazor app via SignalR.
Architecture
┌──────────────────┐ SignalR ┌─────────────────┐
│ Server Monitor │ ───────────────► │ Blazor Server │
│ Service (.exe) │ push metrics │ (your app) │
│ │ │ │
│ Runs on each │ │ BptServerMonitor│
│ target server │ │ component │
└──────────────────┘ └─────────────────┘
▲ │
│ collects │ displays
CPU, GPU, RAM, Real-time charts
disk, network and gaugesStep 1: Install the Monitor Service
Install the BPT Server Monitor service on each server you want to monitor. The service collects system metrics using platform-native APIs.
Windows
Download and run the MSI installer. The service registers as a Windows service and starts automatically.
After installation, configure the hub URL in:
C:\Program Files\BptServerMonitor\appsettings.json{
"ServerMonitor": {
"HubUrl": "https://your-blazor-host/bpt-servermonitorhub",
"ServerId": "my-windows-server",
"IntervalMs": 2000
}
}Linux
Install the .deb package:
sudo dpkg -i bpt-servermonitor_1.0.0_amd64.debConfigure and start:
# Edit configuration
sudo nano /opt/bpt-servermonitor/appsettings.json
# Start the service
sudo systemctl start bpt-servermonitor
# Enable on boot
sudo systemctl enable bpt-servermonitor
# Check status
sudo systemctl status bpt-servermonitorStep 2: Configure the Blazor Server Hub
In your Blazor server's Program.cs, map the SignalR hub that receives metrics:
var builder = WebApplication.CreateBuilder(args);
// Add BPT services (includes the monitor hub)
builder.Services.AddBlazorPowerTools();
var app = builder.Build();
// Map the server monitor hub endpoint
app.MapBlazorPowerToolsHubs();
app.Run();Step 3: Add the Monitor Component
Place BptServerMonitor on your admin dashboard page:
<BptServerMonitor ShowCPUMetrics="true"
ShowGPUMetrics="true"
ShowMemoryMetrics="true"
ShowDiskMetrics="true"
ShowNetworkMetrics="true"
Servers="@servers" />
@code {
private List<BptServerMonitorConfig> servers = new()
{
new() { FriendlyName = "Web Host", Domain = "localhost" },
new() { FriendlyName = "DB Server", Domain = "192.168.1.10" },
new() { FriendlyName = "GPU Node", Domain = "gpu-node.internal" }
};
}Component Parameters
| Parameter | Type | Description |
|---|---|---|
Servers | List<BptServerMonitorConfig> | List of servers to monitor |
ShowCPUMetrics | bool | Show CPU usage, load, and temperature |
ShowGPUMetrics | bool | Show GPU utilization and VRAM |
ShowMemoryMetrics | bool | Show RAM usage and swap |
ShowDiskMetrics | bool | Show disk space and I/O |
ShowNetworkMetrics | bool | Show network throughput |
RefreshInterval | int | UI refresh rate in milliseconds (default: 2000) |
Service Configuration Reference
| Setting | Description | Default |
|---|---|---|
HubUrl | The SignalR hub URL on your Blazor server | (required) |
ServerId | Unique identifier for this server | Machine hostname |
IntervalMs | How often to push metrics (milliseconds) | 2000 |
EnableGpu | Collect GPU metrics (requires NVML on Linux) | true |
EnableDisk | Collect disk I/O metrics | true |
EnableNetwork | Collect network throughput metrics | true |
Firewall & Networking
The monitor service makes outbound HTTPS connections to your Blazor server. Ensure:
- The monitor service can reach the Blazor server's hostname on the configured port (typically 443)
- No firewall rule blocks outbound HTTPS from the monitored server
- If using a reverse proxy (nginx, IIS), ensure WebSocket upgrade headers are forwarded
- For internal networks, consider using an internal DNS name or IP for the HubUrl
curl -I https://your-blazor-host/bpt-servermonitorhub