NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
182 stars 94 forks source link

Check Windows Event Logs in Subfolders #1185

Open cosmicgumbo opened 4 months ago

cosmicgumbo commented 4 months ago

The NCPA built-in Windows log check only works with logs at the root of Event Viewer, not under any subfolders. Issue #948 describes this for a certain log, but it appears to be with any log in a subfolder.

See forum post: https://support.nagios.com/forum/viewtopic.php?p=357809

I have tried variations but they have not worked ./check_ncpa.py -H <hostname> -P 5693 -t '<your token>' -M 'logs' -q 'name=Laserfiche-Directory Service-Server/Operational ./check_ncpa.py -H <hostname> -P 5693 -t '<your token>' -M 'logs' -q 'name=Laserfiche-Directory Service-Server%4Operational'

This appears to be similar to how the 2 different Powershell commands Get-WinEvent vs Get-EventLog Get-WinEvent -LogName "Laserfiche-Directory Service-Server/Operational" -MaxEvents 1 - returns the desired result

Get-EventLog -AsString -List - this returns only the root level logs and does not recognize those in subfolders