Windows troubleshooting: debugging the ps section and collecting resource consumption
This article describes how to debug the Windows ps section and collect system data.
LAST TESTED ON CHECKMK 2.4.0P10
Table of Contents
This article explains how to debug the Windows ps section in the Checkmk agent and how to gather system information for troubleshooting.
Debugging the Windows ps section
The Windows ps section is responsible for process data collection in the Checkmk agent.
If you need to debug it, the full script is available on GitHub
agents/wnx/src/engine/providers/ps.cpp
Example queries
List all running processes:
Get-WmiObject -Query "SELECT * from Win32_Process"
Measure execution time while retrieving process owners:
Measure-Command {
Get-WmiObject -Query "SELECT * from Win32_Process" |
ForEach-Object { $_.GetOwner().User }
}
Collecting system data with PowerShell
Alongside debugging, you can export system snapshots to CSV files for further analysis.
Running processes
Get-CimInstance -ClassName Win32_Process |
Select-Object -Property * |
Export-Csv -Path C:\all_process.csv -NoTypeInformation
Hardware information
Get-CimInstance -ClassName Win32_ComputerSystem |
Select-Object -Property * |
Export-Csv -Path C:\hardware_info.csv -NoTypeInformation
OS information
Get-CimInstance -ClassName Win32_OperatingSystem |
Select-Object -Property * |
Export-Csv -Path C:\OS_info.csv -NoTypeInformation