Page 1 of 1
check for checking a running batch file.
Posted: Thu Jul 17, 2014 12:01 am
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.
Re: check for checking a running batch file.
Posted: Thu Jul 17, 2014 4:13 pm
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.
Re: check for checking a running batch file.
Posted: Fri Jul 18, 2014 1:37 am
by kjafarov
Dear tmcdonald, we use nsclient++. Can you suggest check for nsclient++?
Re: check for checking a running batch file.
Posted: Fri Jul 18, 2014 12:17 pm
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
Re: check for checking a running batch file.
Posted: Sat Jul 19, 2014 10:19 pm
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.
Re: check for checking a running batch file.
Posted: Mon Jul 21, 2014 1:52 am
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.
Re: check for checking a running batch file.
Posted: Mon Jul 21, 2014 4:45 pm
by lmiltchev
@kjafarov
Let us know if chris.fixter's post helped you solve the issue.