Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help on determining millicores CPU usage for the "windows_exporter" process itself #1868

Open
paoloyx opened this issue Feb 3, 2025 · 1 comment

Comments

@paoloyx
Copy link

paoloyx commented Feb 3, 2025

Problem Statement

Hi,

I'm wrapping my head around the topic riported in the title....I'm not able which is the best way to get the CPU usage in millicores for the windows-exporter project itself (into a multi-core server).

Set aside that I'm really not able to judge if that is even conceptually correct, I'm currently using the process collector and specifically its windows_process_cpu_time_total, but I'm not sure how to setup a PromQL query.
There are some options (like this comment in #494) but they all refer to percentage and not an absolute millicores value.

Comments in #494 seems to indicate an agreement that the query there reported is the correct one, but how can I transform from "time percentage" to "millicores" usage? Anyone can help?

Thanks a lot :)

Environment

  • windows_exporter Version: 0.29.2
  • Windows Server Version: 2019
@jkroepke
Copy link
Member

jkroepke commented Feb 3, 2025

As I know, the Performance Counter supports 100ns tick rate which meets your requirements.

At the moment, windows_exporter cant expose the values using the process collector.

But the https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.performancecounter.md can be used to fetch the raw values from the Win32 API, without transform it.

You could observe the raw value, using powershell:

(Get-Counter -Counter "\Process(conhost)\% Processor Time").CounterSamples | Format-List -Property *

But the Process collector has some issues which are fixed in Server 2022. Take note of the docs here: https://learn.microsoft.com/en-us/windows/win32/perfctrs/collecting-performance-data#understanding-multiple-processor-counters

windows_exporter does some trick business by fetch values directly from the Registry, if Process Collector is used. But the logic will be not availible to the performance counter collector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants