monit-general
[Top][All Lists]
Advanced

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

Re: A kludged monit/pure-ftpd setup


From: Jan-Henrik Haukeland
Subject: Re: A kludged monit/pure-ftpd setup
Date: Wed, 28 Jan 2004 21:26:28 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux)

Whit Blauvelt <address@hidden> writes:

> Problem:
>
> Pure-ftpd pid files can sometimes (rarely) just vanish, despite that the
> daemon with that pid is still running, 

Ouch, that sounds bad! 

> which causes monit to think the pure-ftpd daemon itself has failed
> (when it hasn't) and monit can't restart it (because it's still
> bound to the port, and monit doesn't have the pid to stop it
> first). 

Yep, for monit to depend on the pid-file alone may be debatable, since
we also read the /proc we could actually check for the pid there. On
the other hand depending on the pid-file makes the code easier and
after all this is also what the system does. I.e. the sys V startup
system and rc-script depends on the pid-file and if the pid-file just
vanish it is a general system problem as well. Maybe you should switch
to another ftp server :-)

> Rube Goldberg-type Partial Solution:

Here's another, maybe less drastic, solution that could be used;
Instead of checking the process, the service is checked instead. That
is, we check that pure-ftpd answers on the port 21 as it should and if
not it is started. Notice that the pid-file and process ID is not used
at all. (BTW, I noticed that you used a '&' ending the start program
statement in the previous example you sent us. You do not have to do
that, and shouldn't, because can put the process in the background and
may confuse the program that is started.)

 check host local_ftp1 with address localhost
     start program = "/usr/sbin/pure-ftpd -S xxx.xxx.xxx.xxx, 
                      -F /client/ftp/message -A -b -o -B -E -U 113:002 
                      -j --tls=1 -lextauth:/var/run/ftpd.sock" 
     stop program ="/path/to/kill.sh"
     if failed host 2xx.xxx.xxx.xxx port 21 
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           expect "220.*"
           send "USER someuser\n"
           expect "331.*"
           send "PASS somepass\n
           expect "230.*"
           expect "230.*"
           send "QUIT\n" 
           expect "221.*"
           then restart  
      alert address@hidden

There is a small visual problem with this, the monit web interface and
calling "monit status" may show that the ftp server is running while
it's not and vice-a-versa. The reason is that the monit daemon first
updates the status on each poll cycle (this in difference to a
process, which if monitored will have its status available
immediately). The bottom line is that everything will work as you
expect but that the up/down status is updated asynchronously.

-- 
Jan-Henrik Haukeland




reply via email to

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