Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2008 18:23:01 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-cluster@FreeBSD.ORG, h8msft@gmail.com
Subject:   Re: CARP Status
Message-ID:  <200809241623.m8OGN1pc019567@lurza.secnetix.de>
In-Reply-To: <dd2bb6b50809231231x78d706c2hd5b8958fc402d2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Bob McClure <> wrote:
 > I have several servers running CARP in an active/passive configuration.
 > Currently the only way that my scripts can determine if a given node is
 > master is by
 > periodically executing ifconfig carp1 and grepping for MASTER. Although this
 > works,
 > it's kind of clunky.
 > 
 > Is there a better way to detect the CARP status of a server?

If you set sysctl net.inet.carp.log=2, you'll get a log
entry every time the interface state changes.  You can
configure a handler (e.g. a script) in /etc/syslog.conf
that responds to such events.

If you're a C programmer, you can also use the kqueue(2)
API with EVFILT_NETDEV.  Then you will get a notification
each time an interface link goes down or comes up.  See
the kqueue(2) manual page for details.

Finally, a third possibility is to use devd(8).  See the
devd.conf(4) manual page for details.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Python is an experiment in how much freedom programmers need.
Too much freedom and nobody can read another's code; too little
and expressiveness is endangered."
        -- Guido van Rossum



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809241623.m8OGN1pc019567>