Hi Charles,<br><br><div class="gmail_quote">2011/4/19 Charles Lepple <span dir="ltr">&lt;<a href="mailto:clepple@gmail.com">clepple@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Apr 19, 2011, at 7:44 AM, Arnaud Quette wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Author: aquette<br>
Date: Tue Apr 19 11:43:46 2011<br>
New Revision: 2974<br>
URL: <a href="http://trac.networkupstools.org/projects/nut/changeset/2974" target="_blank">http://trac.networkupstools.org/projects/nut/changeset/2974</a><br>
<br>
</blockquote>
...<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
+void scan_nut_avahi()<br>
+{<br>
+       printf(&quot;Scanning NUT bus (DNS-SD method):\n&quot;);<br>
+<br>
+       /* Check avahi-browse code:<br>
+        * <a href="http://git.0pointer.de/?p=avahi.git;a=tree;f=avahi-utils;h=5655a104964258e7be32ada78794f73beb84e0dd;hb=HEAD" target="_blank">http://git.0pointer.de/?p=avahi.git;a=tree;f=avahi-utils;h=5655a104964258e7be32ada78794f73beb84e0dd;hb=HEAD</a><br>

+        *<br>
+        * Example service publication (counterpart of the above):<br>
+        * $ avahi-publish -s nut _upsd._tcp 3493 txtvers=1 protovers=1.0.0 type=standalone<br>
+        */<br>
+}<br>
</blockquote>
<br>
Just some thoughts:<br>
<br>
It&#39;s been a while since I last looked at the DNS-SD spec, but we might want to use either &quot;_nut._tcp&quot; (following the IANA reserved port name) or &quot;_nut_upsd._tcp&quot; because there is at least one other &quot;upsd&quot; in Debian alone.<br>
</blockquote><div><br>indeed. this is part of the things that need more reflexion.<br>for the time being, it&#39;s still an early proof-of-concept, but the &quot;nut Vs upsd&quot; notion is already in the pipe.<br>what still puzzles me is that &quot;_upsd._tcp&quot; is used as Service Type.<br>
while &quot;nut&quot; is used as the Service Name.<br>(instant update) I&#39;ve just made a quick test with Frédéric, and the &quot;nut&quot; name *must* be unique: each system that publish a nut service availability has to have a unique Service Name!<br>
<br>this is something I&#39;ll be discussing with Ubuntu folks at the next UDS (since they are (ab)using avahi for cloud deployment).<br>in the meantime, feedback / comments / ideas are very welcome.<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

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.<br>
</blockquote><div><br>indeed. The show stopper here is that I want to publish the service availability *only* if MODE is different that &quot;none&quot; (so if nut is actually running).<br>and I&#39;m not yet sure if we can put condition on the publication through xml (I don&#39;t think so), while the initscript modification would be limited to executing the above &quot;avahi-publish&quot; line with &quot;type=$MODE&quot;<br>
<br>Note that I&#39;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.<br><br></div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
If you don&#39;t want to pull all of the Avahi library code into the scanner, many systems have the &quot;avahi-browse&quot; command-line tool.<br>
</blockquote></div><br>yup, this is what I used during the very first stage:<br>$ avahi-browse _upsd._tcp<br><br>As you can see, this is still a WIP...<br><br clear="all">thanks a lot for your comments Charles, and don&#39;t hesitate to bounce on the above...<br>
<br>cheers,<br>Arnaud<br>-- <br>Linux / Unix Expert R&amp;D - Eaton - <a href="http://powerquality.eaton.com" target="_blank">http://powerquality.eaton.com</a><br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org/" target="_blank">http://www.networkupstools.org/</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.free.fr/" target="_blank">http://arnaud.quette.free.fr/</a><br><br>