On Thu, Jun 24, 2010 at 9:48 PM, Martin Pala <[email protected]> wrote:

> The pidof shows pid of all matching processes - in case of apache there is
> one master httpd process (parent) which spawns number of child processes to
> handle particular requests - if apache is stopping it may take a while
> before they handle all pending requests and stop.
>

I know, obviously.



> Since the pidfile doesn't exist i suppose apache is not running on your
> machine and only some child processes remain active (stopping) ... their
> parent pid will be most probably "1" (their original parent exited). You can
> verify apache's status for example using 'apachectl status' and also by
> trying to connect to the http service which should fail.
>

What a pity, you're wrong. I checked it before posting:

# ps -ef | grep httpd
root     21422     1  0 12:49 ?        00:00:00 /usr/sbin/httpd
apache   21424 21422  0 12:49 ?        00:01:29 /usr/sbin/httpd
apache   21425 21422  0 12:49 ?        00:02:01 /usr/sbin/httpd
apache   21426 21422  0 12:49 ?        00:01:46 /usr/sbin/httpd
apache   21427 21422  0 12:49 ?        00:03:33 /usr/sbin/httpd
apache   21428 21422  0 12:49 ?        00:02:01 /usr/sbin/httpd
apache   21429 21422  0 12:49 ?        00:01:49 /usr/sbin/httpd
apache   21431 21422  0 12:49 ?        00:02:45 /usr/sbin/httpd
apache   21432 21422  0 12:49 ?        00:00:58 /usr/sbin/httpd
apache   21443 21422  0 12:50 ?        00:02:22 /usr/sbin/httpd
apache   21444 21422  0 12:50 ?        00:01:32 /usr/sbin/httpd
apache   21445 21422  0 12:50 ?        00:01:35 /usr/sbin/httpd

and I can connect to my web page normally.

>
> If despite missing pidfile apache is running and serving requests, then you
> have some problem with apache's startup script.
>

Until now, I have no problem.


>
> Note that monit runs the script in "sandbox" and purges environment
> variables when starting the script (for security reasons). If you apache's
> startup depends on some variable, you will need to modify the start script
> to include it (apache usually uses "envvars" file which is should contain
> variables required for apache).
>
> I use the Apache's default config file and it works fine when restart from
command line.

>
> On Jun 24, 2010, at 4:09 PM, Tong Anh Quan wrote:
>
> Yes, it is. But there is no pidfile in /var/run, as I mentioned above:
>
> # pidof httpd
> 21445 21444 21443 21432 21431 21429 21428 21427 21426 21425 21424 21422
>
> # ls /var/run/ | grep httpd
> # ls /var/run/*.pid
> /var/run/atd.pid     /var/run/haldaemon.pid   /var/run/monit.pid
> /var/run/sm-client.pid  /var/run/vmware-guestd.pid
> /var/run/auditd.pid  /var/run/iscsid.pid      /var/run/pcscd.pid
> /var/run/snmpd.pid      /var/run/xinetd.pid
> /var/run/crond.pid   /var/run/klogd.pid       /var/run/proftpd.pid
> /var/run/sshd.pid
> /var/run/gpm.pid     /var/run/messagebus.pid  /var/run/sendmail.pid
> /var/run/syslogd.pid
>
>
> On Thu, Jun 24, 2010 at 7:57 PM, Martin Pala <[email protected]>wrote:
>
>> OK.
>>
>> Is the apache running then after monit start? If so, is the pidfile
>> updated with correct pid?
>>
>>
>> On Jun 24, 2010, at 2:55 PM, Tong Anh Quan wrote:
>>
>> I am sure about the pidfile location because of I am using CentOS.
>> Moreover, I re-checked it in init script:
>>
>> # grep pidfile /etc/init.d/httpd
>> # pidfile: /var/run/httpd.pid
>>
>> On Thu, Jun 24, 2010 at 5:17 PM, Martin Pala <[email protected]>wrote:
>>
>>> The pidfile should be created either by the start script or started
>>> program itself (in this case apache).
>>>
>>> Are you sure that your apache instance creates the pidfile
>>> /var/run/httpd.pid? The pidfile location depends on apache configuration
>>> (for example ubuntu uses usually /var/run/apache2.pid which can be
>>> customized either via apache2.conf PidFile statement or apache's envvars
>>> file APACHE_PID_FILE variable)
>>>
>>>
>>> On Jun 24, 2010, at 11:49 AM, Tong Anh Quan wrote:
>>>
>>> > Hi,
>>> >
>>> > Have you solved this problem? Today, the same thing happen to me. My
>>> monit.conf:
>>> >
>>> >   check process apache with pidfile /var/run/httpd.pid
>>> >     start program = "/etc/init.d/httpd start"
>>> >     stop program  = "/etc/init.d/httpd stop"
>>> >     if cpu > 60% for 2 cycles then alert
>>> >     if cpu > 80% for 5 cycles then restart
>>> >     if totalmem > 600.0 MB for 5 cycles then restart
>>> >
>>> > When the Apache reach the threshold, monit attempts to restart Apache
>>> without pid file, therefore it thinks Apache fails to start:
>>> >
>>> > [ICT Jun 24 12:50:19] error    : 'apache' total mem amount of 647948kB
>>> matches resource limit [total mem amount>614402kB]
>>> > [ICT Jun 24 12:50:20] info     : 'apache' trying to restart
>>> > [ICT Jun 24 12:50:20] info     : 'apache' stop: /etc/init.d/httpd
>>> > [ICT Jun 24 12:50:21] info     : 'apache' start: /etc/init.d/httpd
>>> > [ICT Jun 24 12:51:20] error    : 'apache' process is not running
>>> > [ICT Jun 24 12:51:20] error    : 'apache' failed to start
>>> >
>>> > `pidof httpd` still return the parent and child's PID but there is no
>>> httpd.pid in /var/run.
>>> > Additional:
>>> > - monit start with root user
>>> > - there is no error in Apache log
>>> >
>>> > Can anyone help me to debug this case? Thanks in advance.
>>> >
>>> >
>>> > --
>>> > --- Hạnh phúc là một ly Cafe và nhạc Trịnh ---
>>> > --
>>> > To unsubscribe:
>>> > http://lists.nongnu.org/mailman/listinfo/monit-general
>>>
>>>
>>> --
>>> To unsubscribe:
>>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>>
>>
>>
>>
>> --
>> --- Hạnh phúc là một ly Cafe và nhạc Trịnh ---
>> --
>> To unsubscribe:
>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>>
>> --
>> To unsubscribe:
>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>
>
>
>
> --
> --- Hạnh phúc là một ly Cafe và nhạc Trịnh ---
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
>
>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
>



-- 
--- Hạnh phúc là một ly Cafe và nhạc Trịnh ---
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to