From h8msft at gmail.com Tue Sep 23 19:59:28 2008 From: h8msft at gmail.com (Bob McClure) Date: Tue Sep 23 19:59:54 2008 Subject: CARP Status Message-ID: 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? Thanks in advance. Bob McClure From stas at FreeBSD.org Wed Sep 24 00:04:57 2008 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Sep 24 00:05:01 2008 Subject: CARP Status In-Reply-To: References: Message-ID: <20080924020013.8c1ac0ce.stas@FreeBSD.org> On Tue, 23 Sep 2008 14:31:21 -0500 "Bob McClure" mentioned: > 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? > You can try to use net/ifstated for this task. -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-cluster/attachments/20080924/e0e08a97/attachment.pgp From olli at lurza.secnetix.de Wed Sep 24 16:23:04 2008 From: olli at lurza.secnetix.de (Oliver Fromme) Date: Wed Sep 24 16:23:10 2008 Subject: CARP Status In-Reply-To: Message-ID: <200809241623.m8OGN1pc019567@lurza.secnetix.de> 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 From cmarlatt at rxsec.com Wed Sep 24 16:56:49 2008 From: cmarlatt at rxsec.com (Chris Marlatt) Date: Wed Sep 24 16:56:55 2008 Subject: CARP Status In-Reply-To: References: Message-ID: <48DA6B04.6060102@rxsec.com> 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? > > Thanks in advance. > > Bob McClure > _______________________________________________ If you don't mind recompiling net-snmp there are mibs which can be found here: http://www.packetmischief.ca/openbsd/snmp/ They work fine with FreeBSD. Regards, Chris From h8msft at gmail.com Thu Sep 25 18:00:21 2008 From: h8msft at gmail.com (Bob McClure) Date: Thu Sep 25 18:00:28 2008 Subject: CARP Status In-Reply-To: <200809241623.m8OGN1pc019567@lurza.secnetix.de> References: <200809241623.m8OGN1pc019567@lurza.secnetix.de> Message-ID: Thanks to all for your input. With this many options on the table, I'm sure one of them will meet my needs. Thanks boB On Wed, Sep 24, 2008 at 11:23 AM, Oliver Fromme wrote: > 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 >