The configuration is correct - to check the configuration you can use the -t 
option:

$ monit -t
Control file syntax OK

Monit runs in poll cycles (driven by "set daemon <seconds>" statement)  ... 
maybe you have long poll cycle so the test was not performed fast enough? For 
example to check every 5 seconds:

set daemon 5

As mentioned, the verbose mode (-v) will show you when every particular test is 
performed so you can see what monit actually does.



On Jul 15, 2011, at 12:49 PM, Govind wrote:

> Hi Martin,
> 
> Sorry for not being clear.
> 
> 1. First I had this config which did not work 
> check process dpm with pidfile /var/run/dpm.pid
> group root
> start program = "/etc/init.d/dpm start"
> stop program = "/etc/init.d/dpm stop"
> if 5 restarts within 5 cycles then timeout
> Further check shows , that  pid file was exist due to segfault, no  dpm 
> process was running, 5015 port  was not open
> 
> 2. Then i tried adding the port config like one of below as one of below and 
> restarted monit, but it did not worked
> if failed port 5015 then restart 
> OR
> if failed port 5015 type tcp then restart
> 
> There is nothing in monit log except monit restated.
> 
> Finally I restated it manually, will run monit in verbose mode next time. Is 
> there any option like run it in dry-run mode to verify the config.
> 
> Thinking to use "check process dpm matching" syntax instead of pidfile.
> 
> Thanks
> Govind
> 
> On Fri, Jul 15, 2011 at 11:25 AM, Martin Pala <[email protected]> wrote:
> Hi,
> 
> please can you provide more details - what exactly doesn't work? The port 
> test is OK - when it won't accept connection, Monit will restart the service. 
> In the case that the program crashed without cleaning the pidfile as you 
> mentioned, it is no problem - the pidfile will contain PID for which no 
> process exists => it will restart the process.
> 
> Please check Monit logs - it is likely that when the process crashed, Monit 
> restarted it and thus the port test passed. You can also run Monit in verbose 
> mode with the -v option to see the details.
> 
> Martin
> 
> 
> On Jul 15, 2011, at 11:48 AM, Govind wrote:
> 
>> Hi,
>> 
>> I configured a service like this
>> 
>> check process dpm with pidfile /var/run/dpm.pid
>> group root
>> start program = "/etc/init.d/dpm start"
>> stop program = "/etc/init.d/dpm stop"
>> if 5 restarts within 5 cycles then timeout
>> 
>> I had segfault, which did not clean up the PID file, so i try checking for 
>> port like this
>> if failed port 5015 then restart 
>> OR
>> if failed port 5015 type tcp then restart
>> 
>> But none of them work, 
>> the dpm service run as
>> # netstat -tupln|grep dpm
>> tcp        0      0 0.0.0.0:5015                0.0.0.0:*                   
>> LISTEN      8628/dpm        
>> 
>> Can  you please advise, if there was anything wrong in above syntax of port 
>> checking.
>> 
>> Thanks
>> Govind
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

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

Reply via email to