Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Talking to Printers, Routers and IP phones - Io...

Talking to Printers, Routers and IP phones - IoT with SNMP

Presented at the London Internet of Things Meetup #7 on April 2012

Alexander Baxevanis

April 19, 2012
Tweet

More Decks by Alexander Baxevanis

Other Decks in Technology

Transcript

  1. IoT SNMP Talking to Printers, Routers and IP phones Alexander

    Baxevanis (@futureshape) Senior UX Consultant, Webcredible Internet of Things Meetup #7 - London,UK Hello everyone, and thanks a lot for coming tonight. This is my first time here, and I’ve jumped right in and volunteered to talk. My name is Alex, I have a day job as a user experience designer, but I started long time ago as an engineer and I haven’t quite put that hat down. In short, I like to grasp any available opportunity for building stuff. So let’s start with a story about how I got to build one of my recent project. In our office, we’ve got this silly old printer ...
  2. We call it the Black & White printer No 1,

    I guess because it prints in B&W, and it was the first B&W printer that got to be installed, although the 2nd one doesn’t exist any more. I say it’s a silly old printer, but it’s actually quite useful. We load it with scrap paper that’s already printed on one side, and get it to print on the other side, and save some trees, or whatever paper is made out of nowadays. The only problem with this printer is that, partly because it’s old and partly because we feed all sorts of scrap paper into it, is that it tends to jam a lot.
  3. http://www.flickr.com/photos/stitch/16827474/ And when it jams, or runs out of paper

    for that matter, there’s one thing that always happens. You send a printout, forget about it for a while, then you need to pick it up quickly, on a way to a client meeting for example, and you realise the printer isn’t working. You spend a couple of minutes sorting it out, and then you hope your printout will come out. But no, what comes out first is 100 pages of other stuff that your colleagues have sent to print, and was patiently waiting for the printer to become available. Clearly, something had to be done, and it obviously had to involve an Arduino
  4. Something to annoy people and get them to go check

    the printer! ? That was the initial idea ... now the question was how to get the Arduino to talk to the printer
  5. SNMP Est. 1988 The answer came in the form of

    a rather ancient, by today’s standards, protocol called SNMP. SNMP stands for Simple Network Management Protocol. One can argue whether it’s actually simple or not, but the rest describes its purpose rather accurately.
  6. how many wireless clients are connected? there’s 12 wireless clients

    connected SNMP Manager SNMP Agent GetRequest GetResponse UDP 12 MIB There’s more use cases, including reading lots of data in bulk from the remote device, and even updating data on the device if the device allows it, but the simple thing of asking one value at a time will do for now. So ... what sort of things can you ask?
  7. MIB OID (Object ID) Value 1.3.6.1.2.1.25.1.1 (hrSystemUptime) 67432864732 1.3.6.1.2.1.1.5 1.3.6.1.2.1.1.5

    (sysName) “B&W Printer 1” Most objects have got a value that’s either a number or a string of characters. So, what sort of interesting information do these MIB’s contain?
  8. (almost) all SNMP- enabled devices • Generic things like uptime,

    system name • Network interface information e.g. speed, data sent & received
  9. Networked printers • Online/offline status • Page counts • Status

    of consumables (ink/toner) • Whether printer covers are open (!) • More details: http://tools.ietf.org/html/rfc3805
  10. VoIP phones/exchanges • Number of incoming/outgoing calls • Concurrent calls

    in progress • More details: http://wiki.snom.com/ Category:HowTo:SNMP ... So, if you have a device and want to discover what sort of SNMP data you can get out of it, how do you do this?
  11. http://ireasoning.com/mibbrowser.shtml IP of the device you want to probe Select

    the ‘Walk’ operation here You use a tool like that ... or if you prefer there’s a command line tool called ‘snmpwalk’ that does the same thing
  12. So, is it simple? • UDP packets are binary encoded,

    using a slightly complex encoding called ASN.1 • Space & power-efficient - packets are small • Stateless - replies contain all necessary data • Can easily create a template packet for simple requests • No need to fully parse replies So simple, in fact, that even I managed to implement it, admittedly just a small subject, and with the help of other open source code I discovered online.
  13. So, I had a Nanode and some LED displays sitting

    around, and I thought I’d give it a try. It’s currently sitting on my desk, pinging our office internet router every couple of seconds, and showing how much data we download every day. So, how do you go about doing something like that?
  14. SNMP Manager Library • Modified version of the ethercard library

    for the Nanode with SNMP Get functions • Download from: http://github.com/futureshape/ ethercard • Has worked fine in long-term testing in our office, but not tried with different devices & environments
  15. Simple API • Send out an SNMP get request •

    Parse SNMP get response in packet buffer • Extract numerical or string value It’s got a very simple API - just 3 functions
  16. SNMP Agent Library • Get an Arduino (with integrated Ethernet

    or Ethernet Shield) to reply to SNMP requests • http://code.google.com/p/agentuino/ I haven’t tried it, but you can also do it the other way round
  17. In summary ... • SNMP may not be the “IoT

    protocol of the future” • But it works well enough for interfacing with lots of interesting things out there • And can easily fit in an Arduino • So we can bring more Things inside our Internet of Things - anyone up for an SNMP to Pachube gateway? :)
  18. Alexander Baxevanis Twitter: @futureshape Email: [email protected] Image: http://www.flickr.com/photos/wwworks/4759535950/ And thanks

    to all the people who did the really hard work, and created the Nanode and the associated networking libraries. Any questions, ask me now or on Twitter or via email, and I’ll get the slides posted online somehow.