Windows – Is it possible to configure Windows “resource exhaustion detector” to detect and log high cpu events, rather than just low memory events

cpu-usagewindows

Is it possible to configure Windows "resource exhaustion detector" feature to detect and log high cpu events, rather than just low memory events?

As some may know, if Windows detects a low memory condition, the "resource exhaustion detector" mechanism will detect that and report it in the Windows Event Logs (System), as eventid 2004, and with a source of "resource-exhaustion-detector".

Sadly, it seems only to fire on a low memory condition. I would love it to fire also on an extended high CPU condition. But I have not found any resources to suggest it's possible. Does anyone know?

Motivation:

If you may wonder why I seek this, something nice (and simple) about that event log line is it lists what processes are using the most memory at the moment of that alert, as in:

"Windows successfully diagnosed a low virtual memory condition. The
following programs consumed the most virtual memory
: bob.exe (9412)
consumed 1253019648 bytes, jane.exe (4828) consumed 430903296 bytes,
and bill.exe (2228) consumed 395128832 bytes."
[Emphasis is mine, and the process "names have been change to protect
the innocent", as the old Dragnet TV show used to say.
]

I would love is to get a similar list of offending processes when the system is experiencing high and prolonged excessive CPU use.

Given the generic name of "resource exhaustion detector" (and not just "low memory detector"), I was hopeful I may find something on this, but so far my google fu is failing me.

I've also not found anything discussing how that memory limit is set (at what size, and for what duration). That would be interesting to know as well, if anyone may find more on configuring this detector.

(As for the secondary intent here, of knowing when CPU is high and knowing what processes are the cause, I will say that Perfmon and its data collector sets do NOT seem the solution. Those require that you identify the specific process(es) to watch. I am seeking with this something that fires even if I may not think to have some tool watching some particular process.)

Best Answer

The answer fits to any monitoring system, like a PRTG (free up to 100 sensors) or Centreon (opensource). You add an server to monitoring, a sensor for server (mean that CPU sensor) and specify values that will trigger alerting.

The other way round is to use existing windows tools. S

  1. write something in powershell
  2. use Perfmon utility (it is a part of windows). Choose new performance counter alert , then specify counter and on "Alert Task" specify what to trigger. Adding an event to eventlog, for instance

sample in perfmon