Could not get Windows Performance Counters since Metricbeats 7.3.0

I use Metricbeats to send Windows Perfomance Counters, like processor time and private bytes to elasticsearch. Until Metricbeats version 7.2.0 it runs well, but the same configuration doesn't run in version 7.3.0 and 7.3.1. If I run "metricbeats.exe test modules", I get an error that the performance counter does not exist. But it exists and the Metricbeats 7.2.0 can access this performance counter.
The error message, that I get from "metricbeats.exe test modules" is: metricbeat.exe test modules
Error getting metricbeat modules: module initialization error: 1 error: initialization of reader failed: failed to expand counter (query="\Process(bbGateService)% Processor Time"): Das angegebene Objekt wurde nicht auf dem Computer gefunden.

The content of the windows.yml file:

- module: windows
  metricsets: ["perfmon"]
  period: 1s
    - instance_label: "ECM_Gate2"
      instance_name: "gate2"
      measurement_label: "ecm.gate2.gateservice.cpu"
      query: '\Process(bbGateService)\% Processor Time'
      format: "float"
# Memory
    - instance_label: "ECM_Gate2"
      instance_name: "gate2"
      measurement_label: "ecm.gate2.gateservice.memory"
      query: '\Process(bbGateService)\Private Bytes'
      format: "float"

hi @jbeyer ,

The configuration in your windows.yml file seems to be correct. Can you provide us with more details on the operating system version, processor type in order to test this scenario out?
Also, it is strange that the query value in the error is missing a backslash \ before the percent sign. Might not be related.
: initialization of reader failed: failed to expand counter (query="\Process(bbGateService)% Processor Time")

The missing Bakslash was eliminated from the website, in original the error message includes the Bakslash before the % sign.
Here are the details of the machine: It is a bare metal machine with Windows Server 2016 (Version 1607 (Build 14393.3181)) with 2x Intel Xeon CPU E5-2620 2.00 GHz and 32 GB RAM.
On another machine with the same OS- version and 2x Intel Xeon CPU E5-2620 v2 2.10 GHz + 64 GB RAM, there is the same result.

The problem are existing also in Metricbeat version 7.3.2.

hi @jbeyer, I am not able to reproduce this issue with the os version provided and a random process running on the machine.
The error message (in german above) seems to be resulted from the AddCounter function which is not able to find the object on the computer("Unable to find the specified object on the computer or in the log file.")
Can you check the following

  1. Running Get-Counter -Counter "\Process(bbGateService)% Processor Time" from Powershell returns any values
  2. Using another process currently running on the machine in the config file returns any values or the same error message is returned.

You mention using an earlier version of metricbeat you are able to get results, are there any differences when setting up the 2 different versions? (using same user, are they both installed as service?)

1 Like

Hi MarianaD, sorry I forgot to tell you, that I use a German version of Windows Server 2016. May be it is a problem with the localised names of the default perfomance counters.
If I run the powershell command: Get-Counter -Counter "\Process(bbGateService)% Processor Time" than it tells me "object not found". (allthough Metricbeats 7.2 find this performance counter)
If I run the powershell with the localised object: Get-Counter -Counter "\Prozess(bbGateService)\Prozessorzeit (%)", than the object is found (for powershell).

Timestamp CounterSamples

26.09.2019 11:23:56 \dev2\prozess(bbgateservice)\prozessorzeit (%) :

Neither the english nor the localised (German) version does run in Metricbeat 7.3.0 and 7.3.2.

query: '\Prozess(bbGateService)\Prozessorzeit (%)'

Own performance counters from our app (that are not localised), like

query: '\ElsbethCommunicationManager:Gate(gate1)\ChangeListeningDurationAvg'

have no problem.
The problem occours on all performance counters with "% Processor Time" and "Private Bytes", that I use.

Only the Version 7.2 is installed as service, version 7.3 does not run :unamused:.
I made a copy of the folder from Metricbeats 7.2.0 (what actual runs) and copied the config files from 7.3.2 to this folder, so I have the exact same configursation on both versions and than I run on command line: metricbeat.exe test modules for both versions.
For version 7.2.0 I get "OK" and for version 7.3.2 I get the Error described above.

The problem still occours in version 7.4.0!!

I face the same issue with windows 10 in german. Just wanted to test metricbeat on it but get for all valid perfcounter the following error:

Exiting: 1 error: initialization of reader failed: failed to add counter (query="\Prozessor(_total)\Prozessorzeit (%)"): Das angegebene Objekt wurde nicht auf dem Computer gefunden.

But Powershell shows, that it's a valid counter:

(Get-Counter -ListSet "Prozessor").Counter

\Prozessor()\Prozessorzeit (%)
)\Benutzerzeit (%)
\Prozessor()\Privilegierte Zeit (%)
\Prozessor()\DPC-Zeit (%)
)\Interruptzeit (%)
\Prozessor()\DPCs in Warteschlange/s
\Prozessor()\Leerlaufzeit (%)
)% C1-Zeit
\Prozessor()% C2-Zeit
)% C3-Zeit

Get-Counter -Counter "\Prozessor(*)\Prozessorzeit (%)"

Timestamp CounterSamples

12.10.2019 20:35:53 \mycomputer\prozessor(_total)\prozessorzeit (%) :

The problem still occours in version 7.4.1!!