Windows WMI monitoring - CPU: Need at least 2 WMI samples
Posted: Thu Sep 23, 2021 6:32 am
Hi, my first support request on this forum.
In short, I have an issue especially with the standard "CPU Usage" monitoring, giving the "Average CPU Utilisation Need at least 2 WMI samples", where other standard monitors: Memory Usage, Page File Usage, Drive C: Disk Usage, System Log.. and Application Log... works correctly.
Details and background: In a newer environment, I have set up Nagios XI to WMI-monitor around 20 VM Windows 2019 servers, using a domain wmiagent user, being member of Administrators; Distributed COM Users; Event Log Readers; Performance Log Users; Performance Monitor Users; Remote Management Users; Domains Users.
I have followed the Nagios related doc, using DCOMCnfg.exe, WMImgmt.msc and sc sdset commands and as written, most standard monitors works as expected.
On the AD servers, the "CPU Usage" monitoring DO work, but on all other Win servers in the domain, I have the "Need at least 2 WMI samples" issue. I have compared sc sdshow SCMANAGER output on AD server and other server, but they are identical.
Running a local cmd: Get-WmiObject -Query 'select PercentProcessorTime,Timestamp_Sys100NS from Win32_PerfRawData_PerfOS_Processor where Name="_Total"'
gives data, e.g. :
Henrik
In short, I have an issue especially with the standard "CPU Usage" monitoring, giving the "Average CPU Utilisation Need at least 2 WMI samples", where other standard monitors: Memory Usage, Page File Usage, Drive C: Disk Usage, System Log.. and Application Log... works correctly.
Details and background: In a newer environment, I have set up Nagios XI to WMI-monitor around 20 VM Windows 2019 servers, using a domain wmiagent user, being member of Administrators; Distributed COM Users; Event Log Readers; Performance Log Users; Performance Monitor Users; Remote Management Users; Domains Users.
I have followed the Nagios related doc, using DCOMCnfg.exe, WMImgmt.msc and sc sdset commands and as written, most standard monitors works as expected.
On the AD servers, the "CPU Usage" monitoring DO work, but on all other Win servers in the domain, I have the "Need at least 2 WMI samples" issue. I have compared sc sdshow SCMANAGER output on AD server and other server, but they are identical.
Running a local cmd: Get-WmiObject -Query 'select PercentProcessorTime,Timestamp_Sys100NS from Win32_PerfRawData_PerfOS_Processor where Name="_Total"'
gives data, e.g. :
- __GENUS : 2
__CLASS : Win32_PerfRawData_PerfOS_Processor
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 2
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
PercentProcessorTime : 849716054687
Timestamp_Sys100NS : 132768640947402191
PSComputerName :
- Command Line (v1.65): /usr/local/nagios/libexec/check_wmi_plus.pl -H 10.12.11.65 -u USER -p PASS -m checkcpu -d
Base Dir: /usr/local/nagios/libexec
Conf File Dir: /usr/local/nagios/libexec
Loaded Conf File /usr/local/nagios/libexec/check_wmi_plus.conf
WMI Ini Dir: /usr/local/nagios/libexec
Starting Keep State Mode
STATE FILE: /tmp/cwpss_checkcpu__10121165___.state
Checking previous data's expiry - Timestamp 1632389800 vs Expiry After 1632386371 (Keep State Expiry setting is 3600sec)
Using Existing WMI DATA of:$VAR1 = [
[
{
'_ItemCount' => '0',
'_KeepStateCreateTimestamp' => 1632389800
}
]
];
Round #2 of 2
QUERY: /usr/bin/wmic '-U' 'USER%PASS' '--namespace' 'root/cimv2' '//10.12.11.65' 'select PercentProcessorTime,Timestamp_Sys100NS from Win32_PerfRawD
ata_PerfOS_Processor where Name="_Total"'
OUTPUT:
WMI DATA:$VAR1 = [
[
{
'_ChecksOK' => 1,
'_KeepStateSamplePeriod' => 171,
'_ItemCount' => '0',
'_KeepStateCreateTimestamp' => 1632389800
}
],
[
{
'_ItemCount' => 0
}
]
];
Storing new WMI results in the state file $VAR1 = [
[
{
'_ItemCount' => 0
}
]
];
Copying predefined fields to the last WMI result set [0] to [1]
NEW WMI DATA:$VAR1 = [
[
{
'_ItemCount' => '0'
}
],
[
{
'_KeepStateSamplePeriod' => 171,
'_ChecksOK' => 1,
'_KeepStateCreateTimestamp' => 1632389800,
'_ItemCount' => 0
}
]
];
Creating '_AvgCPU' (WMIQuery:1, Row:0) using 'PERF_100NSEC_TIMER_INV' (Parameters: PercentProcessorTime,%.2f,100)
Setting _AvgCPU to Need at least 2 WMI samples
Testing TEST VALUES $VAR1 = {
'_KeepStateSamplePeriod' => 171,
'_ChecksOK' => 1,
'_AvgCPU' => 'Need at least 2 WMI samples',
'_KeepStateCreateTimestamp' => 1632389800,
'_ItemCount' => 0
};
WARNING SPECS: $VAR1 = undef;
CRITICAL SPECS: $VAR1 = undef;
------------ Critical Check ------------
------------ Warning Check ------------
------------ End Check ------------
Data Passed back from check: $VAR1 = {
'_AvgCPU' => 'Need at least 2 WMI samples',
'_DisplayMsg' => 'OK (Sample Period 171 sec)',
'_TestResult' => 0,
'_KeepStateCreateTimestamp' => 1632389800,
'_ChecksOK' => 1,
'_KeepStateSamplePeriod' => 171,
'_StatusType' => 'OK (Sample Period 171 sec)',
'_ItemCount' => 0,
'_Triggers' => ''
};
---------- Building Up Display
Incoming Data $VAR1 = {
'_submode' => '',
'_staticsubcriteria' => '1',
'_nodatastring' => 'WMI Query returned no data. The item you were looking for may NOT exist or the software that creates the WMI Class may
not be running, or all data has been excluded.
',
'_TestResult' => 0,
'_KeepStateCreateTimestamp' => 1632389800,
'_arg5' => undef,
'_ChecksOK' => 1,
'_KeepStateSamplePeriod' => 171,
'_host' => '10.12.11.65',
'_ignorezerosizedrives' => '',
'_nodatamode' => '',
'_mode' => 'checkcpu',
'_savedbytefactor' => '',
'_ItemCount' => 0,
'_convertslash' => undef,
'_arg3' => '',
'_forcevariablescriteriaspec' => '',
'_AvgCPU' => 'Need at least 2 WMI samples',
'_DisplayMsg' => 'OK (Sample Period 171 sec)',
'_arg1' => '',
'_truncate_output' => 8192,
'_arg2' => '',
'_timeout' => '',
'_StatusType' => 'OK (Sample Period 171 sec)',
'_delay' => 171,
'_bytefactor' => 1024,
'_nodataexit' => '',
'_arg4' => undef,
'_Triggers' => ''
};
------- Processing _DisplayMsg||~|~| - ||
Complex Format:_DisplayMsg,,~,~, - ,,
_DisplayMsg||~|~| - || ----> OK (Sample Period 171 sec) -
------- Processing _AvgCPU|%|Average CPU Utilisation| |~||
Complex Format:_AvgCPU,%,Average CPU Utilisation, ,~,,
_AvgCPU|%|Average CPU Utilisation| |~|| ----> Average CPU Utilisation Need at least 2 WMI samples%
---------- Building Up Performance Data
------- Processing _AvgCPU|%|Avg CPU Utilisation
Complex Format:_AvgCPU,%,Avg CPU Utilisation
Ignoring perf data since it is not numeric
---------- Done
OUT:OK (Sample Period 171 sec) - Average CPU Utilisation Need at least 2 WMI samples%
Henrik