monit-general
[Top][All Lists]
Advanced

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

Re: Apache will not start/stop with Monit, unless..


From: Martin Pala
Subject: Re: Apache will not start/stop with Monit, unless..
Date: Sun, 17 Jul 2011 20:47:23 +0200

Monit sets spartan environment wen execution the program (for security 
reasons). It is likely your apache startup script depends on some environment 
variable which is not set by monit.

You can log the start/stop script output by wrapping it for example like this:

start program = "/bin/bash -c '/etc/init.d/httpd start' > /tmp/httpd_start.out 
2>&1'"

Regards,
Martin


On Jul 17, 2011, at 6:23 PM, Brian Layman wrote:

> So I am trying to get monit to work correctly for a client.
> 
> When I have the start stop actions set up like
>        start = "/etc/init.d/httpd start"
>        stop = "/etc/init.d/httpd stop"
> or
>        start program = "/etc/init.d/httpd start"
>        stop program = "/etc/init.d/httpd stop"
> 
> It cannot stop or start the httpd process.
> 
> I get results like:
> Monitoring disabled -- service apache
> 'apache' stop: /etc/init.d/httpd
> monit daemon at 2425 awakened
> 'apache' failed to stop
> -------------------------------------------------------------------------------
>    monit [0x805442e]
>    monit(LogError+0x22) [0x8054842]
>    monit(Event_post+0x382) [0x8051f22]
>    monit [0x804fb8f]
>    monit(control_service+0x10c) [0x804ff6c]
>    monit [0x8066098]
>    monit(validate+0x78) [0x8066188]
>    monit [0x80567aa]
>    monit(main+0x55f) [0x805710f]
>    /lib/libc.so.6(__libc_start_main+0xdc) [0x3ace9c]
>    monit [0x804ee51]
> -------------------------------------------------------------------------------
> Execution failed notification is sent to ...
> 
> To debug I added an intermediary script to do some logging and of course as 
> all debugging actions do, its mere presence solved the problem.
> Here is my current start stop:
>        start = "/root/startapache"
>        stop = "/root/stopapache"
> 
> Here are the contents:
> address@hidden cat /root/startapache
> #!/bin/sh
> echo "/root/startapache called" >>/root/httpds.log
> /etc/init.d/httpd start
> address@hidden cat /root/stopapache
> #!/bin/sh
> echo "/root/stopapache called" >>/root/httpds.log
> /etc/init.d/httpd stop
> address@hidden
> 
> 
> What does this indicate?  I'm stopped right here in the configuration and 
> roll out because if it doesn't work for apache, how likely is it to work for 
> any other service like named which is setup the same way.
> 
> One thing that bothered me when I ran monit -Iv is that it gives the result:
> 'apache' stop: /etc/init.d/httpd
> 
> Shouldn't that be:
> 'apache' stop: /etc/init.d/httpd stop
> 
> HELP! thanks!
> --
> Brian Layman
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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