Our monitoring solution currently uses WMI for a few of it's metrics, however when under load WMI performs terribly and often fails to return in time, causing a large number of false alerts of various things being offline or missing metrics.
Replacing WMI queries with calls to windows functions found in psapi.h, sysinfoapi.h and others has resolved a majority of these and return about 100x faster, however I am unable to find a way to get the equivalent value of WMI query Win32_OperatingSystem.MaxNumberOfProcesses
The definition from the windows documentation here states:
MaxNumberOfProcesses
Data type: uint32
Access type: Read-only
Qualifiers: MappingStrings ("MIB.IETF|HOST-RESOURCES-MIB.hrSystemMaxProcesses")
Maximum number of process contexts the operating system can support.
The default value set by the provider is 4294967295 (0xFFFFFFFF). If there is no fixed maximum, the value should be 0 (zero). On systems that have a fixed maximum, this object can help diagnose failures that occur when the maximum is reached—if unknown, enter 4294967295 (0xFFFFFFFF).
This property is inherited from CIM_OperatingSystem.
I've tested this value on about 10 different machines, each with differing numbers of CPU and RAM, all of which have returned the above default value of 4294967295 (0xFFFFFFFF). Am I to assume that Windows is actually just sending back this value directly, or should I be returning the value of ULONG_MAX, or is there another way of finding what this value should be?
I tried figure out a way to access the HOST MIB for windows but can't find any details on it other than using some external tool, not directly via code.
I'm currently programming this in the GO language, utilizing C libraries.
If anyone can provide insight into how to retrieve this value without using WMI that would be greatly appreciated.