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
Step 1: Install the Monitoring Service
Install the BPT Server Monitor service on each server you want to monitor. The service collects system metrics using platform-native APIs.
Need the installer? Grab it from the Download page.
Install the Service
Download and run the MSI installer. The service registers as a Windows service and starts automatically on boot.
Configure the Hub Connection
Open the configuration file and set your Blazor host URL:
C:\Program Files\BptServerMonitor\appsettings.json{
"ServerMonitor": {
"HubUrl": "https://your-blazor-host/bpt-servermonitorhub",
"ServerId": "my-windows-server",
"IntervalMs": 2000
}
}Verify It's Running
The service starts automatically after installation. Check Windows Services
(services.msc) for BPT Server Monitor to confirm it's running.
Stop the service from an elevated PowerShell or Command Prompt:
net stop BptServerMonitorStep 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