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

check-windows-cpu-load: Get-Counter : Internal performance counter API call failed. Error: c0000bb8 #98

Open
MisterDeeds opened this issue Oct 19, 2019 · 9 comments

Comments

@MisterDeeds
Copy link

MisterDeeds commented Oct 19, 2019

Hi

Unfortunately, the following error message appears under Windows Server 2019 in the plugin check-windows-cpu-load:

outputGet-Counter : Internal performance counter API call failed. Error: c0000bb8.
At C:\opt\sensu\plugins\powershell\check-windows-cpu-load.ps1:48 char:32

  • ... th]::Round((Get-Counter "$localizedCategoryName(_total)$localizedCo ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidResult: (:) [Get-Counter], Exception
    • FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

Unbenannt

Does anyone have an idea for the solution?

Thanks and Greetings

@derekgroh
Copy link
Contributor

Thanks for opening an Issue! I will need more info on which version of the check you are running in order to help.

Could you also share the command you are running (with args) and the output?

Can you run the following command without error?
Get-Counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 2 -MaxSamples 3

@MisterDeeds
Copy link
Author

Hi, thanks alot for your answer.

Sure thats the command:
"command": "Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\opt\sensu\plugins\powershell\check-windows-cpu-load.ps1 80 90"

These command is running successfully:
PS C:\Users\Administrator> Get-Counter -Counter "\Processor(_Total)% Processor Time" -SampleInterval 2 -MaxSamples 3

Timestamp CounterSamples


21.10.2019 16:50:20 \srv01\processor(_total)% processor time :
0.791185762745861

21.10.2019 16:50:22 \srv01\processor(_total)% processor time :
1.14090872559196

21.10.2019 16:50:24 \srv01\processor(_total)% processor time :
0

Any ideas? Thanks alot and best regards!

@derekgroh
Copy link
Contributor

derekgroh commented Oct 21, 2019

Not able to reproduce, are you seeing this across multiple systems?
OS Name: Microsoft Windows Server 2019 Datacenter Evaluation
OS Version: 10.0.17763 N/A Build 17763
PSVersion 5.1.17763.134
C:\Users\vagrant>Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -File C:\opt\sensu\plugins\powershell\check-windows-cpu-load.ps1 80 90 CheckWindowsCpuLoad OK: CPU at 2%.

@MisterDeeds
Copy link
Author

MisterDeeds commented Oct 21, 2019

Hi Derek

Unfortunately, this error is displayed on all 6 server system. They are all the same version:

OS Name: Microsoft Windows Server 2019 Standard
OS Version: 10.0.17763 N/A Build 17763
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Server
OS Build Type: Multiprocessor Free

https://imgur.com/VuLzOaY

And they run on different hardware, some are virtualized.

@MisterDeeds
Copy link
Author

Hi again

it looks like the system could not include perfhelper.ps1.

With Server 2016:

OS Name: Microsoft Windows Server 2016 Datacenter
OS Version: 10.0.14393 N/A Build 14393
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Server
OS Build Type: Multiprocessor Free

everything works:

Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -N
oLogo -File check-windows-cpu-load.ps1 80 90
CheckWindowsCpuLoad OK: CPU at 0%.

The Powershell versions are differen:

Server 2016.
Name Value


PSVersion 5.1.14393.3053
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3053
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Server 2019:
Name Value


PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Which Powershell version do you use?

Thanks alot and best regards

@MisterDeeds
Copy link
Author

MisterDeeds commented Oct 22, 2019

Hi again again

I think the problem comes from theComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\CurrentLanguage\009\Counter entry

On Server 2016 the values are as follows:

Processor Information
5196
% Processor Time
5198

On Server 2019 the values are:
Processor Information
1896
% Processor Time
1898

But the script still returns the values of the Server 2016.

On Server 2019 at me its look like:
5196
5198
Virtual Disk Pending Deletion
Virtual Disk Pending Deletion Bytes

If I enter it manually it works

$Value = [System.Math]::Round((Get-Counter "\Processor Information(_total)% Processor Time" -SampleInterval 1 -MaxSamples 1).CounterSamples.CookedValue)

@derekgroh
Copy link
Contributor

Take a look at the Troubleshooting section of the Readme and see if that helps.

@MisterDeeds
Copy link
Author

Hi Derek, you mean this?

C:\Windows\SysWOW64>lodctr /R
Info: Successfully rebuilt performance counter setting from system backup store

Unfortunately not, still the same error.

@derekgroh
Copy link
Contributor

You'd have to determine the different between your systems as this seems isolated to your environment.

Some troubleshooting steps to explore are to create a base box from disk and see if the issue can be reproduced or test on a vagrant cloud system to gather more information on how your environment could differ.

If you still feel this is an issue related to this code base, please provide as much information to reproduce the issue (including system build) for us to be able to reproduce.

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

No branches or pull requests

2 participants