[Top][All Lists]

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

Re: Restart issue with HTTPD & SSHD

From: Martin Pala
Subject: Re: Restart issue with HTTPD & SSHD
Date: Wed, 7 Dec 2011 20:58:47 +0100

The restart is just sequence of stop and start programs called by monit. If the stop and start works, the restart should work too.

The /tmp/httpd.output will be created when the start/stop program provide some output. Are you sure you did "monit reload" after the configuration was changed? (the new configuration won't apply until monit is either reloaded or restarted).


On Dec 7, 2011, at 3:29 PM, Harish Chouhan wrote:

Hello Martin,
I have changed my code with what you sent:
start program = "/bin/bash -c '/etc/init.d/httpd start >>/tmp/httpd.output 2>&1'"
Now the Start & Stop work well. However restart does not work. I don’t think I would need the restart option, but I just want to things to be right. So would appreciate your help.
When I click on the restart button, the status changes to “Execution Failed”.  Same issue when I click restart button on the SSH process. Also can you let me know how to access the log file /tmp/httpd.output? I found no such file on my server.
Awaiting your reply!
Harish Chouhan
Visit me at - 
Phone: +91-9833661410 | Email: address@hidden | address@hidden 
From: Martin Pala [mailto:address@hidden 
Sent: 07 December 2011 14:02 PM
To: address@hidden; This is the general mailing list for monit
Subject: Re: Restart issue with HTTPD & SSHD
it is possible the start/stop program failed because of some missing environment variable - monit purges the environment when executing the program for security reasons and sets only basic PATH variable. Monit doesn't log the output from the start/stop script by default, you can capture the output by wrapping the program like this:
    start program = "/bin/bash -c '/etc/init.d/httpd start >>/tmp/httpd.output 2>&1'"
On Dec 3, 2011, at 1:42 PM, Harish Chouhan wrote:

I have installed monit and everything is running great, except httpd and sshd. My monitoring code is as below. The monitoring starts well when I start Monit for the first time. However if I restart or stop this from the web based control of Monit, I get “Execution failed” message.
## HTTPD monit config
check process apache with pidfile /usr/local/apache/logs/
group apache

start program = "/etc/init.d/httpd start"

stop program  = "/etc/init.d/httpd -k stop"


if failed host localhost port 80 protocol http then alert

if failed host localhost port 80 protocol http then restart

if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if children > 250 then restart
## SSHD monit config
check process sshd with pidfile /var/run/
start program  "/etc/init.d/sshd start"
stop program  "/etc/init.d/sshd stop"
if failed port 2511 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
My log files also do not give clear details about this error.
[IST Dec  3 18:11:05] info     : 'apache' trying to restart
[IST Dec  3 18:11:05] info     : 'apache' stop: /etc/init.d/httpd
Can anyone else?

reply via email to

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