CMK version:
2.1.0p19 CME
OS version:
Ubuntu 22.04 LTS on CheckMK Server / Windows Server 20129 on monitored host
Plugin
win_printers.ps1
Error message:
<<<win_printers>>>
Get-WMIObject : Critical error
At C:\ProgramData\checkmk\agent\plugins\win_printers.ps1:19 char:14
+ ... Data_Set1 = Get-WMIObject Win32_PerfFormattedData_Spooler_PrintQueue ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Get-WmiObject : Critical error
At C:\ProgramData\checkmk\agent\plugins\win_printers.ps1:20 char:14
+ $Data_Set2 = Get-WmiObject win32_printer | ?{$_.PortName -notmatch '^ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
I am trying to monitor a Windows print server and for this reason I have distributed the plugin for it (Windows Printer Queues and States).
The problem is that not all printers that are set up in the print server are detected/output by CheckMK.
The printers are also not included in the agent output.
As you can see here on the pictures only the printers with the name starting from VH05_ are shown.
But the names start at OKI or VH00_.
When I run win_printers.ps1 manually on the server, I get the above error message and then the list of printers that can be seen in CheckMK.
It does not matter if win_printers.ps1 is run as administrator or not. The result is always the same.
When I execute the commands in the script individually, the first command displays more printers but not all.
The second command displays the printers that appear in CheckMK.
$Data_Set1 = Get-WMIObject Win32_PerfFormattedData_Spooler_PrintQueue | Select Name, Jobs | Sort Name
$Data_Set2 = Get-WmiObject win32_printer | ?{$_.PortName -notmatch '^TS'} | Select Name, @{name="Jobs";exp={$null}}, PrinterStatus, DetectedErrorState | Sort Name
It looks like not all printers are queried. Probably because of the error that occurs?
This only occurs on servers that have many printers (>100). On another server that has only 14 printers I do not have the problem.
Has anyone here had the same problem and possibly a solution or any idea what else I can try?