Check_winfile only works locally

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ILoveNagios
Posts: 5
Joined: Wed Nov 04, 2015 9:30 am

Check_winfile only works locally

Post by ILoveNagios »

Hi I am able to execute my check_winfile command from my Windows 2008 R2 server successfully. However, running it from my Nagios server on Ubuntu I get an error.
In my nsclient.ini I have: check_DFSConflicts = scripts\check_winfile.exe --target C:\Temp --filter "age ge -15 minutes" --critical 0
Command I successfully run manually on Windows: check_winfile.exe --target C:\Temp --filter "age ge -15 minutes" --critical 0 - returns FILE OK - 0 files out of 2 to consider.
Running command on Nagios server: ./check_nrpe -H 10.1.0.57 -c check_dfsconflicts - returns Unknown option: 15

So it is getting hung up on the "-15 minutes" portion of the command but I'm not sure why.

If I remove the --filter from the nsclient.ini and re-run the command on Nagios then it sees the two files in the directory and reports 2 files to consider.
I'm wondering if the Time::ParseDate portion of nrpe isn't installed. It must have something to do with that but I can't figure it out.

Thanks in advance!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check_winfile only works locally

Post by rkennedy »

Can you post the output in your nsclient.log for us to take a look at?
Former Nagios Employee
ILoveNagios
Posts: 5
Joined: Wed Nov 04, 2015 9:30 am

Re: Check_winfile only works locally

Post by ILoveNagios »

rkennedy wrote:Can you post the output in your nsclient.log for us to take a look at?
Thanks for replying!

Here's what I'm getting:

2015-11-04 16:12:34: l:d:\source\nscp\trunk\modules\checkexternalscripts\commands.hpp:100: Failed to parse arguments for command 'check_DFSConflicts', using old split string method: unknown escape sequence: scripts\check_winfile.exe --target C:\Temp --filter "age ge -15 minutes" --critical 0 --verbose

Here's the nsclient.ini info after adding verbose logging:

; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
check_DFSConflicts = scripts\check_winfile.exe --target C:\Temp --filter "age ge -15 minutes" --critical 0 --verbose
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check_winfile only works locally

Post by Box293 »

What version of NSClient++ are you using? I was able to sucessfully test this Windows 2008 R2 server running NSClient++ 0.4.3.143.

Also, if you upgraded from an old version, try this:
Take a backup copy of nsclient.ini
Uninstall
Delete the Directory
Install from scratch
Replace nsclient.ini with your copy
Restart service

On a separate note, NSClient++ has built in file checks so you don't need to worry about any external scripts. For example:

Code: Select all

Command:
./check_nrpe -H win2008R2-01 -c check_files -a path='C:\Temp' pattern=*.* 'filter=written > -15m' 'critical=count>0'

Output:
CRITICAL: 1/1 files (test.bat)|'count'=1;0;0
I have a bunch of examples here:
http://sites.box293.com/nagios/guides/c ... es-folders
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ILoveNagios
Posts: 5
Joined: Wed Nov 04, 2015 9:30 am

Re: Check_winfile only works locally

Post by ILoveNagios »

Box293 wrote:What version of NSClient++ are you using? I was able to sucessfully test this Windows 2008 R2 server running NSClient++ 0.4.3.143.
This was a new install of NSClient++ version 0.4.1.73. I uninstalled as you described and installed 4.3.143.
I hadn't copied over my ini yet but on the Nagios server I now get "CHECK_NRPE: Error - Could not complete SSL handshake."
After copying the ini back I still get the same error.

I know security is higher in the newer version. I'm pretty sure I had compiled nrpe with SSL as well.

Thanks for your continued help on this!
ILoveNagios
Posts: 5
Joined: Wed Nov 04, 2015 9:30 am

Re: Check_winfile only works locally

Post by ILoveNagios »

Nevermind! I added

[/settings/NRPE/server]
insecure = true

to my nsclient.ini and now it works.
Thanks again for your help!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check_winfile only works locally

Post by hsmith »

Glad to hear it is working!

Are we all right to mark this thread resolved and close it?
Former Nagios Employee.
me.
ILoveNagios
Posts: 5
Joined: Wed Nov 04, 2015 9:30 am

Re: Check_winfile only works locally

Post by ILoveNagios »

hsmith wrote:Are we all right to mark this thread resolved and close it?
Absolutely. Thanks!
Locked