Windows service that samples CPU, RAM, and fixed drive usage every second, captures per-process CPU/RAM, keeps one week of local history, and pushes batches to a REST collector.
dotnet build SystemMonitorService/SystemMonitorService.csproj
Example using sc.exe (run from an elevated prompt):
sc.exe create SystemMonitorService binPath= "C:\Projects\SystemMonitor\SystemMonitorService\bin\Release\net10.0-windows\SystemMonitorService.exe" start= auto obj= LocalSystem
sc.exe start SystemMonitorService
The service is expected to run under an elevated account (for example, LocalSystem) to access full process metrics.
Edit SystemMonitorService/appsettings.json:
MonitorSettings:CollectorEndpoint- REST endpoint used for pushing metrics.MonitorSettings:DatabasePath- SQLite path. Leave empty to useC:\ProgramData\SystemMonitorService\monitor.db.MonitorSettings:PushBatchSize- batch size sent per request.MonitorSettings:PushIntervalSeconds- interval between push attempts.MonitorSettings:RetryDelaySeconds- minimum delay before retrying failed pushes.MonitorSettings:RetentionDays- days to keep local records.
Endpoint:
POST /api/v1/metrics
Content-Type: application/json
Request body is an array of samples:
[
{
"machineName": "HOST01",
"machine": {
"timestampUtc": "2026-01-10T22:10:00Z",
"cpuPercent": 23.4,
"ramUsedBytes": 7340032000,
"ramTotalBytes": 17179869184
},
"drives": [
{
"name": "C:\\",
"totalBytes": 511705088000,
"usedBytes": 348966092800
}
],
"processes": [
{
"processId": 1234,
"processName": "chrome",
"cpuPercent": 5.2,
"ramBytes": 524288000
}
]
}
]Success response: any 2xx status. Non-2xx response or network failure causes the batch to be retried no sooner than one minute later.
Windows service that receives SystemMonitorService payloads, stores them in PostgreSQL, and hosts a web UI for fleet history.
dotnet build SystemCollectorService/SystemCollectorService.csproj
Example using sc.exe (run from an elevated prompt):
sc.exe create SystemCollectorService binPath= "C:\Projects\SystemMonitor\SystemCollectorService\bin\Release\net10.0-windows\SystemCollectorService.exe" start= auto obj= LocalSystem
sc.exe start SystemCollectorService
Edit SystemCollectorService/appsettings.json:
CollectorSettings:ConnectionString- PostgreSQL connection string. The service creates the database and schema if missing.CollectorSettings:ListenUrl- HTTP listen address (defaulthttp://0.0.0.0:5100).
POST /api/v1/metricsaccepts the JSON array produced bySystemMonitorService.GET /api/v1/machineslists registered computers.GET /api/v1/machines/{machineName}/currentreturns the latest sample.GET /api/v1/machines/{machineName}/history?days=7returns seven days of history.
Browse to http://<collector-host>:5100/ and choose a machine to view current CPU/RAM/HDD usage and charts for the last 7 days.