2.1 KiB
2.1 KiB
Process Monitor
Simple Windows C++ application that checks running processes every 30 seconds and sends one HTTP heartbeat with all matching processes.
What it does
- Enumerates running Windows processes via ToolHelp API
- Finds processes by partial name match
- Sends one JSON payload with all currently matched processes
- Builds with CMake without external runtime dependencies
Expected payload
The application sends HTTP POST with Content-Type: application/json.
{
"machine_name": "PC-01",
"status": "running",
"detected_at": "2026-03-27T12:34:56Z",
"processes": ["notepad.exe", "notepad++.exe"]
}
If api_token is set, request header Authorization: Bearer <token> is added.
If no process matches in a cycle, the application still sends a heartbeat, but without the processes field:
{
"machine_name": "PC-01",
"status": "running",
"detected_at": "2026-03-27T12:34:56Z"
}
Configuration
Edit process-monitor.conf.
api_url=http://10.0.0.147/hb/api
api_token=
machine_name=
interval_seconds=30
request_timeout_seconds=2
process_names=fortnite,chrome,discord,steam
Notes:
machine_nameis optional; if empty, Windows computer name is usedprocess_namesis a comma-separated list of substrings to search in executable namesinterval_secondscan be changed from the default30request_timeout_secondssets WinHTTP connect/send/receive timeout in seconds
Build
Developer Command Prompt for Visual Studio:
cmake -S . -B build
cmake --build build --config Release
Or with Ninja if you have a compiler environment ready:
cmake -S . -B build -G Ninja
cmake --build build
Run
.\build\Release\process-monitor.exe
Or specify custom config path:
.\build\Release\process-monitor.exe .\my-config.conf
Next useful improvements
- Run as Windows service
- Add retry/backoff for failed API calls
- Add richer payload items if your API needs both matched pattern and actual process name
- Load config from JSON/YAML if richer metadata is needed