Truong,

Are you waiting long enough for monit to detect the service outage?  The 
default checking interval is every 60 seconds, as defined in your monit.conf or 
monitrc file.

Your configuration looks correct to me, although in some cases I have had to 
add sleep statements to give the init script enough time to kill the PID.  
Something like:

   stop program = "/etc/init.d/qmail stop && sleep 15"


Additionally, on my toaster the processes don't stop gracefully using the init 
script "/etc/init.d/qmail stop".  I have to kill the children PIDs 
(muwhahahaha) manually.  You can check to see if your system responds the way 
mine does by issuing the "/etc/init.d/qmail stop" command, then wait 10-15 
seconds before issuing "/etc/init.d/qmail start".  If you get errors like 
"supervise: fatal: unable to acquire send/supervise/lock: temporary failure", 
then some of the children PIDs haven't died yet.

My monit configuration stop command looks like this

   stop program = "/etc/init.d/qmail stop && sleep 15 && kill -9 `ps auxfw | 
egrep '(imap|qmail)' | grep -v grep | awk '{print $2}'`"



Sincerely,

--
Joseph Lundgren
Systems Engineer
Peak Internet, LLC
[email protected]


-----Original Message-----
From: Truong Duc Luong [mailto:[email protected]] 
Sent: Monday, June 01, 2009 1:29 AM
To: [email protected]
Subject: RE: [qmailtoaster] Script for qmail monitoring with Monit

Thank Joseph,

Here is configuration for my qmail:

check process qmail with pidfile /var/run/qmail-svscan.pid
   group qmail
   start program = "/etc/init.d/qmail start"
   stop  program = "/etc/init.d/qmail stop"
   if failed port 25 protocol smtp then restart
   if 5 restarts within 5 cycles then timeout

Is this okay? Monit started. But if I stop qmail, monit does not start qmail as 
usual.

Anyone try monit with qmail?

From: Joseph Lundgren [mailto:[email protected]] 
Sent: Saturday, May 30, 2009 5:26 AM
To: [email protected]
Subject: RE: [qmailtoaster] Script for qmail monitoring

Truong,

I suggest using Monit.

Monit, is open-source, is in the RPMForge repository, and has an excellent 
community.  You can configure Monit to do whatever you like when it detects 
that a service is down.  It could send you an email when service outage occurs, 
or fire off a bash script, or insert a value into a database – whatever you 
want.  Monit doesn’t rely on SNMP or an agent daemon.  You can be up and 
running in (literally) minutes.


Sincerely,

--
Joseph Lundgren
Systems Engineer
Peak Internet, LLC
[email protected]

From: Truong Duc Luong [mailto:[email protected]] 
Sent: Thursday, May 28, 2009 9:29 AM
To: [email protected]
Subject: RE: [qmailtoaster] Script for qmail monitoring

Thank Dave,

Your advice is very helpful. But, I need an independent script to monitor qmail 
services. The result of that script will be input data of another application 
which control the cluster. So I think script cannot be module as in Cacti, 
OpenNMS.

Any help is appreciate.

From: Dave Hallowell [mailto:[email protected]] 
Sent: Thursday, May 28, 2009 9:20 PM
To: [email protected]
Subject: Re: [qmailtoaster] Script for qmail monitoring

Hi Truong,
may be more than what you need, but Nagios allows you to monitor any service on 
any machine and notify you when the service is down. You can get alerts via 
emails, text messages, etc. from nagios. You can set alerts when your 
filesystems reach a certain threshold. Plus a whole lot more. Nagios is not for 
the faint of heart though. Configuration can be a beast. There are other 
opensource products that do the same thing. For instance, OpenNMS or Cacti and 
there are probably many more. I would take a look at one of them.
Dave

Truong Duc Luong wrote: 
Thank Andreas,

How can I use this script without webmin? Someone want to share more about this?



-----Original Message-----
From: Andreas Galatis [mailto:[email protected]] 
Sent: Thursday, May 28, 2009 1:50 PM
To: [email protected]
Subject: Re: [qmailtoaster] Script for qmail monitoring

Hi Truong,

within webmin you have various scripts to monitor services. 
Here the first few lines:
# mailserver-monitor.pl
# Check a remote mail server by sending email at period intervals and waiting
# for a response. This depends on the remote address being an autoreponder 
that
# replies to the sending address with the same or derived subject line.


Andreas 
Am Thursday 28 May 2009 06:46:05 schrieb Truong Duc Luong:
  
Hi list,



I have just installed qmail on my server. Now I need a script to monitor
qmailtoaster services: If qmail services (SMTP, POP3, IMAP) down script
return code 1, otherwise, return code 0. The script on qmailtoaster
failover thread only check server up or down (
<http://wiki.qmailtoaster.com/index.php/QMT_Failover_replication_Setup>
http://wiki.qmailtoaster.com/index.php/QMT_Failover_replication_Setup).



Anyone can share this script or suggestion? Help me, please.



Thank you very much.
    



---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
    Vickers Consulting Group offers Qmailtoaster support and installations.
      If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
     Please visit qmailtoaster.com for the latest news, updates, and packages.
     
      To unsubscribe, e-mail: [email protected]
     For additional commands, e-mail: [email protected]



---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
    Vickers Consulting Group offers Qmailtoaster support and installations.
      If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
     Please visit qmailtoaster.com for the latest news, updates, and packages.
     
      To unsubscribe, e-mail: [email protected]
     For additional commands, e-mail: [email protected]


  
---------------------------------------------------------------------------------
 Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com) Vickers Consulting Group offers Qmailtoaster 
support and installations. If you need professional help with your setup, 
contact them today! 
---------------------------------------------------------------------------------
 Please visit qmailtoaster.com for the latest news, updates, and packages. To 
unsubscribe, e-mail: [email protected] For 
additional commands, e-mail: [email protected] 


---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
    Vickers Consulting Group offers Qmailtoaster support and installations.
      If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
     Please visit qmailtoaster.com for the latest news, updates, and packages.
     
      To unsubscribe, e-mail: [email protected]
     For additional commands, e-mail: [email protected]


Reply via email to