I am trying to use monit in our organization and I got confused by few things.  
Can one of you help me?


1.       I wanted to use check  program  to check a status of existing  
application



So I placed this entry



check program app with path "/home/alex/bin/app_ctl status"

         start program = "/home/alex/bin/app_ctl start" as uid alex and gid alex

         stop program = "/home/alex/bin/app_ctl stop" as uid alex and gid alex

        if status != 0 then restart



Monit detected my application being down but then said that Stop, start, or 
restart methods are not defined for process check app



2.      This app listens on sip port so I wanted to check for response and 
restart if it fails.

check host myhost with address "myhost"
        start program = "/home/alex/bin/app_ctl start" as uid alex and gid alex
         stop program = "/home/alex/bin/app_ctl stop" as uid alex and gid alex
if failed
               port 5060 type UDP protocol SIP
with target "myhost:5060" and maxforward 1
then restart


Monit detected my application being unresponsive but then said that "Stop, 
start, or restart methods are not defined for process check myhost"



I see that if I use check process with pid | match   action stop / start  
methods do work.   But documents are not clear on the scope of the action 
methods, at least it is not clear to me why alert, monitor, exec would work and 
stop / start / restart not in this case.  I am sure I am doing something wrong 
here but I am new to this project.



I tried using exec instead of start restart .  My app_ctl can do restart as 
well.  But I noticed that for some reason this is not very reliable as exec 
cycles through multiple restarts until the whole thing settles down.



I am doing something like





check program app with path "/home/alex/bin/app_ctl status"

        if status != 0 then exec  = "/home/alex/bin/app_ctl restart" as uid 
alex and gid alex



It seems to me that negative status is being retained in the next cycle.   It 
keeps restarting the process at least several times.  I ran exec with start 
instead of the restart and after it successfully started process on the first 
cycle it attempted to start it again which my app_ctl objected to with message



App is still running please stop it first...



Two cycles later I see the messages (running in console mode for debugging)



monit: Cannot open proc file /proc/15247/stat -- No such file or directory

system statistic error -- cannot read /proc/15247/stat

monit: Cannot open proc file /proc/15248/stat -- No such file or directory

system statistic error -- cannot read /proc/15248/stat

monit: Cannot open proc file /proc/15249/stat -- No such file or directory

system statistic error -- cannot read /proc/15249/stat


               Needless to say I have tested my app_ctl script and  running it 
from shell I can stop start and restart app without any issues.  It properly 
detects PID and status of app.

               Sorry for a long post, monit got me excited because it presented 
many interesting opportunities and has a long history.  Any help would be 
appreciated.

Alex
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to