check for checking a running batch file.

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
kjafarov
Posts: 3
Joined: Wed Jul 16, 2014 11:51 pm

check for checking a running batch file.

Post by kjafarov »

Dears, I'm new in nagios. Please help me with creating check for monitoring a batch file. I mean running or no running a batch file in Windows machine, location D:\test.bat.
I need get information, in nagios monitoring system, when batch file is not running.

Great Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check for checking a running batch file.

Post by tmcdonald »

http://assets.nagios.com/downloads/ncpa ... index.html

You could install NCPA and use it to run a script which checks for a process running.
Former Nagios employee
kjafarov
Posts: 3
Joined: Wed Jul 16, 2014 11:51 pm

Re: check for checking a running batch file.

Post by kjafarov »

tmcdonald wrote:http://assets.nagios.com/downloads/ncpa ... index.html

You could install NCPA and use it to run a script which checks for a process running.
Dear tmcdonald, we use nsclient++. Can you suggest check for nsclient++?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check for checking a running batch file.

Post by abrist »

You can use the PROCSTATE var to check a process for state:

Code: Select all

check_nt -H <windows ip> -p 12489 -s <password> -v PROCSTATE -l <process> -d SHOWALL
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
kjafarov
Posts: 3
Joined: Wed Jul 16, 2014 11:51 pm

Re: check for checking a running batch file.

Post by kjafarov »

Dear abrist,

Thank you for code, but there are severeral BAT files, which use cmd.exe process. I need check test.bat not test1.bat, test2.bat.
chris.fixter
Posts: 22
Joined: Wed Jun 18, 2014 4:15 am

Re: check for checking a running batch file.

Post by chris.fixter »

We had similar problem with Java applications. Our solution was to copy the java.exe to different names, and each batch calls the different executable.
In your case, you can make multiple copy of c:\wdinwos\system32\cmd.exe to eg. cmd2.exe, cmd3.exe.
In your batch file you can execute : "cmd2.exe /c ....." encapsulate your real command. Then you will be able to use Abrist's nagios command.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check for checking a running batch file.

Post by lmiltchev »

@kjafarov
Let us know if chris.fixter's post helped you solve the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked