Page 1 of 2

Anybody good with NSClient and check_nrpe?

Posted: Thu Feb 27, 2014 10:54 am
by FTL
Hi,

Im struggling with the CheckTaskSched module of NSClient.

I want my Nagios box to be able to monitor 8 diffenet individual Scheduled Tasks on a Windows 2008 server.

I use NSClient already successfully for monitoring disk space, cpu usage etc on various servers but cant get Sched Tasks working.

Im running 0.39

Im using this command from a Nagios terminal for testing:

check_nrpe -H 1.2.3.4 -p 5666 -c CheckTaskSched -a "filter=title ='Test' status='disabled'" "syntax=%title% %status%"

And its response is:

OK: All Scheduled Tasks are good.

But i have my Test job disabled!!

Where am i going wrong please?

Thanks

Re: Anybody good with NSClient and check_nrpe?

Posted: Thu Feb 27, 2014 11:14 am
by slansing
Try searching for 'enabled' instead of 'disabled' it may be matching that sytax and thinking that you want it to be disabled, so it's really giving you a false negative.

Re: Anybody good with NSClient and check_nrpe?

Posted: Thu Feb 27, 2014 11:40 am
by FTL
slansing wrote:Try searching for 'enabled' instead of 'disabled' it may be matching that sytax and thinking that you want it to be disabled, so it's really giving you a false negative.
Nope still says the same with 'enabled'

At a loss :-/

Re: Anybody good with NSClient and check_nrpe?

Posted: Thu Feb 27, 2014 5:56 pm
by lmiltchev
I may be wrong, but the following command:

Code: Select all

check_nrpe -H 1.2.3.4 -p 5666 -c CheckTaskSched -a "filter=title ='Test' status='disabled'" "syntax=%title% %status%"
seems correct... Just out of curiosity, what happens, if you use 'running' instead of 'disabled'?

Code: Select all

check_nrpe -H 1.2.3.4 -p 5666 -c CheckTaskSched -a "filter=title ='Test' status='running'" "syntax=%title% %status%"
I would recommend reviewing the examples here:
http://nsclient.org/nscp/wiki/CheckTask ... ed/samples
I wouldn't hurt to also post your question on the NSClient++ support forum.

Re: Anybody good with NSClient and check_nrpe?

Posted: Fri Feb 28, 2014 4:58 am
by FTL
Hi lmiltchev

Substituting disabled for running makes no difference - still tells me everything is ok.

Tried reversing the filter and checking for 'Ready' just incase it was filtering out 'Disbaled' but that too says everything is ok.

Output of schedtasks clearly shows Test is disabled:

Code: Select all

"TaskName","Next Run Time","Status"
"\Friday SQL Back Files Copy","07/03/2014 06:30:00","Ready"
"\Monday SQL Bak Files Copy","03/03/2014 06:30:00","Ready"
"\Saturday SQL Bak Files Copy","01/03/2014 06:30:00","Ready"
"\Sunday SQL Bak Files Copy","02/03/2014 06:30:00","Ready"
"\Test","Disabled",""
"\Thursday SQL Bak Files Copy","06/03/2014 06:30:00","Ready"
"\Tuesday SQL Bak Files Copy","04/03/2014 06:30:00","Ready"
"\Wednesday SQL Bak Files Copy","05/03/2014 06:30:00","Ready"
So its not me losing the plot - which i normally put the blame on to :)

I have asked twice on the NSClient forums (post #1398 and #1399) but my posts never seem to appear on there.

Ive tried putting in AND arguments aswell so it specifically matches title AND status but still nothing:

Code: Select all

check_nrpe -H 1.2.3.4 -p 5666 -c CheckTaskSched -a "filter=title = 'Test' AND status = 'Disabled'" "syntax=%title% AND %status%"
again just returns: OK. All scheduled tasks are good.

:(

Re: Anybody good with NSClient and check_nrpe?

Posted: Fri Feb 28, 2014 12:25 pm
by sreinhardt
Could you provide a copy of the command definition and script(?) on your nsclient side?

Re: Anybody good with NSClient and check_nrpe?

Posted: Mon Mar 03, 2014 6:40 am
by FTL
There isnt one Spencer.

The CheckTaskSched command is a built in module within NSClient and runs out of a dll file. It doesnt use any external scripts or anything.

And i have no Nagios configuration yet as im just testing from the comman line as no point writing the configs when it doesnt work properly.

Re: Anybody good with NSClient and check_nrpe?

Posted: Mon Mar 03, 2014 1:52 pm
by lmiltchev
And i have no Nagios configuration yet as I'm just testing from the command line as no point writing the configs when it doesnt work properly.
It makes perfect sense. :)

I am not sure if this is going to help, but I found a powershell script on the Nagios Exchange for monitoring sheduled tasks in Windows 2008+, that you can probably use with NSClient++ and check_nrpe.

http://exchange.nagios.org/directory/Pl ... ks/details

There may be more "custom" scripts that can get the job done. In NSClient++ you can use powershell, vbs scripts, etc. Let me know if this helped.

Re: Anybody good with NSClient and check_nrpe?

Posted: Tue Mar 04, 2014 5:47 am
by FTL
Yes i have been playing with that script and other various powershell scripts i have found but they all need tweaking to do what i want so im going to have to learn how to write in powershell i think!!

Re: Anybody good with NSClient and check_nrpe?

Posted: Tue Mar 04, 2014 6:01 am
by FTL
Just for info too:

Testing against various different boxes with this command:

Code: Select all

check_nrpe -H 1.2.3.4 -p 5666 -c CheckTaskSched -a "filter=status eq 'disabled'" "syntax=The Scheduled Task %title% is %status%"
Gives the following results:

Server 2008 - OK. All Scheduled Tasks are good. (using NSC++ v0.39)

Server 2008 - OK. All Scheduled Tasks are good. (using NSC++ v0.41 upgraded from v0.39)

Server 2008 - The Scheduled Task Test is Disabled (using clean install v0.41)

Win 8.1 - The Scheduled Task Test is Disabled (using clean install v0.41)


So looks like as 0.39 was a beta version of CheckTaskSched it obviously didn't work properly - and doing an in place upgrade to the latest most stable version kept in whatever was broken through the upgrade process.

Clean installs of latest version appears to actually produce a valid answer to the arguments provided.

Finally making hay...... :)