Linuxfabrik / monitoring-plugins

220+ check plugins for Icinga and other Nagios-compatible monitoring applications. Each plugin is a standalone command line tool (written in Python) that provides a specific type of check.
https://linuxfabrik.ch
The Unlicense
220 stars 51 forks source link

updates: On Windows with closed firewall a PowerShell error is returned #633

Closed slalomsk8er closed 1 year ago

slalomsk8er commented 1 year ago

This issue respects the following points:

Bug description

see title

Steps to reproduce - Plugin call

'C:\ProgramData\icinga2\usr\lib64\nagios\plugins\updates.exe' '--critical' '50' '--warning' '2'

Steps to reproduce - Plugin Version

v2022021501

Steps to reproduce - Data

Exception from HRESULT: 0x80072EE2
At line:4 char:5
+     $Pending = $SearchIndex.Search('IsInstalled=0');
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

Python version

No response

Environment

Windows

Application

No response

Python modules

No response

Additional info

No response

markuslf commented 1 year ago

"Closed Firewall" means "Block all outgoing connections".

Confirmed. Only happens in Powershell after a 10 second timeout. In a batch terminal, updates.exe hangs forever.

markuslf commented 1 year ago

Fixed in source. If you like, please give it a try. Don't forget to use the updated libs as well (implemented a new timeout parameter in shell_exec() - it is more general than relying on PowerShell).