CARP Status
Oliver Fromme
olli at lurza.secnetix.de
Wed Sep 24 16:23:04 UTC 2008
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
More information about the freebsd-cluster
mailing list