monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cant able to check java process in monit


From: Martin Pala
Subject: Re: Cant able to check java process in monit
Date: Thu, 10 May 2007 08:00:08 -0400

Check the pid stored in the file and compare it to the real process pid.


On May 10, 2007, at 3:35 AM, nirmala nirmala wrote:

Hi,
I need to process java programs in monit. For this i used to check one sample program in java and i created pid for this java program. I used below java program as sample for monitoring.

public class sample
{
   public static void main(String args[]) throws Throwable
   {
      int i=0;
       while (i<5)
       {
         System.out.println("thread "
            +Thread.currentThread().getName()+" step "+i);
         Thread.sleep(5000); i++;
      }
   }
}
For this i created pid file using shell script as follows
#!/bin/bash
   export JAVA_HOME=/usr/java/jdk1.5.0_06
          export DISPLAY=localhost:0.0
          CLASSPATH=/usr/java/jdk1.5.0_06/bin/
          case $1 in
           start)
           echo $$ > /var/run/sample.pid;
exec 2>&1 /usr/java/jdk1.5.0_06/bin/java -cp $ {CLASSPATH} sample\
           1>/var/run/sample.out
           ;;
          stop)
           kill `cat /var/run/sample.pid` ;;
          *)
           echo "usage: sample {start|stop}" ;;
          esac
Now my problem is when i start monit, its running. But whenever i check monit status for this java process, its coming as ".does not exist" . That s below.

Process 'sample'
  status                            Does not exist
  monitoring status             monitored
  data collected                  Thu May 10 12:35:16 2007
and my control file for this java process is below

check process sample with pidfile /var/run/sample.pid
                start = "/usr/java/jdk1.5.0_06/bin/sample.class start"
                stop = "/usr/java/jdk1.5.0_06/bin/sample.class stop"
So pls let me know what step i have to do for this.

Thanks,
Nirmala

Here’s a new way to find what you're looking for - Yahoo! Answers
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

[Prev in Thread] Current Thread [Next in Thread]