Charles Lepple
2011-Apr-19 13:13 UTC
[Nut-upsdev] DNS-SD (was Re: [nut-commits] svn commit r2974 - branches/nut-scanner/tools/nut-scanner)
On Apr 19, 2011, at 7:44 AM, Arnaud Quette wrote:> Author: aquette > Date: Tue Apr 19 11:43:46 2011 > New Revision: 2974 > URL: http://trac.networkupstools.org/projects/nut/changeset/2974 >...> +void scan_nut_avahi() > +{ > + printf("Scanning NUT bus (DNS-SD method):\n"); > + > + /* Check avahi-browse code: > + * http://git.0pointer.de/?p=avahi.git;a=tree;f=avahi-utils;h=5655a104964258e7be32ada78794f73beb84e0dd;hb=HEAD > + * > + * Example service publication (counterpart of the above): > + * $ avahi-publish -s nut _upsd._tcp 3493 txtvers=1 > protovers=1.0.0 type=standalone > + */ > +}Just some thoughts: It's been a while since I last looked at the DNS-SD spec, but we might want to use either "_nut._tcp" (following the IANA reserved port name) or "_nut_upsd._tcp" because there is at least one other "upsd" in Debian alone. Also, there are XML files that we can create in the Avahi configuration directory to publish that information. This might be easier than adding avahi-publish to all of the various startup script types that distributions have these days. If you don't want to pull all of the Avahi library code into the scanner, many systems have the "avahi-browse" command-line tool.
Arnaud Quette
2011-Apr-19 14:26 UTC
[Nut-upsdev] DNS-SD (was Re: [nut-commits] svn commit r2974 - branches/nut-scanner/tools/nut-scanner)
Hi Charles, 2011/4/19 Charles Lepple <clepple at gmail.com>> On Apr 19, 2011, at 7:44 AM, Arnaud Quette wrote: > > Author: aquette >> Date: Tue Apr 19 11:43:46 2011 >> New Revision: 2974 >> URL: http://trac.networkupstools.org/projects/nut/changeset/2974 >> >> ... > >> +void scan_nut_avahi() >> +{ >> + printf("Scanning NUT bus (DNS-SD method):\n"); >> + >> + /* Check avahi-browse code: >> + * >> http://git.0pointer.de/?p=avahi.git;a=tree;f=avahi-utils;h=5655a104964258e7be32ada78794f73beb84e0dd;hb=HEAD >> + * >> + * Example service publication (counterpart of the above): >> + * $ avahi-publish -s nut _upsd._tcp 3493 txtvers=1 >> protovers=1.0.0 type=standalone >> + */ >> +} >> > > Just some thoughts: > > It's been a while since I last looked at the DNS-SD spec, but we might want > to use either "_nut._tcp" (following the IANA reserved port name) or > "_nut_upsd._tcp" because there is at least one other "upsd" in Debian alone. >indeed. this is part of the things that need more reflexion. for the time being, it's still an early proof-of-concept, but the "nut Vs upsd" notion is already in the pipe. what still puzzles me is that "_upsd._tcp" is used as Service Type. while "nut" is used as the Service Name. (instant update) I've just made a quick test with Fr?d?ric, and the "nut" name *must* be unique: each system that publish a nut service availability has to have a unique Service Name! this is something I'll be discussing with Ubuntu folks at the next UDS (since they are (ab)using avahi for cloud deployment). in the meantime, feedback / comments / ideas are very welcome. Also, there are XML files that we can create in the Avahi configuration> directory to publish that information. This might be easier than adding > avahi-publish to all of the various startup script types that distributions > have these days. >indeed. The show stopper here is that I want to publish the service availability *only* if MODE is different that "none" (so if nut is actually running). and I'm not yet sure if we can put condition on the publication through xml (I don't think so), while the initscript modification would be limited to executing the above "avahi-publish" line with "type=$MODE" Note that I'm still unsure on this too, since publishing unconfigured NUT may be a use case in infrastructure: Augeas and Puppet will allow remote configuration, which is in favor of the XML publication. If you don't want to pull all of the Avahi library code into the scanner,> many systems have the "avahi-browse" command-line tool. >yup, this is what I used during the very first stage: $ avahi-browse _upsd._tcp As you can see, this is still a WIP... thanks a lot for your comments Charles, and don't hesitate to bounce on the above... cheers, Arnaud -- Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/ Debian Developer - http://www.debian.org Free Software Developer - http://arnaud.quette.free.fr/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20110419/566b4c4b/attachment.htm>