Skip to content

Add modern Windows CIM and PDH monitoring support - #49

Merged
TheWitness merged 9 commits into
developfrom
fix/powershell-wmi-timeout
Nov 11, 2026
Merged

TheWitness merged 9 commits into
developfrom
fix/powershell-wmi-timeout

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Adds per-account WinRM configuration, CIM-based WMI collection, and native PDH counter collection for Windows hosts. It also bounds collector runtime and output, preserves cached data on failures, clears stale values after successful empty results, and records poll health.

Related to #15.

Verification: 218 tests passed; 79 database/coverage-dependent cases skipped locally. Changed-line coverage is 100% (142/142), and PHP syntax and diff checks pass. Live Windows/WinRM and database-backed E2E checks remain for CI.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
A successful fetch with a header and no rows now clears stale cache
rows. Keep transport failures as cache-preserving errors.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…match

'timed? ?out' already matches 'timeout' because both the d and the
space are optional, so the separate 'timeout' branch never changed the
result.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The wmic and PowerShell transports carried identical copies of the
non-blocking stdout/stderr loop that enforces the timeout and the
response size limit. Move it into wmi_drain_process() so both apply the
same limits from one place; each transport keeps its own output
normalisation and error text.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Every Linux_WMI caller set counter_mode from the same 'namespace is
PDH' check right after setting querynspace. Derive it when the request
is built instead, so the four entry points cannot drift apart, and
cover the derivation through Linux_WMI.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The five checks that a malformed request never reaches PowerShell
differed only in their request fields and the expected error.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The five health columns share descending sort and differ only in label
and alignment, so list just those and append them to the existing
header definition.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…eader

Only stdout and stderr are read, and stderr has its own branch, so the
remaining branch always handles stdout. PHPStan level 6 reported the
$key === 1 test as always true.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the fix/powershell-wmi-timeout branch from 549d46a to 2738344 Compare November 11, 2026 22:59
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit ad242fd into develop Nov 11, 2026
7 checks passed
@TheWitness
TheWitness deleted the fix/powershell-wmi-timeout branch November 11, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants