mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
243 stars 94 forks source link

nscp check_eventlog will not take -ve value in scan-range #682

Open radioactive9 opened 4 years ago

radioactive9 commented 4 years ago

Issue and Steps to Reproduce

I am having trouble to configure Windows Event Log Monitoring using nscp.exe. This will not take a -ve value. Getting error (Invalid command line: unrecognised option ‘-1d’)

nscp.exe client --log critical --module CheckEventlog -b -q check_eventlog -a “scan-range=-1h”
nscp.exe client --log critical --module CheckEventlog -b -q check_eventlog -a “scan-range=’-1h’”

Getting error (Invalid command line: unrecognised option ‘-1h’) Failed to process command : bad lexical cast: source type value could not be interpreted as target|

Expected Behavior

It should scan the log for last one day only and if any error is found it will report. If I use filter further like 'nscp.exe’ ‘client’ ‘–log’ ‘critical’ ‘–module’ ‘CheckEventlog’ ‘-a’ ‘filter=provider = ‘’’***App’’’ and id IN (’’‘20’’’)’ ‘-a’ ‘scan-range=-1hr’ ‘-b’ ‘-q’ ‘check_eventlog’.

Actual Behavior

C:\Program Files\NSClient++>nscp.exe client --log critical --module CheckEventlog -b -q check_eventlog -a "filter=provider='XYZApp' and id IN ('20')" -a "scan-range=" CRITICAL: 2 message(s) Application XYZApp (Test Event Log), Application XYZApp (Test Event Log)|'problem_count'=1;0;0

Till the time I do not mention the negative value of scan-range it is working. Below is example of Positive Value

C:\Program Files\NSClient++>nscp.exe client --log critical --module CheckEventlog -b -q check_eventlog -a "filter=provider='XYZApp' and id IN ('20')" -a "scan-range=1h" CRITICAL: 3 message(s) Application XYZApp (XYZ Test Event for icinga testing), Application XYZApp (Test Event Log), Application XYZApp (Test Event Log)|'problem_count'=1;0;0

Now as soon as I mention -ve value as I am suppose to do it is failing C:\Program Files\NSClient++>nscp.exe client --log critical --module CheckEventlog -b -q check_eventlog -a "filter=provider='XYZApp' and id IN ('20')" -a "scan-range=-1h" Invalid command line: unrecognised option '-1h'

Details

Additional Details

; Undocumented key CheckEventLog = enabled

; Undocumented key CheckSystem = enabled

NSClient++ log:

I don't know where to see the logs as nsclient.log do not have any data