Page 11 of 15

Re: Check Windows Processes

Posted: Tue Jul 16, 2013 11:50 am
by ofadl
ok i changed it so everyone has permission to everything and ran the command again with same error.


./check_nrpe -H 10.100.50.15 -p 5666 -c check_procs_from_file -a "C:\Program Files\NSClient++\scripts\host.proclist.txt"

Re: Check Windows Processes

Posted: Tue Jul 16, 2013 2:19 pm
by lmiltchev
Zip up the script that you are trying to use with nsclient++ and send it to me via PM. We will test it and try to identify the issue.

Re: Check Windows Processes

Posted: Tue Jul 16, 2013 2:36 pm
by ofadl
will do, but how do i zip up a script file? have no experience in doing so

Re: Check Windows Processes

Posted: Tue Jul 16, 2013 3:02 pm
by lmiltchev
Right-click on the file, point to Send To, and then click Compressed (zipped) Folder. If you use 7-zip, you right-click, click on 7-Zip->Add to archive...

Re: Check Windows Processes

Posted: Tue Jul 16, 2013 4:13 pm
by lmiltchev
OK, try the following...

1. Make sure both, the "check_process_instances_from_file.wsf" script and the "host.proclist.txt" file are in the "C:\Program Files\NSClient++\scripts\" directory.

2. Modify the command in the NSC.ini (nsclient.ini) file to look like this:

Code: Select all

check_procs_from_file=cscript.exe //NoLogo //T:30 scripts\check_process_instances_from_file.wsf scripts\$ARG1$
Save the file and restart the NSClient++ service.

3. Run the check from the command line on the nagios server:

Code: Select all

./check_nrpe -H 10.100.50.15 -p 5666 -c check_procs_from_file -a host.proclist.txt
Let me know if this helped.

Re: Check Windows Processes

Posted: Wed Jul 17, 2013 8:31 am
by ofadl
ran that after those changes with:

./check_nrpe -H 10.100.50.15 -p 5666 -c check_procs_from_file -a host.proclist.txt

and got:

C:\Program Files\NSClient++\scripts\check_process_instances_from_file.wsf(163, 2) Microsoft VBScript runtime error: File not found

Re: Check Windows Processes

Posted: Wed Jul 17, 2013 10:09 am
by lmiltchev
Let's see what you have in the "scripts" directory and if you can run this script locally, on the Windows machine.
On the Windows box, click on the "Start" button, type "cmd" in the search bar and hit "Enter". In the DOS Command Prompt, type the following commands, and show us the output:

Code: Select all

cd "c:\Program Files\NSClient++\scripts"
dir
cscript "c:\Program Files\NSClient++\scripts\check_process_instances_from_file.wsf" "c:\Program Files\NSClient++\scripts\host.proclist.txt"

Re: Check Windows Processes

Posted: Wed Jul 17, 2013 11:13 am
by ofadl
from the command "dir", it displays as follows:

Directory of C:\Program Files\NSClient++\scripts

07/16/2013 04:05 PM <DIR> .
07/16/2013 04:05 PM <DIR> ..
07/04/2011 10:56 PM 114 check_60s.bat
07/04/2011 10:56 PM 1,701 check_battery.vbs
07/04/2011 10:56 PM 14,353 check_files.vbs
07/04/2011 10:56 PM 1,352 check_no_rdp.bat
07/04/2011 10:56 PM 51 check_ok.bat
07/04/2011 10:56 PM 259 check_ping.bat
07/04/2011 10:56 PM 4,400 check_printer.vbs
08/06/2007 03:39 PM 6,473 check_process_instances_fromfile.wsf
07/16/2013 04:05 PM 2,613 check_process_instances_from_file.7z
07/28/2008 11:36 AM 8,594 check_process_instances_from_file.wsf
07/04/2011 10:56 PM 67 check_test.ps1
07/04/2011 10:56 PM 1,543 check_test.vbs
06/18/2012 01:17 PM 1,309 host.proclist.txt
07/10/2013 03:27 PM <DIR> lib
07/04/2011 10:56 PM 1,363 test.lua
14 File(s) 44,192 bytes
3 Dir(s) 20,952,928,256 bytes free


and from doing : cscript "c:\Program Files\NSClient++\scripts\check_process_instances_from_file.wsf" "c:\Program Files\NSClient++\scripts\host.proclist.txt"



Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Result is: Warning: 2 AgentControl.exe running expected 1.

Re: Check Windows Processes

Posted: Wed Jul 17, 2013 11:22 am
by lmiltchev
Result is: Warning: 2 AgentControl.exe running expected 1.
So you can run the script locally. I assume the issue is in the NSC.ini (nsclient.ini). Can you post this file for a review (hide sensitive info)?

Re: Check Windows Processes

Posted: Wed Jul 17, 2013 12:23 pm
by lmiltchev
I removed your post with the *.ini file for the sake of security. Anyway, I believe I know what the issue is. You are passing an argument in your command, but arguments are not currently allowed for external scripts the way your config is. Remove the semicolon in front of the following two lines in the [External Script] section:

Code: Select all

;allow_arguments=1
;allow_nasty_meta_chars=1
so that they will look like this:

Code: Select all

allow_arguments=1
allow_nasty_meta_chars=1
Restart the NSClient++ service, and try your check again.

Code: Select all

./check_nrpe -H 10.100.50.15 -p 5666 -c check_procs_from_file -a host.proclist.txt