From owner-freebsd-cluster@FreeBSD.ORG Tue Sep 23 19:59:28 2008 Return-Path: Delivered-To: freebsd-cluster@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2787D1065674 for ; Tue, 23 Sep 2008 19:59:28 +0000 (UTC) (envelope-from h8msft@gmail.com) Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by mx1.freebsd.org (Postfix) with ESMTP id D78448FC17 for ; Tue, 23 Sep 2008 19:59:27 +0000 (UTC) (envelope-from h8msft@gmail.com) Received: by gxk10 with SMTP id 10so4764697gxk.19 for ; Tue, 23 Sep 2008 12:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=2G/f4n/KWmzA/7DC8yJZHw3ggjyaMjVJLLxBLcQFt5Q=; b=LOu1/7U8dILAyREtLva7uMvBfBEELuhkI3fu2LVpIC1bC0iEwun9sOC4o/8URgxHNo mgppG6eCzD+PY/xDF5GuI83bw9az41/FDxxUuCu/tbGxA5xwd8jlxbIYG8XlYXXTcdFq LM99Gmhz6cWg2i92+vjKgxh2kQpETcfBnq5Ww= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=ECWl1d5o6it69vznoPvbNg0ErXPcGbniNxV8dXj0pSLdpfDnfPIQTj2Qc8+064ARS+ qFM7+f/9xhpclHf3l4devQCpvwi53pAqR/Exgbc4w1KO0av6N8ev5md/bk5W5jK31WRR HlI5/ozVAYDQMmNLRje3F4x0ZZ3MrlsKo3o6g= Received: by 10.100.177.15 with SMTP id z15mr4893332ane.124.1222198281889; Tue, 23 Sep 2008 12:31:21 -0700 (PDT) Received: by 10.100.107.11 with HTTP; Tue, 23 Sep 2008 12:31:21 -0700 (PDT) Message-ID: Date: Tue, 23 Sep 2008 14:31:21 -0500 From: "Bob McClure" To: freebsd-cluster@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: CARP Status X-BeenThere: freebsd-cluster@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Clustering FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2008 19:59:28 -0000 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 owner-freebsd-cluster@FreeBSD.ORG Wed Sep 24 00:04:57 2008 Return-Path: Delivered-To: freebsd-cluster@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6A221065757 for ; Wed, 24 Sep 2008 00:04:55 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 197938FC1A for ; Wed, 24 Sep 2008 00:04:54 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KiFva-00018u-AL; Wed, 24 Sep 2008 02:00:14 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 6432D3981D; Wed, 24 Sep 2008 02:00:22 +0400 (MSD) Date: Wed, 24 Sep 2008 02:00:13 +0400 From: Stanislav Sedov To: "Bob McClure" Message-Id: <20080924020013.8c1ac0ce.stas@FreeBSD.org> In-Reply-To: References: Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Wed__24_Sep_2008_02_00_13_+0400_juRTz746TEeZi9mo" Cc: freebsd-cluster@freebsd.org Subject: Re: CARP Status X-BeenThere: freebsd-cluster@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Clustering FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 00:04:57 -0000 --Signature=_Wed__24_Sep_2008_02_00_13_+0400_juRTz746TEeZi9mo Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 t= his > works, > it's kind of clunky. >=20 > Is there a better way to detect the CARP status of a server? >=20 You can try to use net/ifstated for this task.=20 --=20 Stanislav Sedov ST4096-RIPE --Signature=_Wed__24_Sep_2008_02_00_13_+0400_juRTz746TEeZi9mo Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjZZvYACgkQK/VZk+smlYE02wCdGuR7LQ1jIJoNl5BGlkZKo4vt imEAnj2oyFinU+FYIqBPolwRgkTfOlmO =Fcwp -----END PGP SIGNATURE----- --Signature=_Wed__24_Sep_2008_02_00_13_+0400_juRTz746TEeZi9mo-- From owner-freebsd-cluster@FreeBSD.ORG Wed Sep 24 16:23:04 2008 Return-Path: Delivered-To: freebsd-cluster@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F2F41065686 for ; Wed, 24 Sep 2008 16:23:04 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 079178FC16 for ; Wed, 24 Sep 2008 16:23:03 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id m8OGN1rs019568; Wed, 24 Sep 2008 18:23:02 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id m8OGN1pc019567; Wed, 24 Sep 2008 18:23:01 +0200 (CEST) (envelope-from olli) Date: Wed, 24 Sep 2008 18:23:01 +0200 (CEST) Message-Id: <200809241623.m8OGN1pc019567@lurza.secnetix.de> From: Oliver Fromme To: freebsd-cluster@FreeBSD.ORG, h8msft@gmail.com In-Reply-To: X-Newsgroups: list.freebsd-cluster User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Wed, 24 Sep 2008 18:23:02 +0200 (CEST) Cc: Subject: Re: CARP Status X-BeenThere: freebsd-cluster@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-cluster@FreeBSD.ORG, h8msft@gmail.com List-Id: Clustering FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 16:23:04 -0000 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 owner-freebsd-cluster@FreeBSD.ORG Wed Sep 24 16:56:49 2008 Return-Path: Delivered-To: freebsd-cluster@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98C701065678 for ; Wed, 24 Sep 2008 16:56:49 +0000 (UTC) (envelope-from cmarlatt@rxsec.com) Received: from core.rxsec.com (core.rxsec.com [64.132.46.102]) by mx1.freebsd.org (Postfix) with SMTP id 2BA098FC1C for ; Wed, 24 Sep 2008 16:56:49 +0000 (UTC) (envelope-from cmarlatt@rxsec.com) Received: (qmail 58724 invoked by uid 2009); 24 Sep 2008 16:20:08 -0000 Received: from 10.1.0.239 by core.rxsec.com (envelope-from , uid 2008) with qmail-scanner-1.25-st-qms (clamdscan: 0.86.2/1102. spamassassin: 3.0.4. perlscan: 1.25-st-qms. Clear:RC:0(10.1.0.239):SA:0(-4.2/5.0):. Processed in 1.830205 secs); 24 Sep 2008 16:20:08 -0000 X-Spam-Status: No, hits=-4.2 required=5.0 X-Antivirus-RXSEC-Mail-From: cmarlatt@rxsec.com via core.rxsec.com X-Antivirus-RXSEC: 1.25-st-qms (Clear:RC:0(10.1.0.239):SA:0(-4.2/5.0):. Processed in 1.830205 secs Process 58711) Received: from unknown (HELO ?10.1.0.239?) (cmarlatt@rxsec.com@10.1.0.239) by core.rxsec.com with SMTP; 24 Sep 2008 16:20:06 -0000 Message-ID: <48DA6B04.6060102@rxsec.com> Date: Wed, 24 Sep 2008 12:29:56 -0400 From: Chris Marlatt Organization: Receive Security User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Bob McClure References: In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-cluster@freebsd.org Subject: Re: CARP Status X-BeenThere: freebsd-cluster@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Clustering FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 16:56:49 -0000 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 owner-freebsd-cluster@FreeBSD.ORG Thu Sep 25 18:00:21 2008 Return-Path: Delivered-To: freebsd-cluster@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAC6A106568E for ; Thu, 25 Sep 2008 18:00:21 +0000 (UTC) (envelope-from h8msft@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by mx1.freebsd.org (Postfix) with ESMTP id 70F4C8FC37 for ; Thu, 25 Sep 2008 18:00:21 +0000 (UTC) (envelope-from h8msft@gmail.com) Received: by an-out-0708.google.com with SMTP id b33so33754ana.13 for ; Thu, 25 Sep 2008 11:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=JhDSZ21SgFYCvFcmhlSX/LkH0SfOsOhUmJXa3m+94fo=; b=FFbFbE5GFt1KIifDJodyqF2B55S2od2GkQFC8wWo7owcux3mFmjNgZg4nsb/HDemaf XAAVNm/tcEJA1mJnx7T2WR2d0HBzP3t+muMsdYF4a4SVMzGmQ8zyDxZgKOFV5V8o72hQ zeu/WdQrCzoGVuanNkzfV9POCY2hINyaF1EZk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=hIsdlOtGnuaPmu7PiaG8XjbVEQ0N8YrnQwu2nTKz4DDwVcqqLVEbGgsLt1szXid1Kl AVkCVzTf5nf32Fuz57W0L+Lb4LbCoPlm+310rDNE5Q41aX+F9TtXV4yggXfNbRPCUjpD UrgW1cng1jVGpMLjCOAjO3WmErvLFQ1v+SPEI= Received: by 10.100.166.9 with SMTP id o9mr71716ane.64.1222365616021; Thu, 25 Sep 2008 11:00:16 -0700 (PDT) Received: by 10.100.107.11 with HTTP; Thu, 25 Sep 2008 11:00:15 -0700 (PDT) Message-ID: Date: Thu, 25 Sep 2008 13:00:15 -0500 From: "Bob McClure" To: freebsd-cluster@freebsd.org, h8msft@gmail.com In-Reply-To: <200809241623.m8OGN1pc019567@lurza.secnetix.de> MIME-Version: 1.0 References: <200809241623.m8OGN1pc019567@lurza.secnetix.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: CARP Status X-BeenThere: freebsd-cluster@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Clustering FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2008 18:00:21 -0000 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 wro= te: > 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 i= s > > master is by > > periodically executing ifconfig carp1 and grepping for MASTER. Althoug= h > 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=3D2, 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=E4ftsfuehrun= g: > secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M=FC= n- > chen, HRB 125758, Gesch=E4ftsf=FChrer: Maik Bachmann, Olaf Erb, Ralf Geb= hart > > 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 >