MQTT for system administrators (and for the IoT)
This is a modal window.
Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.
Formale Metadaten
Titel |
| |
Serientitel | ||
Anzahl der Teile | 34 | |
Autor | ||
Lizenz | CC-Namensnennung 3.0 Unported: Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen. | |
Identifikatoren | 10.5446/45164 (DOI) | |
Herausgeber | ||
Erscheinungsjahr | ||
Sprache |
Inhaltliche Metadaten
Fachgebiet | ||
Genre | ||
Abstract |
|
1
2
3
4
7
8
10
14
15
17
18
22
23
26
28
31
32
34
00:00
DokumentenverwaltungssystemPhysikalisches SystemSystemverwaltungQuick-SortSystemverwaltungEinfach zusammenhängender RaumFokalpunktGüte der AnpassungSoftwareentwicklerDemo <Programm>SpieltheorieComputeranimation
01:02
DokumentenverwaltungssystemDirekte numerische SimulationServerZahlenbereichWeg <Topologie>SoftwareentwicklerPhysikalisches SystemProjektive EbeneKartesische KoordinatenKonfigurationsraumBitEin-AusgabeMultiplikationsoperatorKonfigurationsverwaltungOpen SourceComputeranimation
02:00
DokumentenverwaltungssystemProdukt <Mathematik>ZahlenbereichRechenschieberLie-Gruppe
02:40
StandardabweichungBinärdatenRechnernetzAuthentifikationTLSHierarchische StrukturBandmatrixPrinzip der gleichmäßigen BeschränktheitWurm <Informatik>ChiffrierungDokumentenverwaltungssystemMikrocontrollerTLSSoftwareEreignishorizontRechter WinkelBitWurm <Informatik>Physikalische TheorieProtokoll <Datenverarbeitungssystem>ChiffrierungMechanismus-Design-TheorieE-MailMereologieAuthentifikationZellularer AutomatMomentenproblemBandmatrixUmwandlungsenthalpieServerInformationWärmeübergangHypertextMailing-ListeGamecontrollerTransportprotokollClientNeuroinformatikKartesische KoordinatenComputeranimation
04:52
DokumentenverwaltungssystemHierarchische StrukturEreignishorizontBitrateServiceorientierte ArchitekturPlastikkarteTermHierarchische StrukturRechter WinkelMAPQuick-SortTypentheorieMikrocontrollerMessage-PassingGamecontrollerSchlussregelKurvenanpassungServerHash-AlgorithmusClientFamilie <Mathematik>NeuroinformatikStreaming <Kommunikationstechnik>ZeichenketteBitrateWort <Informatik>Pay-TVKartesische KoordinatenProgrammierungKonditionszahlInverser LimesZahlenbereichSoftwareentwicklerAdressraumDickeWasserdampftafelDifferenteComputeranimation
08:49
DokumentenverwaltungssystemPrinzip der gleichmäßigen BeschränktheitServerZusammenhängender GraphServiceorientierte ArchitekturBitMessage-PassingLeitungscodierungTwitter <Softwareplattform>SoftwareThumbnailComputeranimation
10:06
DokumentenverwaltungssystemServerPrinzip der gleichmäßigen BeschränktheitMessage-PassingBridge <Kommunikationstechnik>Erlang-VerteilungAuthentifikationPlug inFreewareOffene MengeWärmeübergangDienstgüteBenutzerbeteiligungBitInstallation <Informatik>DifferenteServiceorientierte ArchitekturMessage-PassingSystemprogrammZahlenbereichPlug inStellenringOpen SourceRechenzentrumFlächeninhaltMereologieProtokoll <Datenverarbeitungssystem>Wort <Informatik>Physikalisches SystemZweiTermEinfache GenauigkeitEinflussgrößeSoftwareFormale SpracheKartesische KoordinatenInformationSchlüsselverwaltungMetropolitan area networkDistributionenraumMomentenproblemWurm <Informatik>Bildgebendes VerfahrenMultiplikationsoperatorAppletProgrammierungSystemaufrufArithmetische FolgeEinfach zusammenhängender RaumNeuroinformatikLokales NetzGamecontrollerWeb SiteVerbindungsloser ServerComputeranimation
14:49
DokumentenverwaltungssystemElektronische PublikationCLIErlang-VerteilungAlgebraisch abgeschlossener KörperFormale SpracheGewicht <Ausgleichsrechnung>Prinzip der gleichmäßigen BeschränktheitWurm <Informatik>SystemprogrammServiceorientierte ArchitekturSchlüsselverwaltungMessage-PassingWurm <Informatik>Konfiguration <Informatik>Formale SpracheBitBridge <Kommunikationstechnik>RichtungDifferenteProgrammbibliothekSpeicherabzugZahlenbereichDienstgüteComputeranimation
16:45
ClientZeichenketteDokumentenverwaltungssystemObjektorientierte ProgrammierspracheROM <Informatik>FehlermeldungSystemaufrufBitMessage-PassingProgrammierungLoopThreadCASE <Informatik>Funktionale ProgrammierspracheClientServiceorientierte ArchitekturResultanteComputeranimation
18:04
DokumentenverwaltungssystemVerkehrsinformationNabel <Mathematik>ProgrammierungSystemverwaltungQuick-SortFunktionalSkriptspracheMAPSoftwareentwicklerServerGarbentheorieAggregatzustandComputeranimation
18:46
DokumentenverwaltungssystemLoginSystemverwaltungBitRoutingOrdnung <Mathematik>Wort <Informatik>DifferenteEin-AusgabeZahlenbereichProtokoll <Datenverarbeitungssystem>SystemprogrammProgrammierungElektronische PublikationPulsfrequenz <Technik>StatistikVirtuelle MaschineOffene MengeServiceorientierte ArchitekturLoginPhysikalisches SystemFormation <Mathematik>ResultanteÄußere Algebra eines ModulsAutomatische HandlungsplanungWurm <Informatik>Quick-SortBefehlsprozessorFitnessfunktionFiletransferprotokollZeitstempelBus <Informatik>Web logMAPGruppenoperationSkriptspracheE-MailServerFluss <Mathematik>Multiplikationsoperatorp-BlockKartesische KoordinatenHalbleiterspeicherComputersicherheitSystemverwaltungEinfach zusammenhängender RaumComputeranimation
23:15
Ein-AusgabeServerDomain <Netzwerk>Ganze ZahlStapeldateiDokumentenverwaltungssystemProgrammierungZahlenbereichUmwandlungsenthalpieFunktion <Mathematik>Serviceorientierte ArchitekturQuick-SortRechter WinkelEin-AusgabeAbfrageElektronische PublikationKonfigurationsraumDirekte numerische SimulationComputeranimation
23:57
DokumentenverwaltungssystemEin-AusgabeServerDomain <Netzwerk>Ganze ZahlStapeldateiEinfache GenauigkeitEinfach zusammenhängender RaumGraphfärbungMini-DiscMomentenproblemSpieltheorieServiceorientierte ArchitekturSchlussregelDigitaltechnikRouterZweiTermRechter WinkelEinfacher RingTelekommunikationProdukt <Mathematik>BitMikrocontrollerDemo <Programm>ApproximationE-MailSpannungsmessung <Mechanik>MinimumDigitale PhotographieWhiteboardVersionsverwaltungSpezielle unitäre GruppeKonfiguration <Informatik>KreisflächeInternetworkingUmsetzung <Informatik>Lokales MinimumFormale SpracheRadon-TransformationGamecontrollerMessage-PassingQuaderComputeranimation
28:18
DokumentenverwaltungssystemVersionsverwaltungQuick-SortCodeBitComputerspielPersönliche IdentifikationsnummerSpannungsmessung <Mechanik>Computeranimation
29:01
DokumentenverwaltungssystemDigitalsignalAnalogieschlussDrahtloses lokales NetzValiditätSelbst organisierendes SystemLeistung <Physik>BitEin-AusgabeSpezielle unitäre GruppeRadikal <Mathematik>FunktionalComputeranimation
30:16
DokumentenverwaltungssystemDrahtloses lokales NetzDigitalsignalAnalogieschlussBitMikrocontrollerFormale SpracheMomentenproblemPlastikkarteQuick-SortTermMultiplikationsoperatorTouchscreenComputeranimation
31:42
ProgrammierumgebungDokumentenverwaltungssystemComputervirusImplementierungKonfigurationsraumVersionsverwaltungAutorisierungTouchscreenSoftwareentwicklerQuick-SortProgrammierumgebungRadikal <Mathematik>Wurm <Informatik>Formale SpracheMultiplikationsoperatorMikrocontrollerZahlenbereichGrundraumMinimumSpezielle unitäre GruppeServiceorientierte ArchitekturInformationMereologieComputerspielCASE <Informatik>ZweiKartesische KoordinatenSystemzusammenbruchOrdnung <Mathematik>VersionsverwaltungMomentenproblemAggregatzustandSoftwareTypentheorieMessage-PassingHardwareKonfigurationsraumOffene MengeTopologieImplementierungClientProgrammierungInternetworkingComputeranimation
39:35
DokumentenverwaltungssystemHochdruckClientDateiformatWurm <Informatik>Internet der DingeInternetworkingMobiles EndgerätCASE <Informatik>Flash-SpeicherCodeÄhnlichkeitsgeometrieServiceorientierte ArchitekturWurm <Informatik>MultiplikationsoperatorComputeranimation
40:30
DokumentenverwaltungssystemObjektverfolgungURLKartesische KoordinatenDesign by ContractKontextbezogenes SystemDatenflussInformationWeg <Topologie>MeterComputeranimation
41:20
DokumentenverwaltungssystemRhombus <Mathematik>HardwareSchaltnetzPhysikalisches SystemOffene MengeWeg <Topologie>MultiplikationsoperatorInformationNotepad-ComputerServiceorientierte ArchitekturProtokoll <Datenverarbeitungssystem>ChiffrierungWurm <Informatik>SystemprogrammRadon-TransformationComputersicherheitEigentliche AbbildungComputeranimation
42:57
DokumentenverwaltungssystemQuick-SortSelbst organisierendes SystemAuthentifikationNP-hartes ProblemTouchscreenAutorisierungServerComputeranimation
44:21
SystemverwaltungDokumentenverwaltungssystemClientMessage-PassingServiceorientierte ArchitekturPhysikalisches SystemMikrocontrollerTranslation <Mathematik>Quick-SortDifferenteZahlenbereichImplementierungStandardabweichungDienstgüteEinfache GenauigkeitHardwareRPCTouchscreenCanadian Mathematical SocietyFlächeninhaltDefaultFamilie <Mathematik>ProgrammierungKartesische KoordinatenMultiplikationsoperatorArithmetisches MittelGüte der AnpassungEinfach zusammenhängender RaumProzessautomationComputeranimation
48:47
DokumentenverwaltungssystemClientEinfache GenauigkeitWurm <Informatik>Erlang-VerteilungAlgebraisch abgeschlossener KörperFormale SpracheGewicht <Ausgleichsrechnung>Elektronische PublikationCLIComputervirusSystemprogrammEinsZweiVirtuelle MaschineVorzeichen <Mathematik>Message-PassingKartesische KoordinatenServiceorientierte ArchitekturQuick-SortFormation <Mathematik>GeradeEuler-WinkelAutomatische HandlungsplanungBitFunktion <Mathematik>BimodulComputeranimation
51:35
Computeranimation
Transkript: Englisch(automatisch erzeugt)
00:13
So good morning, yes, so good morning. My name is Jan Piet or JP. I'm JP Mens I'd like to speak to you this morning about
00:21
MQTT Excuse me MQTT was the focus for our system administrators for UNIX people Disclaimer, two disclaimers first of all, I was informed on I think it was Tuesday Wi-Fi connections with your own equipment don't work here Sort of killed off with deals, I think it's called I was able to verify yesterday at the
00:45
Unite and since then I've been able to sleep Unfortunately, I promised you blinking lights and they they won't work. I don't know I don't know why I was trying to convert everything to cable most most of the demo will work But some of it won't work. This is a great thing
01:02
So another disclaimer I am not a BSE developer I think I'm the only one here who's not a BSE developer. And so I apologize for that. I See from the audience another two or three I Was actually hoping to become by this a porter on Tuesday will be
01:23
Importing a workshop working tutorial, but that was that was canceled. So I'll have to wait a little bit I found a lot of work. I do quite a bit of work with open source After the done quite a few contributions of all documentation system of the accessible configuration management This time I've done the number of things including for example
01:44
Creating a vertical own tracks. We do Those are two applications one for iOS one for Android which do person tracking or vehicle tracking Over and QTT if you're interested in that Speak for me later
02:03
Question has anybody have you heard of amputee tea who has heard of Very nice. That's approximately 10 to 15 people for the camera Who can tell me why I have this bottle of Pineapple syrup it from a company called Mizzou Bhutan in France. Why do I have this bottle of pineapple syrup here on the slide?
02:26
You'll lie you don't know anything about MQTT the product is called 1883 and then see Yana assigned TCP port number four Okay, they also make the better
02:43
Right, so what is MQTT MQTT is A standard it's not an RFC, but it has been standardized by the Oasis. It's a standard TCP based Transport protocol Pops up mechanism publish subscribe and explain a little bit more what that means in a moment
03:00
It was originally designed for unreliable networks unreliable networks That's what we have when you have a mobile device. So you have Wi-Fi here you go outside You have 2g 3g maybe you have AT&T that's offline or whatever. It's called here. So unreliable networks means Precisely that okay
03:21
It is a binary as binary payloads of up to 256 megabytes These 256 megabytes are a little bit theoretical if we are doing something on a Mac on a normal computer Then of course we can handle payloads of 256 megabytes if we're doing something on a microcontroller The size which has a couple kilobytes of RAM then it's of course completely out of the question that we have
03:44
All that kind of payload but in theory it goes up to 256 mega MQTT is very fast. Very very lightweight. We compare that for example with HTTP the hypertext transfer protocol HTTP is very verbose So even if you just pick up a payload of a few bytes
04:01
You have quite a bit of header information that goes up and down MQTT does not have this other than a so-called topic, which we'll see in a moment MQTT is ideal for low bandwidth networks and High latency networks a MQTT has a support for TLS transport layer
04:21
security Which you might so-called SSL Unfortunately MQTT supports authentication supports payload encryption, of course because that's not part of MQTT That's whatever your payload whatever your application does MQTT supports access control lists between Client and server so another specific name
04:41
We'll see in a moment has something called last will and testament which we'll be talking about. So you'll show you a bit more later on and Supports so-called topics and the way what topics are is we have in our MQTT landscape we have a server in the center The server is in MQTT terms called a broker. The broker is simply an MQTT server
05:05
there are different kinds of MQTT brokers. I'll show you a few in a moment. And we have clients. These clients, here on the left for example, we have publishers Here on the right we have subscribers, but there's absolutely no reason why a client should not be a subscriber and a publisher
05:25
Publishers Will publish a message. A message is attached to a particular topic. A topic is like an address. A topic is a hierarchical UTF-8 hierarchical string and This message is to get over the topic, published to the broker. The broker accepts this message and will forward that on
05:48
Automatically to any subscriber on the right who is subscribed to that particular topic. We'll see some examples of topics in a moment. So if there is a subscriber for a particular topic and
06:01
There is then a publisher on that topic then these two entities can speak to each other well, unidirectionally, can speak to each other. If I publish a message on a particular topic in MQTT and On the other side, there is no subscriber who's listening to that message. Then the message disappears. It's just thrown away
06:21
Topics, by the way, are not created. The fact that a publisher publishes to a particular topic means that that topic then suddenly exists Under the condition Under the condition that the broker will actually accept such topics. So we have access controllers which
06:41
enforce particular Well access rules on clients that are connecting both publishing and subscribing. These topic names are hierarchical UTF-8 Hierarchical string up to a length of
07:03
64 kilobytes, so it should be long enough for a while. Hierarchical separated here by slashes. So for example, if we could have a device maybe a water kettle, which publishes its temperature on a topical home slash ground floor slash kitchen slash kettle.
07:23
Or we have for example a financial service which is publishing under finance slash currency here euro slash rate. On the other hand a subscriber can subscribe to particular wildcards. We have plus at the wildcard.
07:42
This plus means one level, the one level of hierarchy. In other words this subscriber would subscribe to finance plus slash rate, would get any messages published to finance slash euro slash rate or finance slash Canadian dollar slash rate or US dollar or yen or whatever.
08:02
Would not get, however, topics or messages published to finance slash yen. And we have on the other hand the hash character. The hash character is also a wildcard and stands for any number of levels from here on where it's done.
08:26
And if you can see these by the way are our topics from sort of real-life topics. Here we have a UUID, here we have a topic sent by a little microcontroller. So topics are
08:42
something that we create, that application developers create, to decide that they will speak to each other. Now an MQTT broker, what we saw earlier, let me just go back. MQTT broker is a server component here in the center, is a little bit, at least in my mind, a little bit like a quarter.
09:00
So publishers just dump stuff into that subscribers. On the premise that they are permitted to do so, we have subscribers take it out. So for example, let us assume you have purchased a little something, a little blank, maybe a little thumb step, and the thumb step is publishing temperature in Fahrenheit,
09:24
you bought it in the States, can I know now, is that right? And you bought it in the States, it's published in Fahrenheit, nobody knows what Fahrenheit is, but so you want it in Celsius, you would write a simple few lines code to publish a subscriber which would subscribe to that particular topic of that device, so that sensor,
09:46
extract the temperature that is being published in Fahrenheit, convert it to Celsius, and republish it under a different topic. Okay, so like a huge melting pot of stuff that goes in and out. I once, many years ago, called MQTT a little bit like Twitter for my network, and that's the way I tend to,
10:05
that's the way I tend to see it. Messages that are published are published with a so-called QoS quality of service, and there are three qualities of service which MQTT
10:21
provides us. We are numbered 0, 1, and 2. Or the QoS 0, or QoS 0, it's called officially at most once, it is something that we call fire and forget. So in other words, a publisher will fire off a message and will say well if you get it, fine, if you don't get it, fine. So for example a
10:41
sensor or a device that publishes information that will be republished in a few seconds anyway might use QoS 0, our temperature sensor, you know, maybe it's publishing every 10 seconds, and if we lose one of the measurements it doesn't really matter because there'll be another one in the coming 10 seconds. Okay, so this is a very fast,
11:01
very fast thing. Happens over TCP, of course, because MQTT is TCP based, but it's a little bit like, you can compare it a little bit to a UDP data. Maybe it gets there, maybe it doesn't. By the way, typically in your local area network, typically it will get there. I don't think I've ever seen a QoS 0 message that got lost.
11:22
QoS 1, assured delivery means that the message will get there at least once. And to be careful though, because the message can get there multiple times. Okay, and QoS 2 is called once only, or assured delivery, sorry, exact delivery, and once only means exactly that. The protocol
11:41
guarantees, as long as the device is kind of operated correctly, guarantees that the message will be transmitted exactly once. Now MQTT brokers is, as I said, an MQTT broker is part of your network. You have to confirm a message, and you have devices, clients, and subscribers, and you have your MQTT broker.
12:02
Now these MQTT brokers, there are several, and I have two that I would like to introduce to you, just by name at least. We'll see one in a moment. Mosquito is an open source MQTT broker created by a man called Roger Alight. And this is not the typo.
12:20
The English word Mosquito is of course spelled with one T, but Roger was looking for something that's called MQTT, and that's why we call it Mosquito. Yeah, you can Google that. So it's written in C, it's very fast, it has ACLs, it supports ACL to a plug-in. Access Controllers, for example. It supports all the typical standards, TLS, TLS with pre-shared key.
12:47
It has bridging, we'll explain in a moment what bridging is, logging via what is called dollar assist, and it's available for all all typical distributions. On an open BSD, for example, you can do package add Mosquito, or on free BSD you can do package add Mosquito, package install Mosquito.
13:04
Okay, that's very fun. Varn MQ is written in Erlang, it's also very modern, very fast. System supports web sockets, supports clustering, for example, if you need to cluster your MQTT brokers.
13:22
Has support for web hooks and also Lua plug-ins, in other words plug-ins written in the Lua language. And there are a number of other brokers like things written in in JavaScript, for example, or in Java, i.mq is a broker that was, until
13:41
two weeks ago, was closed source and has now been opened. Rapid MQ, for example, has an MQTT plug-in. So there is quite a vibrant community around the broker area. I mentioned that once the term bridging
14:00
MQTT brokers can be bridged together. And this bridging means that we are able to, for example, in a data center, here on the top we have an MQTT broker with a number of clients, and we can lead out via a single channel, via a single TCP connection, either initiated from inside or read from open from outside. We can lead out any number of
14:26
topics and, of course, their payloads. So this is the possibility to, for example, transfer differing information, differing data from a data center out into maybe a different data center or into different applications.
14:42
Now let's show you an example in a few months of how we can do that. MQTT also means we need utilities and there are two utilities which are very common. One is called Mosquito Sub, which has a whole bunch of options. Basically, Mosquito subscribe with a minus T topic and
15:04
Mosquito Sub will connect to your broker and subscribe to messages of that topic, or those topics. And on the other hand, from the command line, Mosquito publish will publish a message with a particular topic and a particular payload to that broker.
15:25
MQTT comes for a whole bunch of different language, or has binding for a whole bunch of different languages. C, of course, JavaScript, almost anything. I think the only language that I found that has no direct MQTT support is COBOL.
15:44
Who knows COBOL? But by the way, there's a COBOL bridge for Node.js, so if you... It just happened with IBM released last week, running COBOL and Kubernetes. COBOL, if we run it, that's hardcore.
16:03
Right, just a few short examples that you see that is really quite trivial. I thought maybe in Python we should do something. We have an excellent library that I've also written by Roger Lutz. They want Mosquito, the Mosquito Broker.
16:23
For publishing a message to an MQTT message, MQTT.single, you specify a topic, you specify a payload or a message, and that's it. Off it goes. Okay, and of course there are a number of options. We can specify hosting, port number, etc, queue, quality of service, etc, etc, etc.
16:42
On the other hand, the subscribing side is a little bit more involved. It's a little bit more involved because we connect to a broker, and then we will typically loop forever. So now we'll open a thread, loop forever, and as soon as the message comes in,
17:00
we will invoke a callback here onMessage, and the onMessage callback gets the user data and the message, and then we'll handle this message. So for example in this particular case, simply print it out. Okay, but relatively simple. That's why the earlier program subscribing client, which will extract our Fahrenheit temperature, convert it to Celsius, and republish it,
17:25
would really be something quite trivial to implement. The result is of course that if we have our subscriber running, and we publish our program, for example via command line or via notification, then we get that data.
17:42
A small C program to do the same thing using libMosquito. It's a little bit more involved, but relatively trivial. This program is a fully functional program, which will publish a message to this topic, and it will connect, publishes a message, disconnects the message.
18:04
So this allows us, for example, as administrators in long-running or developers in long-running shell scripts and long-running programs to, for example, periodically print what we're doing, where we are. Here, for example, using a shell function.
18:24
And then the person tracing this, sort of using logging or whatever the person is tracing this, could determine what the program is actually doing, and at what stage this program is actually doing.
18:42
Now there's a gentleman here in the audience called Dan, who one day said he has a problem. He would like to see what users are logging into the system. And he wrote a very long blog article from which this quote comes out.
19:01
What we did was actually, what he originated was, with all due respect, horrid. I thought we'll make it, let's try to make it a little bit less horrid. And the way we did it was to use, actually to use MQTT. What Dan wanted to do, something which is actually quite clever, what Dan wanted to do
19:26
was to determine when somebody logged into his system or to his systems. And in order to do that, what we did was create a kind of TLC program, which is called HAIR. There's a story behind it, you can read it here, why it's called HAIR.
19:42
There's a kind of TLC program, which is coupled into PAM. Now the PAM person, is he in the room? No, thank you. Anyway, the PAM person will probably get a fit because we did that. I'm talking about Michael, of course, Michael Luca. So this, if you don't have PAM,
20:00
we can do the same thing with the one in S stage RC script, which is invoked by S stage. So in other words, what the result was that we have a small program, which is invoked whenever a user logs in or whenever a secure copy or a secure ATP logs in to the system. They'll publish it with a small
20:24
payload, a small JSON payload, and that is then sent off to a broker. And what Dan then did was to use a number of utilities to then get that payload by MQTT and then, for example, create an email out of it or send it to pushover as a notification or alert or whatever, etc, etc, etc.
20:43
And so these are things that we can do relatively easily with MQTT. And the way we did it here is the example that we would use if we didn't do the PAM mechanism, but we do it over S stage RC, small script, which goes here and sends it off to a HTTP broker. And the result is
21:07
that a payload with a JSON block which hosts which remote hosts, what service, the time stamp, which TTY, which user
21:23
actually calls that, that this remote payload is then processable and then transferable, sort of in a plug-and-play way transferable to other systems. Here we see that log in as an email which was sent by SMTP, and we see it or we see it as a pushover, as a pushover
21:46
with the appropriate alerting onto whichever kind of notification service or whichever kind of notification system you design. So generally speaking for the SysAdmin
22:03
MQTT is a very interesting protocol because we have a possibility to, within a data center, within a group of machines, we can send our own data, we can send, do things like connect telegraph data, I'll show you an example, telegraph, anybody know telegraph? For the influx people, telegraph is a wonderful utility which has a huge number of inputs,
22:25
I forget how many, 20, 30, 40 different inputs, files, open SMTP, statistics, JSON inputs, HTTP logs, with contain logs, etc. And all these inputs here with stats, for example, all these inputs can, for example, create MQTT publishers or other things, but I'm interested in
22:45
the MQTT plan. We can use Connecting, for example, also exists for BSD or for FreeBSD. We can use Connecting, which also collects statistics, CPU statistics, memory statistics, and is able to produce and publish these over MQTT onto our MQTT bus there, into our
23:05
quadrant. And on the other side, we can, for example, buy a broker, then bridge them out into another broker, into a different world, into different systems. This is an example of what
23:21
telegraph looks like. You have a configuration file that looks a little bit strange, but it has a number of inputs. Here we have an input DNS query or an input EXEC, where I run my own programs, and we have an output MQTT with a particular broker, specification for broker, important number, and a topic prefix. And then here on the right,
23:43
we see a telegraph that says topic prefix BSD can, that's the host name, users on, and here value 16, that's this name that is being shown here. So all sorts of data that can, let me just go back one, all sorts of data which can be published over a single MQTT
24:03
connection. Now, any questions so far? Yes, very good. Now, I'm very sorry, I'm very sad, because things should have worked and will hopefully work. I'll show you in a moment.
24:26
I'm going to pass some stuff through the room just for you to see. Well, I'll continue talking just for you to see. There are a few rules to the game. First of all, all this stuff comes back here, please. Second rule is, I will also give you in a few
24:40
moments, I will also pass you something. Now, there's very specific rules for this thing that I'm going to pass you, and that is, first of all, please don't pull the plug unless I ask you to. If you pull the plug, the demo doesn't work, maybe understandably. Second of all, there's some sharp edges on the bottom of this printed circuit. Don't hurt yourselves.
25:01
Blood flows down, and I don't want that. And also, please, if you wear rings on your hands, try not to create a short, because that would just not work. The first thing I'm going to hand over is what you see on the bottom right there. It's a little so-called pocket router. Here's one with an antenna. The antenna is optional. I've got one
25:24
running here. I'll lift it up in a moment to show you that one. I don't want one. I don't want the disk cable or anything. It doesn't work anyway. This is very similar. It's just an awful baby blue color. These are little so-called pocket routers. They run a version of WRT.
25:41
So, yes, I'm sorry, wrong shot, but that's what they run. And on the little baby blue one is a mosquito, but there's a mosquito broker running on it, okay? And we'll talk to that mosquito broker in a moment. On this one, there's also a mosquito broker, but we can't talk to it because it's off, so I'll hand it over. These little pocket routers are very inexpensive,
26:05
or rather inexpensive. They cost somewhere around 20 euro, 35 euro or something, which is, what, 30 US dollars or 40 and 18 dollars, approximately. This thing is a,
26:21
the photo of it in a moment, is called a Sonoff, which is a little device which allows me to, on the one hand, bring in 220 volt or 110 volt. On the other hand, I'll turn it 20 or whatever came in on the left, and we can switch it. And there's a little microcontroller in it. And the microcontroller that is in here is a little bit like what you
26:43
see there, is a so-called ESP8266. Now, this ESP8266 is basically like an Arduino. Who knows the term Arduino? Everybody, okay, oh, almost everybody. Arduino is a wonderful product created by a bunch of Italians who added this fantastic idea, and they were able to create
27:03
a thing which brought electronics closer to people who have no idea of electronics, for example, myself. And Arduino is about cigarette-shaped, cigarette-sized, cigarette-box-sized, a little bit larger than this thing, and cost somewhere around 20, 30, 40 dollars, okay? Now, there was then a Chinese company, and the Chinese company said,
27:25
oh, we can do that, too. And they made something that is Arduino-like, speaks the same language, we can program it on the same things, has the Wi-Fi on board, okay? Has Wi-Fi on board. I'll try and show you in a moment. There's a little problem. I'll try and show you in a
27:41
moment. There's Wi-Fi on board, and it's sold not for 20, 30, 40 dollars, but for four dollars, including registered mail from China, okay? And one of those things that's in here, so we can program that, and the reason I'm showing you is we can speak MQTT. These boards, they speak HTTP, if we prefer, or whether they speak MQTT, I like the MQTT version, okay?
28:05
Let me hand that over. It's tiny, one of the Sonoffs costs, I think, 10 US dollars, or 8 US dollars, somewhere around, but don't quote me on that. Okay, so these ESP8266, that's the name of the, that's the generic name, they come
28:23
in different shapes and sizes. Here, I'm sorry, I forgot to translate the prices. These are Euro prices, so you see the sort of the smallest version costs a Euro 50. Then you have the top of the node MCU, they just have a little bit more RAM, and they have more pinning, and so on, and so forth, but don't start,
28:43
if you're new to this whole deal like I was, don't start with something like that. It looks interesting because it's cheap, but it's just a pain, because it's very, very difficult to get your code out, yeah? Start with something like a node MCU, which is controlled over 5 volt, which makes your life easy, or start with something called a,
29:02
let me just show you here, a Wemos D1 Mini. These things are absolutely gorgeous, I find them gorgeous. They cost about 4 Euro, they're powered by a USB, and they're really solid, very good, really, really, very nice. Now, the soft thing that is going around, please see if you can get it across, that has an ESP8266
29:26
somewhere in here, and that's what it looks like, okay? And there's also Electro Dragon, for example, cost 5 Euro 50, which has very similar functionality, and has one input, so power input, 220 volt, 110 volt, and on the other hand,
29:40
on the other side too, really, so we can control two outlets here, thank you. The German TÜV, which is the organization of checks, technical validity of the quarter,
30:01
and how big your cars are, whether they're all rusty or all that, I don't think they exist in North America. The German TÜV would get absolutely fixed if they saw one of these. I personally wouldn't leave one unattended, but okay, you can do it. The Sonoff is a little bit higher quality, in my opinion, a little bit better. So, we mostly want mini, it's a little
30:23
microcontroller, it speaks, if you want, that speaks in QT, it speaks HTTP, it can be programmed in three different languages, I think, at the moment, in Micro-Python, it can be programmed in Lua, and it can be programmed in C, just like you would program in Arduino, that's my preferred way.
30:48
I mean, we must come with little, cute little shields, you can't get enough of these, for example, an OLED shield, tiny little screen, it's smaller than sort of half stamp, it's minute, and you have an SD card shield, and here's a thermostat shield, and there's a
31:07
large, I'll pass it around in a moment, don't worry, but I have to plug it in a moment, but I'm afraid that as soon as I plug it in, it'll be remotely de-auth, I think the term is, that's why I'm waiting until the last minute. This is a little button shield, so the actual
31:29
microcontroller is really just this bottom plate, okay, the thing on top is just the button, right, just the button. Did you have a question? No, no, sorry.
31:43
Okay, and so we can program these with the Arduino IDE, with the integrated development environment, and of course we can do all sorts of things. Now, let's do the following, let's take a terminal, and can you see that, the ledger bolt, okay, now this screen is split in
32:20
two, at the bottom we have, I have input, I can type, and at the bottom at the top, we have the Mosquito sub-command, which is subscribing to all topics that are going to the broker, the broker is currently on this little blue pocket router, okay, so in theory, if I'm not lying to you, what I should be able to do here, down here, is Mosquito
32:41
pub, minus h, post name 192.168.8.1, minus t, topic is bsd-cam-dms-11.0, and minus m, payload, what would you like to say? Hello, hello world, hello world, hello world, okay,
33:05
and as you see on the top, exactly that has happened, okay, so we have the topic here on the left, and we have the actual payload, now what I'm going to do is switch to the top bar,
33:21
and occasionally I'll hit enter, so that you see that the data is flowing, and now comes something which I hope will work for five minutes, yesterday in U90, I was killed off after less than 60 seconds, so I don't, I didn't know there existed, we were, we heard this on Tuesday,
33:40
or on Wednesday, apparently the university is able to send the off package, I didn't know there existed, the off package would tell the client to, to unauthorized, to disconnect from wi-fi, I'm hoping that the Chinese implementer who wrote this doesn't know about them, okay,
34:02
so I'll pass this on in a moment, this is the thing is booting up, it's a little blue light, and you see there a whole bunch of information, now go ahead, I'll pass it on, go ahead and press click, you see, whenever you click the bottom, you see the, there's a, there's a,
34:20
the topic only to open, and then true, or if I hold it, it's now open, false, open true, open false, okay, go ahead, remember please, no blood, okay, so this little microcontroller, this little ESP8266 is now connected to my, to my wi-fi,
34:42
which is being provided by this little device, which wi-fi it is, doesn't matter, of course, but it happens to be provided by this little device, and, and I, this little application on there, the program on there, written in C language, and this program is checking the
35:07
state of the button, and will then publish an appropriate information, so you should, there we are, and of course we can, we can do in between, we can do all sorts of other
35:23
things, I mean, we're talking to a broker, now this broker will, on a hardware like this, do somewhere around, I don't know, 10, 15,000 messages per second, okay, so it's relatively, no, it's very lightweight, if you want something really big, you will buy, for example,
35:40
IBM message sites, they make appliances, they do about 15 million messages per second, I'll tell you why they do that, well, is this still working, is the wi-fi still on, okay, good, now do me a favor, or do us a favor, please, who has it, who has it, okay, would you do me a favor, and we're going to simulate a crash, now there's something called
36:07
LWT, Last Will and Testament, in MQTT, Last Will and Testament is exactly what it sounds like in real life, Last Will and Testament, if you and I have one, we've written down, in the case of our death, please do this and this, now in the MQTT world, the, an application
36:25
is able to also set a Last Will and Testament, now this is absolutely fantastic, in my opinion anyway, for anything that does monitoring, now if you want to be so kind on the battery side, on the battery side, then just pull it up, now that's as dead as can get, okay,
36:42
now that microcontroller, the software on the microcontroller, when it powered up, it said to the broker, please verify that I'm occasionally alive, once every few seconds, tell me that I'm alive, and in the case of my death, if you don't hear from me anymore,
37:02
be so good as to, on this particular topic that I tell you, please publish this payload, so by now, exactly, it should have happened, you pulled the plug, thank you very much, and the application upon start had said, in the case of my death, please on this, sorry,
37:23
this topic, yeah, dollar online, please publish the value false, now this publishing of the value false would then cause, for example, my monitoring application, maybe Icinga or Zadix or whatever you use, to say, oh, careful, our sensor, our microcontroller
37:42
being behind tree number seven in Brazil has just gone offline, we have to send the backup, okay, and so this last one, a testament thing, this LWT is really absolutely wonderful for anything that has to do with monitoring, how much time do I have, five minutes, okay, so
38:11
that basically shows us what MQTT allows, oh, sorry, mentioned something here, when that little, thank you very much, when that little microcontroller
38:22
booted up, it sent out a whole bunch of information, for example, its own configuration, its version number, what the OTA of the air updates for the application are, are enabled, these devices allow me to replace the software over the air, imagine you have
38:40
these devices built into a wall somewhere, yeah, or in the ceiling lamp or whatever, you don't want to have to chase around, unscrew, take your whole watch apart to find one, you can update them over the air for example, okay, just here, signal, Wi-Fi signal, 18 here, wow, okay, let me know, you can carry on switching, unfortunately you can't see it,
39:06
I can't see it, there we go, okay, so these little devices allow us to do,
39:26
yeah, MQTT on little, little devices, little hardware devices, you know, innumerable types of such devices in order to, for example, do the internet of, what does the T stand for again, toilet, nice, internet of toilet, I love this picture,
39:49
the toilet with a little microcontroller, you know what the S in IoT stands for, right, okay, so last will and testament, this is what it looks like in code,
40:01
it's called LWT, last will and testament in code, the way this happens is, we, upon connecting to the broker, just before connecting to the broker, we say, dear broker, in the case of my desk, please send out to this topic here for double time slash
40:23
whatever popping, the payload, I have no longer here, or some payload, some alerting, the system, okay, now let's have a look at a few practical solutions, what is MQTT used for, MQTT is used for alerting, MQTT is used for metering, for example, the gas pipelines,
40:43
European gas pipelines very often have MQTT sensors or sensors along the way, which use MQTT to transport information like flow, temperature of the gas, etc, just to know that that thing is still working, we have metering in, for example, vehicles, we have lots of metering,
41:03
vehicles, hospital vehicles, ambulances, things like that, there are logging applications, location awareness, tracking, this is a screenshot of our own tracks application, controlling automation, because of the lightweight capability, we have a lot of MQTT
41:22
with UNIX utilities, for example, gray log, the logging system, beeper, enhanceable, there's MQTT for notification, connect, I mentioned open HAB or open HAB, which is the proper home automation broker, if you do home automation or home assistance, if you prefer, they do MQTT, a lot of it, actually, GitHub are straightened through,
41:43
GitHub, you see, would be able to alert over MQTT and a whole bunch of other things, but they separated that all out, they ripped that out completely, GitHub now only does websites, that's why it used to be there, while Sharp has supported MQTT, Fluxo respectively, Remake Electric, the two companies,
42:02
Fluxo is, I think, US-American, I'm not quite sure, Remake Electric is a Swedish company, they make professional electricity meters, which come bundled with an open WRT device, which sends out metering information over MQTT, the Jenkins system, for example,
42:24
all tracks telegraph we've mentioned already, these are all systems that do MQTT, so MQTT is a very simple protocol, it's lightweight, it's fast, very flexible, it has certain amount of built-in security, it has payload encryption or rather transport
42:43
encryption, and we can add payload encryption, it's usable on tiny, tiny hardware, to show you, and yeah, we can do really wonderful things with it. Right, just in time, any questions?
43:06
Yes, I'm sorry, could you speak up? Okay, I can answer that for this particular device, by the way, I can't see in the back here, I can answer that, and what we do here, what we do here is
43:27
TLS over MQTT, that depends a lot on how it's actually implemented, so for example, if you prefer HTTP, you would probably, hopefully do HTTPS with some sort of built-in authentication
43:42
or authorization, there is no, or there are no, let's say, standards, because that's just that hard. Have you seen, this is totally new, have you seen the move for some
44:00
organizations to replace SNMP with this? To replace SNMP? Yeah. Okay, the question is, have I seen a replacement for SNMP with this? Yes, I certainly have, and not only that, but we, well, we, the few of us, do exactly that, so if I may just very, very quickly go back
44:22
to this one, to this one screen shot, this to me, this is not very personal, but this to me is one of the main advantages of MQTT, what we can do in things like data sectors, just small homes, we can have a whole different number of appearances of applications, of programs,
44:42
which provide data, which do data, and funnel this out of a one single TCP connection, one single MQTT connection, okay, so this will be port 1883, or rather, hopefully it's TLS protected, and that's by default, that's 8883, and on the other side, on the receiving side, since this all goes out to a MQTT, but on different topics,
45:05
we can funnel it out into different areas, so yes, SNMP or replacement SNMP is absolutely possible, but of course depends on what devices you want to control, so for example, if you want to rip out SNMP, but your HP, whatever your IBM printer doesn't have MQTT,
45:28
then use, okay, not sure about that. No, that's exactly what I was looking for, I'm just, but I mean, obviously you're going to have that, but I can see somebody just saying, okay, I'm going to have an SNMP interface, and standardize on the MQTT, and then have some
45:44
of the broker do the translation. There is a lot of activity, a lot of application, a lot of programs, a lot of utilities, which are coming out with support for MQTT, because of its versatility, flexibility. Do we have that? Yes, please.
46:02
The message reliability aspect, is that handled entirely on the broker side, or is it handled on the client side? That's a very good question. The question is, the message reliability is a quality of services that handle only on the broker side? No, it's also handled on the client side, so for example, message of QoS2, a short delivery, it's the, basically the client that needs to do the work to ensure, or to ensure that
46:26
the message has been dropped at the, or delivered to the doorstep of the broker, and will then say, okay, I'm done. So what we oftentimes see, it is particularly a new, new hardware to oftentimes see, also of course in microcontroller area, is that for example,
46:45
QoS2 is not, it's just not possible. QoS2, for example, means, by definition, that if you go offline, or if the client goes offline, it must be able to come back up, and then finish delivery. These things can't do that, because they have no onboard battery. So
47:00
the, the WIMOS, or the ESP8266 implementations of MQTT support QoS1, and that's about it. Cool. Yes. Yes. The question is, is there a way for a subscriber to know that there's a publisher,
47:26
or publisher to know that the subscriber is there? No, there is no way. So MQTT, very important, and that's a very good question. MQTT is not an RTC, is not a remote procedure call. It's not a there and back. It is a there and back if you do it in such a way. So for
47:45
example, if you tell a microcontroller, please switch light on, the light might go on, but it might not go on. If you want, for example, in your monitoring system, or in your home automation system, if you want to know, is the light on, or is it not on, then you need some
48:03
sort of back channel. So you would, you would hopefully create a system by which you tell your microcontroller switch on, and if it then has switched on, it would respond, I have switched on. You have a different topic. Careful, must be a different topic, otherwise you start getting loose.
48:20
So, no. Yes. Subscribe to a new topic. Can you get the last thing that was published there? Very good question. I omitted to, because of time, a reason I meant to say that, yes, we have something which is called a retained message. So for example, a publisher can, upon publishing,
48:47
even the utilities have that here, minus R, even the command line utilities have it, the publisher can request from the broker to please retain the last message. For example,
49:03
temperature sensor. Temperature sensor collects temperature once every 30 minutes, and will publish and say it's now whatever, 35 degrees, and please retain this. Now you, as a subscriber, come in and ask, and subscribe, what is the temperature? If you don't subscribe at that instant, when the publisher comes in, you will never find out.
49:23
You would find out at the earliest in about 29 and a half minutes. So the retained message allows the broker to, as soon as you subscribe, give you the last known good value. Those are retained messages, and there is per topic only one retained message. Per topic there is one
49:42
retained message. However, we do a few tricks. For example, per topic with retained messages and with QS, QS1 or QS2, we can actually get a whole bunch of messages, but there is one within. Yes. So if you've got a sense of that, or rather than publishing every 10 seconds,
50:10
can you say for every single message, override the previous retained? So you've always got that. Yeah, the question for the camera, the question is,
50:24
if I have a publisher which publishes every 10 seconds, can I have the publisher or can I have the broker sort of retain every sixth or every ninth or every whatever? And no, that's not possible. That's the application I would have to do. So your publisher would have to, module six, set the retail plan.
51:11
Oh, it just came into my watch. It's very reliable and very quick. And it's very interesting when you do
51:23
cluster SSH stuff, 850 host. Now I can show you a little bit of that.