<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Jan-Piet Mens</title>
 <link href="http://jpmens.net/atom.xml" rel="self"/>
 <link href="http://jpmens.net" />
 <updated>2013-05-12T11:49:21+02:00</updated>
 <id>http://jpmens.net/</id>
 <author>
   <name>Jan-Piet Mens</name>
 </author>

 
 <entry>
   <title>A few notification modules for Ansible</title>
   <link href="http://jpmens.net/2013/05/08/a-few-notification-modules-for-ansible/" />
   <updated>2013-05-08T20:23:45+02:00</updated>
   <id>http://jpmens.net/2013/05/08/a-few-notification-modules-for-ansible</id>
   <content type="html">&lt;p&gt;Brian Coca recently submitted a &lt;code&gt;jabber&lt;/code&gt; module for use with &lt;a href=&quot;http://jpmens.net/2012/06/06/configuration-management-with-ansible/&quot;&gt;Ansible&lt;/a&gt;. This
module allows an Ansible playbook to connect to an &lt;a href=&quot;http://en.wikipedia.org/wiki/XMPP&quot;&gt;XMPP&lt;/a&gt; service and just push
out a message, such as &quot;all's well&quot; or &quot;I'm done&quot;, when, say, a
Playbook completes. In addition to the `mail' module (created by Dag Wieers and
heavily improved upon by yours truly :-), I thought I'd add two more.&lt;/p&gt;

&lt;p&gt;The first is a module which fires off a message to an &lt;a href=&quot;http://en.wikipedia.org/wiki/Internet_Relay_Chat&quot;&gt;IRC&lt;/a&gt; channel.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-586.png&quot; alt=&quot;irssi&quot; /&gt;&lt;/p&gt;

&lt;p&gt;That was posted to the channel by this play:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;hosts&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;all&lt;/span&gt;
  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;tasks&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;local_action&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;irc port=6669&lt;/span&gt; 
         &lt;span class=&quot;l-Scalar-Plain&quot;&gt;channel=&amp;quot;#t1&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;l-Scalar-Plain&quot;&gt;msg=&amp;quot;Server {{ ansible_hostname }} completed at {{ ansible_date_time.iso8601 }}&amp;quot;&lt;/span&gt;
         &lt;span class=&quot;l-Scalar-Plain&quot;&gt;color=green&lt;/span&gt;
         &lt;span class=&quot;l-Scalar-Plain&quot;&gt;nick=ansibleIRC&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The second (very similar) module I created works similarly, but notifies via &lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt;. MQTT is
the new hotness in the &lt;em&gt;Internet of Things&lt;/em&gt; (IoT), and &lt;a href=&quot;http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/&quot;&gt;we talked about it
here recently&lt;/a&gt;. Using this module, &lt;a href=&quot;http://jpmens.net/2012/06/06/configuration-management-with-ansible/&quot;&gt;Ansible&lt;/a&gt; can &quot;notify&quot; by publishing an
arbitrary payload to an MQTT topic.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-587.png&quot; alt=&quot;MQTT subscription&quot; /&gt;&lt;/p&gt;

&lt;p&gt;That subscription was published to by this play:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;hosts&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;all&lt;/span&gt;
  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;tasks&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;p-Indicator&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;local_action&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;l-Scalar-Plain&quot;&gt;mqtt&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;server=localhost&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;port=1883&lt;/span&gt; 
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;topic=service/ansible/{{ ansible_hostname }}&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;payload=&amp;quot;Server {{ ansible_hostname }} done at {{ ansible_date_time.iso8601 }}&amp;quot;&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;qos=0&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;retain=false&lt;/span&gt;
                  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;client_id=ans001&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;(Publishing topics to an MQTT broker would also be a neat way of watching &lt;a href=&quot;http://jpmens.net/2012/09/11/watching-ansible-at-work-callbacks/&quot;&gt;Ansible
at work with a callback&lt;/a&gt;; maybe another time.)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Live blinkenlights dashboard with SVG</title>
   <link href="http://jpmens.net/2013/04/22/live-blinkenlights-dashboard-with-svg/" />
   <updated>2013-04-22T09:56:52+02:00</updated>
   <id>http://jpmens.net/2013/04/22/live-blinkenlights-dashboard-with-svg</id>
   <content type="html">&lt;p&gt;Blinking dashboards turn me on. &lt;a href=&quot;http://jpmens.net/2006/05/24/nagios-blinkenlights-ii/&quot;&gt;Really&lt;/a&gt;. I love &lt;a href=&quot;http://jpmens.net/2012/08/23/how-much-are-those-graphics-in-the-window/&quot;&gt;seeing things move&lt;/a&gt; and blink.&lt;/p&gt;

&lt;p&gt;Andrew Hazelden's post on &lt;a href=&quot;http://www.andrewhazelden.com/blog/2011/07/monitoring-a-solar-hot-water-system-over-the-internet/&quot;&gt;monitoring a solar hot water system&lt;/a&gt; using a dashboard
created in &lt;a href=&quot;http://en.wikipedia.org/wiki/Scalable_Vector_Graphics&quot;&gt;SVG&lt;/a&gt; made a deep impression when I saw it, and I've been meaning to
experiment with that. As I've been doing things with &lt;a href=&quot;http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/&quot;&gt;MQTT&lt;/a&gt;, I thought I'd
finally give it a try, swiping bits of code created by &lt;a href=&quot;http://blog.hekkers.net/2012/10/13/realtime-data-with-mqtt-node-js-mqtt-js-and-socket-io/&quot;&gt;Robert Hekkers&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-561.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What I have is an SVG file which can be updated in real-time using &lt;a href=&quot;http://socket.io&quot;&gt;socket.io&lt;/a&gt;.
A Web browser loads an HTML resource from a Web server. A bit of JavaScript in the
page connects to a socket.io process and awaits data. On the other side, we push data
into that socket, and the JavaScript tweaks the SVG to make things do &quot;blinkenlights&quot;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/mqtt-svg-dash.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The SVG is scalable (the 'S' in SVG'), so I can zoom into it:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-562.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I drew the SVG with Inkscape, using its &quot;XML Editor&quot; to change object identifiers to
something that makes sense to me. I'll be using the second level of the MQTT topic
(e.g. &lt;code&gt;svgdash/smtp0&lt;/code&gt;) to name the SVG object.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-560.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Furthermore,
in the XML, I specify a &lt;code&gt;type&lt;/code&gt; for the object: &quot;num&quot; will be a numeric value, and &quot;slider&quot;
is a bar with a maximum width of &quot;maxw&quot;, which will be displayed to show a particular
level. The following example shows a &quot;slider&quot; for an object called &quot;smtp0&quot; (the left-most
SMTP server in the SVG). Note the &quot;maxw&quot; and &quot;type&quot; elements I added manually&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;    &lt;span class=&quot;nt&quot;&gt;&amp;lt;rect&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;fill:#e0e5de;.....&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;smtp0&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;35.75985&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;10.547414&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;x=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;213.35257&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;y=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;640.42432&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;inkscape:label=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;#rect3549&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;slider&amp;quot;&lt;/span&gt;
       &lt;span class=&quot;na&quot;&gt;maxw=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;35&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;An MQTT client publishes to a specific topic, with a &lt;a href=&quot;http://json.org&quot;&gt;JSON&lt;/a&gt; payload containing
something like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;quot;msg&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;ok&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;quot;status&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;quot;level&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4193&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The &quot;msg&quot; is a string which should probably be displayed on the SVG object. (Here
I show it on the top left.) &quot;status&quot; is a Nagios/Icinga-type status (OK, WARNING, CRITICAL).
&quot;level&quot; is used to fill objects of type &quot;slider&quot; or to post literally as text on objects
of type &quot;num&quot;. You get the idea. I hope.&lt;/p&gt;

&lt;p&gt;If I add a component to the network, I simply choose a new topic, update the SVG, refresh the Web page, and that's it. Nice. Of course, if I were half a designer/developer, I could use something like the beautiful &lt;a href=&quot;http://raphaeljs.com&quot;&gt;Raphaël&lt;/a&gt; to do this &quot;electrically&quot;.&lt;/p&gt;

&lt;p&gt;The code I have is &lt;a href=&quot;https://github.com/jpmens/mqtt-svg-dash&quot;&gt;up for grabs&lt;/a&gt;, so do feel free to improve on this. Enjoy!&lt;/p&gt;

&lt;p&gt;Update: &lt;a href=&quot;http://www.youtube.com/watch?v=HbKEFY0rQeU&amp;amp;feature=youtu.be&quot;&gt;watch the blinkenlights&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Curl test program for iOS</title>
   <link href="http://jpmens.net/2013/04/13/curl-test-program-for-ios/" />
   <updated>2013-04-13T18:36:09+02:00</updated>
   <id>http://jpmens.net/2013/04/13/curl-test-program-for-ios</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/icurlhttp/id611943891?ls=1&amp;amp;mt=8&quot;&gt;iCurlHTTP&lt;/a&gt; is a nifty little program for iOS, which will shoot off an HTTP
GET or HEAD request.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/ZZ399B0768.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Nice for testing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;via &lt;a href=&quot;https://twitter.com/bagder/status/322818687075758080&quot;&gt;Daniel Stenberg&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Managing SSH Keys for Automated Access</title>
   <link href="http://jpmens.net/2013/04/10/managing-ssh-keys-for-automated-access/" />
   <updated>2013-04-10T16:35:32+02:00</updated>
   <id>http://jpmens.net/2013/04/10/managing-ssh-keys-for-automated-access</id>
   <content type="html">&lt;p&gt;You are a UNIX/Linux administrator, and you use &lt;a href=&quot;http://www.openssh.org/&quot;&gt;SSH&lt;/a&gt;? &lt;a href=&quot;http://tools.ietf.org/html/draft-ylonen-sshkeybcp-01&quot;&gt;Print this out&lt;/a&gt;, get yourself a nice drink, make yourself comfortable, and read &lt;a href=&quot;http://tools.ietf.org/html/draft-ylonen-sshkeybcp-01&quot;&gt;Managing SSH Keys for Automated Access - Current Recommended Practice&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Do it now.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Egosurfing</title>
   <link href="http://jpmens.net/2013/03/22/egosurfing/" />
   <updated>2013-03-22T17:50:44+01:00</updated>
   <id>http://jpmens.net/2013/03/22/egosurfing</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://mens.de/:/book&quot;&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-544.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;He's talking about &lt;a href=&quot;http://mens.de/:/book&quot;&gt;this book&lt;/a&gt;. :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>JSON in BIND 9's statistics-server</title>
   <link href="http://jpmens.net/2013/03/18/json-in-bind-9-s-statistics-server/" />
   <updated>2013-03-18T09:56:27+01:00</updated>
   <id>http://jpmens.net/2013/03/18/json-in-bind-9-s-statistics-server</id>
   <content type="html">&lt;p&gt;I recently showed a customer who makes heavy use of the &lt;a href=&quot;http://www.isc.org/software/bind&quot;&gt;BIND&lt;/a&gt; name server,
that he could access BIND's statistics via the &lt;a href=&quot;http://jpmens.net/2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/&quot;&gt;statistics-server&lt;/a&gt;. We
weren't really amused when we noticed that producing the &lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt; on a server
with a lot of zones took several minutes and delivered a whopping fifty megs of
data.&lt;/p&gt;

&lt;p&gt;It occurred to me that this could be streamlined (produce less data and consume
less time) if &lt;a href=&quot;http://www.isc.org/software/bind&quot;&gt;BIND&lt;/a&gt; would output its information as &lt;a href=&quot;http://json.org&quot;&gt;JSON&lt;/a&gt;. I &lt;a href=&quot;https://lists.isc.org/pipermail/bind-users/2013-February/089769.html&quot;&gt;proposed the
idea and a patch&lt;/a&gt; and received very positive feedback from BIND users (a lot
of +1s in my inbox) and also from &lt;a href=&quot;http://www.isc.org&quot;&gt;ISC&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Evan Hunt talked to me, re-implemented my patch correctly, and added some very
good ideas. And I have some extremely good news: BIND's statistics server will
provide &lt;a href=&quot;http://json.org&quot;&gt;JSON&lt;/a&gt; (in addition to optional &lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt;) &lt;a href=&quot;https://lists.isc.org/pipermail/bind-users/2013-March/090105.html&quot;&gt;starting with BIND 9.10&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;What follows is a preview (careful! This could change until the release) of
what the JSON output looks like.&lt;/p&gt;

&lt;p&gt;The plan is to have different URIs which will provide just the information I'm
interested in. This is different to the &lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt; statistics, which are output as
one huge data set. The URIs currently implemented (in the version I've seen)
are&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;/json
/json/server
/json/zones
/json/tasks
/json/net
/json/mem
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;So, for example, the &lt;code&gt;/json&lt;/code&gt; URI will print everything:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;json-stats-version&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;boot-time&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;2013-03-18T08:53:32Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;current-time&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;2013-03-18T09:09:58Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;opcodes&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;QUERY&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;qtypes&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;nsstats&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;Requestv4&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;Response&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;QrySuccess&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;QryNoauthAns&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;QryRecursion&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;zonestats&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;SOAOutv4&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;AXFRReqv4&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;XfrFail&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;views&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;_default&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&amp;quot;zones&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;b.aa&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&amp;quot;class&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;IN&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The &lt;code&gt;/json/zones&lt;/code&gt; URI will produce the list of views and zones only:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;json-stats-version&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;boot-time&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;2013-03-18T08:53:32Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;current-time&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;2013-03-18T09:14:23Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;views&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;_default&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&amp;quot;zones&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;b.aa&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&amp;quot;class&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;IN&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;s2&quot;&gt;&amp;quot;serial&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[...]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;etc. I think this is really a useful addition to the statistics-server, because
parsing &lt;a href=&quot;http://json.org&quot;&gt;JSON&lt;/a&gt; is much faster than parsing &lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As I mentioned, this may still be a moving target, but I thought you might
want to know what's on the horizon for BIND9's statistics server.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Knot-DNS: Dynamic Updates and a bit of RRL</title>
   <link href="http://jpmens.net/2013/03/12/knot-dns-dynamic-updates-and-a-bit-of-rrl/" />
   <updated>2013-03-12T08:25:02+01:00</updated>
   <id>http://jpmens.net/2013/03/12/knot-dns-dynamic-updates-and-a-bit-of-rrl</id>
   <content type="html">&lt;p&gt;A year has passed since I &lt;a href=&quot;http://jpmens.net/2012/03/01/a-new-dns-server-knot/&quot;&gt;last looked at the Knot DNS server&lt;/a&gt;, so it's time to re-visit it;
a lot has happened, and there are two features I want to single out: support for RFC 2136 (&lt;a href=&quot;http://jpmens.net/2011/10/13/dynamically-or-not-dynamically-that-is-the-question/&quot;&gt;dynamic DNS updates&lt;/a&gt;) and a bit of RRL (Response Rate Limiting).&lt;/p&gt;

&lt;h2&gt;Dynamic DNS&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://www.knot-dns.cz/&quot;&gt;Knot&lt;/a&gt; protects Dynamic DNS Updates to master zones with &lt;a href=&quot;http://jpmens.net/2010/09/28/performing-dynamic-dns-updates-on-your-dns/&quot;&gt;TSIG keys&lt;/a&gt; I create and
copy into &lt;code&gt;knot.conf&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;...
keys {
  jpkey hmac-md5 &amp;quot;U/B55N6G9M8=&amp;quot;;
}
...
remotes {
  tiggr { address 172.16.153.1@53; key jpkey; }
  anyclient { address 0.0.0.0/0;  key jpkey; }
}
...
zones {
  example.com {
    file &amp;quot;example.com.zone&amp;quot;;
    update-in tiggr;
    zonefile-sync 5m;
  }
...
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The TSIG key (named &lt;em&gt;jpkey&lt;/em&gt; here) is associated with a &lt;em&gt;remote&lt;/em&gt; server (or update client)
and I specify the name of the &lt;em&gt;remote&lt;/em&gt; which is allowed to update a zone with the
&lt;code&gt;update-in&lt;/code&gt; (i.e. allow IN-coming updates) statement within the zone statement.&lt;/p&gt;

&lt;p&gt;Updates received to a master zone will be handled by the server and written out
to the source zone file when the &lt;code&gt;zonefile-sync&lt;/code&gt; period kicks in.  &lt;a href=&quot;http://www.knot-dns.cz/&quot;&gt;Knot&lt;/a&gt; will
forward updates received for a slave zone to the zone's primary master server,
which I specify in an &lt;code&gt;xfr-in&lt;/code&gt; directive.&lt;/p&gt;

&lt;p&gt;The server logs update requests, as follows:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;09:01:19.704047+01:00 UPDATE of &amp;#39;example.com.&amp;#39; from &amp;#39;172.16.153.1@52480&amp;#39; key &amp;#39;jpkey.&amp;#39;: Started.
09:01:19.704361+01:00 UPDATE of &amp;#39;example.com.&amp;#39; from &amp;#39;172.16.153.1@52480&amp;#39; key &amp;#39;jpkey.&amp;#39;:: Finished.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;There are currently a number of limitations regarding DNS updates on
DNSSEC-signed zones (in particular: Knot can't re-sign records), so keep an eye
on the documentation!&lt;/p&gt;

&lt;h2&gt;Response Rate Limiting&lt;/h2&gt;

&lt;p&gt;Running &lt;em&gt;dnsperf&lt;/em&gt; against my test installation (running in &lt;a href=&quot;http://jpmens.net/2013/02/04/my-portable-data-center/&quot;&gt;my portable data
center&lt;/a&gt;, so please don't pay too much attention to the actual
numbers), I obtain the following results (output abbreviated):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;  ...
  Run time limit:       30 seconds
  Ran through file:     88305 times
  Queries sent:         88305 queries
  Queries completed:    88305 queries
  Queries lost:         0 queries

  Queries per second:   2943.478807 qps

Latency   Success  Fail |
&amp;lt;    0.100s 88305     0 |############################################################
...
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;As of version 1.2.0, &lt;a href=&quot;http://www.redbarn.org/dns/ratelimits&quot;&gt;response rate limiting&lt;/a&gt; is compiled into &lt;a href=&quot;http://www.knot-dns.cz/&quot;&gt;Knot&lt;/a&gt;, but
it is disabled by default. I enable it by configuring the &lt;code&gt;rate-limit&lt;/code&gt; option
in the &lt;em&gt;system&lt;/em&gt; section, for example like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;system {
  storage &amp;quot;/etc/knot&amp;quot;;
  user: &amp;quot;root&amp;quot;;

  rate-limit 100;
  rate-limit-slip 2;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;After restarting &lt;a href=&quot;http://www.knot-dns.cz/&quot;&gt;Knot&lt;/a&gt; with RRL enabled as above, I run &lt;em&gt;dnsperf&lt;/em&gt; again to obtain
these quite different numbers:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;[Timeout] Query timed out: msg id 2042
[...]
[Timeout] Query timed out: msg id 3236

  Run time limit:       30 seconds
  Ran through file:     3236 times
  Queries sent:         3237 queries
  Queries completed:    3118 queries
  Queries lost:         119 queries

  Queries per second:   91.900425 qps

Latency   Success  Fail |
&amp;lt;    0.100s  3118     0 |############################################################
...
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Looking only at &lt;em&gt;Queries per second&lt;/em&gt; and &lt;em&gt;Queries completed&lt;/em&gt;, we see &lt;a href=&quot;http://www.knot-dns.cz/&quot;&gt;Knot&lt;/a&gt; has indeed
limited the rate of responses, and the server logs the fact that it is engaging RRL mode:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;08:23:16.774694+01:00 [notice] Address &amp;#39;172.16.153.1&amp;#39; leaves rate-limiting (class &amp;#39;POSITIVE&amp;#39;).
08:23:16.877744+01:00 [notice] Address &amp;#39;172.16.153.1&amp;#39; enters rate-limiting (class &amp;#39;POSITIVE&amp;#39;).
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Keep an eye on the &lt;a href=&quot;https://lists.nic.cz/cgi-bin/mailman/listinfo/knot-dns-users&quot;&gt;mailing list&lt;/a&gt; for more things to come.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Visualizing energy consumption with MQTT</title>
   <link href="http://jpmens.net/2013/03/10/visualizing-energy-consumption-with-mqtt/" />
   <updated>2013-03-10T18:21:39+01:00</updated>
   <id>http://jpmens.net/2013/03/10/visualizing-energy-consumption-with-mqtt</id>
   <content type="html">&lt;p&gt;The two spikes you see in the graph below were produced during lunch (a very good
Carbonara sauce on bavette) and later while making popcorn.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-525.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I've fallen for &lt;a href=&quot;http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/&quot;&gt;MQTT and Mosquitto&lt;/a&gt;, and I thought it would be practical to
grab the current electricity consumption from &lt;a href=&quot;http://jpmens.net/2012/09/02/measuring-electricity-consumption-in-a-soho/&quot;&gt;the Youless&lt;/a&gt; and hand it around
via MQTT. Unfortunately, Youless doesn't (yet) support MQTT, so I had to obtain
the current consumption it with a small Python program which polls the Youless
and PUBlishes the current value to my MQTT broker:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/env python&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;requests&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;json&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;mosquitto&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://192.168.1.9/a?f=j&amp;quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;pwr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requests&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status_code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;js&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loads&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;pwr&amp;#39;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;pwr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pwr&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pwr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pwr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;__main__&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;mqttc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mosquitto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Mosquitto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;mqttc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;hippo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1883&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pwr&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;

            &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dumps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pwr&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;mqttc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;publish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;hw/youless&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;mqttc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

            &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;energy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;ne&quot;&gt;KeyboardInterrupt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;This works well, but I wanted to graph the data (and I still haven't had the
time to properly set up &lt;a href=&quot;http://jpmens.net/2012/08/23/how-much-are-those-graphics-in-the-window/&quot;&gt;Graphite&lt;/a&gt; hereabouts, but it's coming: here a small
example to whet your appetite :-)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/jmbp-531.jpg&quot; alt=&quot;graphite preview&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://cosm.com/&quot;&gt;Cosm&lt;/a&gt;, the artist formerly know as &quot;Pachube&quot; provides a &lt;a href=&quot;https://cosm.com/docs/beta/mqtt/&quot;&gt;beta MQTT service&lt;/a&gt;
which allows me to publish data into a feed. (The Mosquitto site &lt;a href=&quot;http://mosquitto.org/2012/03/quick-start-guide-for-mqtt-with-pachube/&quot;&gt;has a good quick-start
guide&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://knolleary.net/about/&quot;&gt;Nick O’Leary&lt;/a&gt; had been there &lt;a href=&quot;http://knolleary.net/2012/06/08/bridging-mqtt-from-rsmb-to-cosm/&quot;&gt;and done that&lt;/a&gt; so I followed his recommendation
and added a bridge to Mosquitto which translates the topic name I used and bridges
that into the Cosm data-stream. This is my Mosquitto configuration:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;connection pachube_yl
address api.cosm.com:1883
clientid n001
username 000000000000000000000000000000000000000000000000
topic &amp;quot;&amp;quot; out 0 hw/youless /v2/feeds/118350/datastreams/0.csv
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;As you can see from the screen-shot above, it works like a charm. (I must say though, that
the Cosm's MQTT service has been a bit flaky from here: connections sometimes take ages
to make; at other times, the data just doesn't arrive there.)&lt;/p&gt;

&lt;p&gt;I've already contacted the guys at &lt;a href=&quot;http://www.youless.nl&quot;&gt;Youless&lt;/a&gt; to suggest it might well be worth
their while to implement optional MQTT support in their firmware. I'm keeping my
fingers crossed.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Processing BIND's XML statistics with XSL</title>
   <link href="http://jpmens.net/2013/03/01/processing-bind-s-xml-statistics-with-xsl/" />
   <updated>2013-03-01T13:37:57+01:00</updated>
   <id>http://jpmens.net/2013/03/01/processing-bind-s-xml-statistics-with-xsl</id>
   <content type="html">&lt;p&gt;When last discussing &lt;a href=&quot;http://jpmens.net/2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/&quot;&gt;using the XML produced by BIND's statistics server&lt;/a&gt;, I showed
you how I created a C program to parse the &lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt;, but it didn't occur to me to use
&lt;a href=&quot;http://en.wikipedia.org/wiki/XSL&quot;&gt;XSL&lt;/a&gt; and the &lt;em&gt;xsltproc&lt;/em&gt; utility to do so.&lt;/p&gt;

&lt;h3&gt;BIND9 old XML format&lt;/h3&gt;

&lt;p&gt;A kind reader added a comment to that post
a few moments ago, and I took the liberty of streamlining his code a bit to produce
this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:stylesheet&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:xsl=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** XSLT to parse BIND9 XML from the statistics-server (old format)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** inspired by a comment by Andrii Shynkarchuk on &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** http://jpmens.net/2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  **&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** Set the view name you&amp;#39;re interested in where it says &amp;quot;_default&amp;quot;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** (This could be accessed with an XSLT param or so.)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:output&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:strip-space&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;elements=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

  &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;match=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;isc/bind/statistics&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:apply-templates&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;views/view&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:apply-templates&amp;gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;match=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;views/view&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:choose&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:when&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;test=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;name=&amp;#39;_default&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:for-each&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;zones/zone&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;serial&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:text&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:text&amp;gt;&lt;/span&gt; 
            &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- zone name only (w/o class/view) --&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;substring-before(name, &amp;#39;/&amp;#39;)&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:text&amp;gt;&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;&amp;amp;#xa;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:text&amp;gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- newline --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:when&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:choose&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;If I run the result through &lt;em&gt;xsltproc&lt;/em&gt; on a 240MB XML file containing 136,000 zones, I get
results in 8 seconds on my laptop, which is pretty good.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;curl -qs http://172.16.153.101:8053/ |
    xsltproc bconvert.xsl -
2012011108 example.com
0 0.in-addr.arpa
0 1.0.0.127.in-addr.arpa
0 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
2011080707 example.org
97 big.aa
...
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;BIND9 newstats XML format&lt;/h3&gt;

&lt;p&gt;And this works for me for the &quot;newstats&quot; format, introduced experimentally in 9.9.3:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:stylesheet&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:xsl=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** XSLT to parse BIND9 (version3) XML from the statistics-server (new format)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** inspired by a comment by Andrii Shynkarchuk on &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** http://jpmens.net/2010/10/21/using-binds-statistics-server-to-list-zones-and-axfr-the-list/&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  **&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** Set the view name you&amp;#39;re interested in where it says &amp;quot;_default&amp;quot;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  ** (This could be accessed with an XSLT param or so.)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:output&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:strip-space&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;elements=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;match=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;statistics&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:apply-templates&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;views/view&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:apply-templates&amp;gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;match=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;views/view&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:for-each&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;zones/zone&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;serial&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:text&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:text&amp;gt;&lt;/span&gt; 
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;select=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;@name&amp;quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nt&quot;&gt;&amp;lt;xsl:text&amp;gt;&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;&amp;amp;#xa;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:text&amp;gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- newline --&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt; 
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Thank you, Andrii. :)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Lots of messages: MQTT, Pub/Sub, and the Mosquitto broker</title>
   <link href="http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/" />
   <updated>2013-02-25T11:28:37+01:00</updated>
   <id>http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern&quot;&gt;Publish/Subscribe queues&lt;/a&gt; are fun and useful. I first learned about them
when tinkering with &lt;a href=&quot;http://redis.io/&quot;&gt;Redis&lt;/a&gt; a while back.  One big drawback of &lt;a href=&quot;http://redis.io/&quot;&gt;Redis&lt;/a&gt;'
&lt;a href=&quot;http://redis.io/topics/pubsub&quot;&gt;Pub/Sub&lt;/a&gt; is that Redis project refuses to add some form of transport
layer security, which means anything and everything is transferred into and out
of Redis unencrypted.&lt;/p&gt;

&lt;p&gt;I recently discovered &lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt;, the &lt;em&gt;Message Queue Telemetry Transport protocol&lt;/em&gt;,
which is&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;is a lightweight broker-based publish/subscribe
messaging protocol designed to be open, simple, lightweight and easy to
implement.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.ibm.com/developerworks/webservices/library/ws-mqtt/index.html&quot;&gt;MQTT protocol&lt;/a&gt; provides one-to-may message distribution over
TCP/IP with a small transport overhead, and a method to notify parties of
abnormal disconnection of a client.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/mosquitto-arch.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I think of a Pub/Sub message queue as &quot;Twitter for my network&quot;. Clients subscribe
to be notified of incoming messages pertaining to specific topics, and other clients
publish on those topics. A topic (think of it as a kind of channel) classifies
messages. For example, I could have topics called &lt;code&gt;nagios/mta&lt;/code&gt;, &lt;code&gt;nagios/disk&lt;/code&gt;,
&lt;code&gt;test/jp/private&lt;/code&gt;, etc. Clients can subscribe to any number of topics, and may include
wild-cards when subscribing (e.g. &lt;code&gt;nagios/#&lt;/code&gt;).
In the context of &lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt;, messages are blobs of opaque data (UTF-8, i.e. binary
safe) with a maximum size of 256MB.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt; can be used in low-bandwidth or unreliable network environments, on embedded
devices (e.g. on an &lt;a href=&quot;http://jpmens.net/2010/05/04/aint-she-sweet-mbed/&quot;&gt;mbed&lt;/a&gt; with the &lt;a href=&quot;http://mbed.org/cookbook/mbed_Client_for_MQTT&quot;&gt;mbed MQTT library&lt;/a&gt;, on an Arduino with
&lt;a href=&quot;http://knolleary.net/arduino-client-for-mqtt/&quot;&gt;the Arduino client for MQTT&lt;/a&gt;), from &lt;a href=&quot;http://www.lua.org/&quot;&gt;Lua&lt;/a&gt;, &lt;a href=&quot;http://www.python.org/&quot;&gt;Python&lt;/a&gt;, &lt;a href=&quot;http://www.perl.org&quot;&gt;Perl&lt;/a&gt;, etc.&lt;/p&gt;

&lt;p&gt;What I find particularly interesting with this technology, is that it enables me to
employ a single (secured) transport mechanism for all sorts of data. I don't have to
pierce holes in a firewall to specifically allow this and that; a single TCP port
suffices to transport all sorts of (smallish) stuff.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; is an open source MQTT broker, which I chose over IBM's &lt;a href=&quot;https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=d5bedadd-e46f-4c97-af89-22d65ffee070&quot;&gt;RSMB&lt;/a&gt; because
source code of the latter is not freely available. &lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; is &lt;a href=&quot;http://mosquitto.org/download/&quot;&gt;easy to install and
deploy&lt;/a&gt;, and its documentation is more than adequate.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; broker supports TLS out of the box, and provides authentication either
via username/password, pre-shared keys or TLS client certificates. Furthermore, &lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt;
has a simple ACL by which the broker administrator can configure which clients may
access which topics. (Clients identify themselves by a name they specify upon connecting.)&lt;/p&gt;

&lt;p&gt;A small Python program connects to the broker and subscribes to a few topics:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/env python&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;mosquitto&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;on_message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mosq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%-20s&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%d&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;topic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;qos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;mosq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;publish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;pong&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Thanks&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;on_publish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mosq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;pass&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mosquitto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Mosquitto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;on_message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on_message&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;on_publish&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on_publish&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tls_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;root.ca&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;certfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;c1.crt&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;keyfile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;c1.key&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;hippo&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1883&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;dns/all&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;nagios/#&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;If I run that on a client, the program will sit there waiting for messages published
to the &lt;code&gt;dns/all&lt;/code&gt; or &lt;code&gt;nagios/#&lt;/code&gt; topics. In a different window, I can use the
&lt;em&gt;mosquitto_pub&lt;/em&gt; utility to fire off a message:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;mosquitto_pub -d -h hippo.ww.mens.de &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    --cafile root.ca &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    --cert c1.crt &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    --key c1.key &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    -q 0 &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;                            &lt;span class=&quot;c&quot;&gt;# quality-of-service&lt;/span&gt;
    -t nagios/n1 &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;                    &lt;span class=&quot;c&quot;&gt;# topic&lt;/span&gt;
    -m &lt;span class=&quot;s1&quot;&gt;&amp;#39;mail server 001 is broke&amp;#39;&lt;/span&gt;      &lt;span class=&quot;c&quot;&gt;# message&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Whereupon the Python program displays:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;nagios/n1 0 mail server 001 is broke
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;(You'll have noticed that the Python program publishes a &quot;Thanks&quot; on the &lt;em&gt;pong&lt;/em&gt; topic; clients
subscribed to that will receive it.)&lt;/p&gt;

&lt;p&gt;Clients can optionally set a &lt;em&gt;Will&lt;/em&gt; (in Python before the &lt;em&gt;connect()&lt;/em&gt;
call). This &quot;last will and testament&quot; (so to speak) is published by the broker when
a client disconnects unexpectedly. This can be useful to notify of particular clients'
deaths. In other words, if a client issues the following request before connecting,
and it dies at some later point, the broker will publish the payload on this client's
behalf.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;cli&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;will_set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;clients/w1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Adios!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;qos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;Bridge&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; can be configured as a so-called &quot;bridge&quot;. I could imagine this being useful in,
say, different data centers.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://jpmens.net/media/2013b/mosquitto-bridge.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In a bridge configuration, &lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; is configured to pass certain topics in certain
directions. For example, I could configure a bridge to notify a &quot;central&quot; broker
for messages of topic &lt;code&gt;#/important&lt;/code&gt;. A bridge connects to a broker like any other
client and subscribes to topics which are then &quot;imported&quot; into the bridge; clients connected
to said bridge can thus be notified for particular subscriptions from the &quot;main&quot; broker.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; periodically publishes statistics which interested parties can subscribe to, e.g.
for monitoring purposes.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;text&quot;&gt;$SYS/broker/version mosquitto version 1.1
$SYS/broker/clients/total 368
$SYS/broker/clients/active 91
$SYS/broker/clients/inactive 277
$SYS/broker/clients/maximum 368
$SYS/broker/messages/received 13358099
$SYS/broker/messages/sent 16381123
$SYS/broker/messages/dropped 414180
$SYS/broker/messages/stored 10806
$SYS/broker/messages/sent 16381123
$SYS/broker/messages/sent 16381123
$SYS/broker/bytes/received 761223497
$SYS/broker/bytes/sent 476065843
$SYS/broker/load/bytes/sent/1min 28745.93
$SYS/broker/load/bytes/sent/5min 15418.24
$SYS/broker/load/bytes/sent/15min 6980.69
[...]
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The Mosquitto project has a &lt;a href=&quot;http://test.mosquitto.org&quot;&gt;test server&lt;/a&gt; you can use if you don't want
to set up your own (just launch &lt;em&gt;mosquitto_sub&lt;/em&gt; at it), and there's a nice-looking
Web-based interface you can use (on your public &lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt; server) at &lt;a href=&quot;http://mqtt.io&quot;&gt;http://mqtt.io&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Wishlist&lt;/h3&gt;

&lt;p&gt;There are a couple of things which would be neat to see implemented:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.nagios.org/&quot;&gt;Nagios&lt;/a&gt; and &lt;a href=&quot;https://www.icinga.org/&quot;&gt;Icinga&lt;/a&gt; typically &quot;go out&quot; and get statii of services, unless I
configure them to accept passive checks. How about a plugin or component for
&lt;a href=&quot;http://www.nagios.org/&quot;&gt;Nagios&lt;/a&gt; and &lt;a href=&quot;https://www.icinga.org/&quot;&gt;Icinga&lt;/a&gt; which subscribes to specific topics? That would allow
for blindingly fast notification of problems within the network, without having
to await a check interval? (It's been a while since I did something with these
monitoring processes, so this may be stupid, but it sounds good to me ...)
A notification could be wrapped into a JSON object containing a
Nagios exit code and the reason.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jpmens.net/2012/08/06/my-logstash-and-graylog2-notes/&quot;&gt;Logstash&lt;/a&gt; should support &lt;a href=&quot;http://mqtt.org&quot;&gt;MQTT&lt;/a&gt; as an input filter. That would allow me to
use this message broker for shipping logs. (Logstash already supports &lt;em&gt;AMQP&lt;/em&gt;
and &lt;a href=&quot;http://www.zeromq.org/&quot;&gt;ZeroMQ&lt;/a&gt;.) On the other hand, I could easily create a &lt;a href=&quot;http://mosquitto.org&quot;&gt;Mosquitto&lt;/a&gt; to &lt;a href=&quot;http://redis.io/&quot;&gt;Redis&lt;/a&gt;
&quot;converter&quot;, and use &lt;a href=&quot;http://redis.io/&quot;&gt;Redis&lt;/a&gt; as input to Logstash.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Does anybody feel like doing that? :-)&lt;/p&gt;

&lt;h3&gt;Further reading:&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://blogs.vmware.com/vfabric/2013/02/choosing-your-messaging-protocol-amqp-mqtt-or-stomp.html&quot;&gt;Choosing your messaging protocol: AMQP, MQTT, or STOMP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.jupo.org/2013/02/23/a-tale-of-two-queues/&quot;&gt;Performance of Redis and ZeroMQ compared&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://knolleary.net/2012/04/11/queuing-with-mqtt/&quot;&gt;Workload distribution with MQTT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://lists.oasis-open.org/archives/amqp/201202/msg00086/StormMQ_WhitePaper_-_A_Comparison_of_AMQP_and_MQTT.pdf&quot;&gt;A comparison of AMQP and MQTT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://justinribeiro.com/chronicle/2012/11/08/securing-mqtt-communication-between-ardruino-and-mosquitto/&quot;&gt;Securing MQTT communication between Ardruino and Mosquitto&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.redbooks.ibm.com/redpapers/pdfs/redp4929.pdf&quot;&gt;MQTT and Arduino Devices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mqtt.org/software&quot;&gt;Software: Servers/brokers, Client APIs, Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jpmens.net/2013/03/10/visualizing-energy-consumption-with-mqtt/&quot;&gt;Visualizing energy consumption with MQTT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jpmens.net/2013/04/22/live-blinkenlights-dashboard-with-svg/&quot;&gt;Live blinkenlights dashboard with SVG&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 
</feed>
