Check Windows Processes

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
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: Check Windows Processes

Post 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"
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: Check Windows Processes

Post by ofadl »

will do, but how do i zip up a script file? have no experience in doing so
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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...
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: Check Windows Processes

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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"
Be sure to check out our Knowledgebase for helpful articles and solutions!
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: Check Windows Processes

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check Windows Processes

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked