 וקרובר. אוקיי, אני יכול להסתכל על קרובר. מהו? אני sẽ שלמוד על מ comunication-פרוטוקול, מודבאס. כשכי יודע מה די-באס'י? אוקיי, אניהיית את זה. אוקיי, תלמוד אוקיי. אוקיי. As you understand, the galaxy depends on choosing the right protocol for your instrument. So I'm going to talk about a protocol called Modbus, which is a very simple protocol, but it's very good for small devices, as it is simple. Now we saw the movie, and who I am, my name is Yaakov Zanir, I'm a software engineer at Red Hat, and basically what I do is gather metrics from the cloud. A cloud, you know what the cloud is, cloud is a lot of computers and it's not very visible, and I collect metrics from it. And I used to work in a company that manufactures measurement equipment that measured real-life things. It measured electricity, it measured heat, and when I started measuring the cloud, I saw very cute free software for measuring metrics. And I said, we have to do it for real things. So we ended up in very nice and very robust dashboard for the Internet of Things, and I'm going to talk about these tools. Okay, I have to, they're paying for me to come here, so Manage IQ, I work for a free software called Manage IQ. We are on GitHub, we even have a Shboof here. Okay, so any, I'll just look at the time, okay, any gathering metrics will need these three parts to work. It needs a collector, which is the software that collects the metrics and put it into a database. We need a database, and we need some program that will show us the data that we collect. And when we start working with clouds, we have a lot of data. So a regular database will start not working so well, and we need to replicate and use more nodes, more compute nodes for data. And that's why we are not using a traditional database. We'll use something like Hocular, which is a database that can replicate on many nodes, and I think it's time for the demo. Yes. Okay, so the demo, this is the good part. So what we are doing, I have to find my web browser. It doesn't work, okay, I will start it. And what we see here is nothing. I will go to the power meters, which work now. I started it when we started the last talk, so we have half an hour of data. And what we see here is a dashboard. It is called Gafana. It is well-tested, many people love it, and it's really used very much in cloud metering. So we know it works. And it's very cute to work with. I don't understand the time here, but I think if we'll have time, I'll show how you play with it. It's very, very cute. Many people love it. And the next thing that I'm going to show is the Hocular database. In this demo, I didn't really use Hocular. I used a mock Hocular, which we use for testing, because a real Hocular doesn't play well with one laptop. It needs a cloud to work well. So what you see here are the RESTful API of Hocular, and data is getting pushed. The data that is getting pushed is what you see here. This is the collector, and it collects electric measurement from a real device that somewhere on the internet. And people pay electricity by these values. So there are real values from a real controller somewhere. Okay. And now for the really tricky part, I'm going to show that this protocol, the Modus protocol, is very robust, and it works from the box. So if some of you worship Saturn or something, it's now time to... I'm going to try to make it work out of the box. And anyone who ever tried these things will know that it's not easy. Okay. Silence in the audience. Okay. I prepared a thing that doesn't look that it's going to work. So this is an ESP. Now I hope that most of the audience know what it is, and it doesn't... I didn't connect it well, so okay. I wanted to make this demonstration using the Wi-Fi, but I got told that the Wi-Fi doesn't work here so good. So I last night set and reprogrammed it to work on serial. The Modus protocol is very nice on this. First, it's simple. So it was simple to convert it to working on serial line. And the next thing, it has a dialect. So there's a dialect for talking over Wi-Fi. There's a dialect talking over serial lines. Hold this, please. Okay. And now I'm going to start it. And maybe it will work. Maybe not. If it will work, it will be very nice. And we'll start. Okay. Yeah! It was. I'm really happy. It doesn't work. So what we see here is the temperature of his hand. I'll hold it. Okay. So it will get hotter. I hope if it's not a zombie or something. And you see it's getting hotter. And what we know is that our collector, that use Modbus, works out of the box in this very flimsy setup. And now we have the collector. And as I showed you before, we have the database. And this database is restful, use restful API to get data into it and get data out of it. And what we see here is getting data in. This call is getting data in. And we'll get, these are getting data out into our dashboard. And now when I go into temperature and humidity, we'll get data. And if you use, someone is a zombie in the audience. Okay. We'll just make it and it will. Okay. So we saw the collectors. We saw the database. And we saw the visualizer. And the main theme of this is there will be talks about message queuing and really fancy protocols to talk between devices. But the old protocol, Modbus was invented 30 years ago. And many devices today use it. As I showed you, the power meter that I showed you is a real power meter. People use it. People pay by what it says. And this is a good protocol. A message queuing has its place. Fancy protocols has its place. But old protocols also has their places. And we get a really nice dashboard. Okay. So that was over. I will close that and close it. And I have to find the presentation. Okay. And the next thing. So what we saw here is a very old protocol that works. And it works well. And it comes from a world of industrial controllers where people are very conservative. That's why they still use something for 30 years ago. Okay. For using this Modbus, we used a Node.js client of Modbus. But they are Python client of Modbus, Java client of Modbus. Every language of Modbus is very popular and used. Okay. So how do you install this client of Modbus to get working? So anyone knows NPN? Okay. So all you do is NPN install Modbus client. And it installed the Modbus client. And you can start collecting data from a device that knows Modbus. A lot of devices know Modbus because it's free. It's not a free protocol. But it's a protocol published. And everyone can use it and it's cheap. And it doesn't use CPU and memory. So a lot of devices use it. You need a database. So you can install a client for a database. This is a client for Hocular. As I said, I didn't use a regular database because I wanted to scale. When we were talking about Internet, we have a lot of clients. And we don't want something that on our thousand clients will start slowing down. We want something that can replicate itself on the Internet. As I said, for this demo, I didn't use something that can replicate. I use SQLite. SQLite doesn't replicate well, but it's a good database. And what I did was rep SQLite in the RESTful API of Hocular. So all my system thinks that it talks to Hocular, but it talks to SQLite. And as you've seen, it works well. And this is all that it takes to get this dashboard working. So it's very cute. What you see here is a hobby device, an ESP. And it talks Modbus. You have the code to make it talk Modbus over here. And as I said, Modbus is really used heavily in devices. So you can meet a lot of devices that actually speak Modbus. Many devices speak Modbus, and you wouldn't know it because the manufacturer taught it to talk Modbus, but in the brochure, it's not sexy to say, I'm talking Modbus. But they do talk Modbus. This is... Okay. The red one is how much I left? Yes, that's right. It's very confusing. You have two. So what we have here is how the code in this device works. Modbus is a very simple protocol. It's simply damp memory of your device and let you write into the memory of the device, which is very dangerous. So you don't really let people write into the memory of your device. You make a setter and a getter, and when the protocol said write into this memory location, this data, you... and then you write what you want. Or if, for example, you decide that if you write to this memory location, the device will erase its arms, it will do so. It's not have to be writing into the memory. And what we have here is the device and what function will run when some Modbus device command is called. The collectors. Okay. So as I said, to get a system that collects metrics and show it will need three components. One is the collector, one is the database, and one is the viewer. And here are examples of collectors. I think I have the code next. Okay. So you can write a collector in any language you want, but for this demo, I choose bash, because if you can do it in bash, you can do it anywhere. It's there. What we have here is a command for the bash client. It usually demand a password, and it usually use a secure, not HTTP, but HTTPS. But as I said, I'm using SQLite and not a real Hocula. The next thing is the Modbus client. And it can read either from TCP or from Serial device. And I added there a time-out command, because things can happen. Things can happen. So we need a time-out not to crush our collector because our collector needs to run. It needs to run whatever happens. So we have fail safes on our command, and then we simply collect the data and send it into our database. And Datastore, basically you can use a simple database, any database you can write to file, but if you want to really do it on the web scale, you need a database that can replicate itself. There's a lot of them, but I use Hocula because that's what I use for collecting metrics from the cloud. Okay, getting Hocula running is not easy. It's depending on your web. So for this demo, I didn't use a real Hocula. I use a mockup. We use it for testing. It's not designed to work. All the things that I showed in hard, they can work. This is the only part that is testing software, but it works and SQLite is not as bad as people say. Okay, and Grafana. Grafana is a very cute way to visualize things, and you saw it, and we come to questions. Okay. That question is what is this? This is a water vaporizer, and it speaks batching. Okay. Okay.