From owner-freebsd-questions@FreeBSD.ORG Sun Nov 23 17:19:23 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47D6616A4CE for ; Sun, 23 Nov 2003 17:19:23 -0800 (PST) Received: from munk.nu (mail.munk.nu [213.152.51.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33A0C43FB1 for ; Sun, 23 Nov 2003 17:19:22 -0800 (PST) (envelope-from munk@munk.nu) Received: from munk by munk.nu with local (Exim 4.24; FreeBSD) id 1AO5Np-000PGQ-5j for freebsd-questions@FreeBSD.ORG; Mon, 24 Nov 2003 01:19:21 +0000 Date: Mon, 24 Nov 2003 01:19:21 +0000 From: Jez Hancock To: freebsd-questions@FreeBSD.ORG Message-ID: <20031124011921.GC96651@users.munk.nu> Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <3B75ECFD-1DE6-11D8-A141-000A95DBBE34@mercurycloud.net> <20031123215725.GC557@dds.nl> <98017B2C-1E17-11D8-A141-000A95DBBE34@mercurycloud.net> <20031124011139.GA60027@dds.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031124011139.GA60027@dds.nl> User-Agent: Mutt/1.4.1i Sender: User Munk Subject: Re: daemon monitoring X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2003 01:19:23 -0000 On Mon, Nov 24, 2003 at 02:11:39AM +0100, Alex de Kruijff wrote: > On Sun, Nov 23, 2003 at 04:46:09PM -0800, Will Prater wrote: > > On Nov 23, 2003, at 1:57 PM, Alex de Kruijff wrote: > > >On Sun, Nov 23, 2003 at 10:52:48AM -0800, Will Prater wrote: > > >>List, > > >> > > >>What are most of you using to monitor the running daemons? I have been > > >>loooking into DJB daemontools which seems appropriate, but are there > > >>any others that you reccomend? > > >> > > >>If DJB's daemontools is the one, could I get some more examples? I am > > >>primarily trying to keep my mail system online: postfix, cyrus, > > >>saslauthd, mysql, and spamassassin. > > > > > >I would advise Nagios. > > > > Sorry, I mispoke. I will be using Nagios to monitor, but I need to make > > sure they will restart if there is an error. Will nagios do this as > > well? > > > I don't *think* so. > > You could write a sh script (or any other) that does this. It could > contain this line: > result=px aux | grep SomeDaemon | wc -l > > If the result is zero than SomeDaemon is not running. Alternatively you could just write a script that polls a number of pid-files, one per daemon you want to monitor, and checks if the daemon is still running - if not it restarts the daemon. The gist of the script would be: - for each pid, send a CHLD signal to the pid - if the return code is 0, the process is still running so do nothing, otherwise restart the daemon I've not used daemontools too much away from djbdns suite, but presumably you could use supervise to do the work. -- Jez Hancock - System Administrator / PHP Developer http://munk.nu/