Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Small Things for Monitoring
Search
Jan-Piet Mens
November 17, 2016
Technology
340
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Small Things for Monitoring
Jan-Piet Mens
November 17, 2016
More Decks by Jan-Piet Mens
See All by Jan-Piet Mens
Let's talk about Ansible facts
jpmens
0
240
Introducing OwnTracks
jpmens
0
170
Introducing OwnTracks
jpmens
0
300
Zabbix Low-Level Discovery (LLD) from a C module
jpmens
0
330
MQTT for system administrators (and for the IoT)
jpmens
1
700
Ansible AWX
jpmens
2
1.5k
FLOSS DNS servers
jpmens
0
500
Home automation with openHAB: an Introduction
jpmens
0
710
The Story of OwnTracks
jpmens
2
240
Other Decks in Technology
See All in Technology
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
250
[AWS Summit Japan 2026]迷っているあなたへ_小さな一歩が、やがて自分を助けてくれる
sh_fk2
2
430
感情と身体を置き去りにしない、エンジニアの生きのこり方 ──いまから、ここから「自分の状態」を扱うという選択
saorimurooka
0
360
WebGIS AI Agentの紹介
_shimizu
0
580
From Prompt Engineering to Loop Engineering
shibuiwilliam
1
270
スタートアップにAmazon EKSは早すぎる? マルチプロダクト戦略を加速する Platform Engineeringの実践 / Is Amazon EKS Too Soon for Startups? Practical Platform Engineering to Accelerate a Multi-Product Strategy
elmodev09
1
1.9k
徹底討論!ECS vs EKS!
daitak
3
1.8k
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
160
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
330
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
210
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
210
Multi-Agent並列開発を 安全に回すための技術 / Technology for Safely Multi-Agent Parallel Development
tooppoo
0
210
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
400
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
330
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Statistics for Hackers
jakevdp
799
230k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
Side Projects
sachag
455
43k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Docker and Python
trallard
47
3.9k
Practical Orchestrator
shlominoach
191
11k
Transcript
Small Things for Monitoring Jan-Piet Mens November 2016 @jpmens
@jpmens: consultant, part- time admin, small-scale fiddler, loves DNS, plain
text, and things that work. Dreamed up OwnTracks & wrote jo
Today’s special MQTT ESP8266 for monitoring stuff
MQTT is a standard, a transport, PUB/SUB messaging, designed for
unreliable networks MQTT
security TLS authentication ACLs TLS-PSK (payload encryption)
Quality of Service 0 At most once 1 Assured delivery
2 Once only
topic names UTF-8, hierarchical, wildcards temperature/room/living devices/# finance/+/eur/rate
PUB/SUB cauldron
MQTT brokers the server bit of MQTT
Mosquitto C, fast, lightweight, ACLs (plugin), TLS, TLS-PSK, bridge, Websockets,
logging via $SYS, FLOSS http://mosquitto.org
bridging
CLI utilities mosquitto_sub -v [-h localhost] [-p 1883] [--cafile file]
[--cert file --key file] [-u username [-P password]] -t 'topic/#' subscribe publish mosquitto_pub ... [-r] -t topic -m payload
languages Lua, Python, C, JavaScript, Perl, Ruby, Java, ...
Python API: PUB #!/usr/bin/env python import paho.mqtt.publish as mqtt mqtt.single('conf/hello',
'Hello MQTT') $ mosquitto_sub -h localhost -v -t 'conf/#' conf/hello Hello MQTT payload topic
Python API: SUB callbacks #!/usr/bin/env python import paho.mqtt.client as paho
def on_connect(mosq, userdata, rc): mqttc.subscribe("conf/+", 0) def on_message(mosq, userdata, msg): print "%s %s" % (msg.topic, str(msg.payload)) mqttc = paho.Client(userdata=None) mqttc.on_connect = on_connect mqttc.on_message = on_message mqttc.connect("localhost", 1883, 60) mqttc.loop_forever()
Python API: SUB $ mosquitto_pub -t 'conf/thirsty' -m 'Beertime?' $
mosquitto_pub -t 'conf/catering' -m 'Coffee is ready' $ ./sub.py conf/thirsty Beertime? conf/catering Coffee is ready
The hardware … EUR 22.83 Flash/RAM 16 / 64 USB
2 LAN/WAN 1 / 1 WiFi 802.11 b/g/n GL-Inet AR150
Small, but too much EUR 50 - 100
ESP8266 Low-cost micro controller full TCP/IP stack A bit like
an Arduino (same IDE, or Lua) but with on-board WiFi (!) and really inexpensive Different form factors
ESP8266 EUR 1.50 ESP-01 EUR 2.60 NodeMCU EUR 1.50 ESP-12
Electrodragon EUR 5.50 http://www.electrodragon.com
Sonoff EUR 4.47 https://www.itead.cc/sonoff-wifi-wireless-switch.html
Wemos D1 mini EUR 4.00 Flash/RAM 4MB / 64 KB
Voltage 3.3V Digital I/O 11 Analog 1
Wemos shields EUR 1.95 EUR 4.50 EUR 1.40 EUR 2.90
Homie-ESP8266 #include <Homie.h> HomieNode buttonNode("button", "button"); void loopHandler() { int
buttonValue = debouncer.read(); /* ... */ if (Homie.setNodeProperty(buttonNode, "open", buttonValue ? "true" : "false", true)) { } } void setup() { debouncer.attach(PIN_BUTTON); Homie.setFirmware("button-homie", "1.0.0"); Homie.registerNode(buttonNode); Homie.setLoopFunction(loopHandler); Homie.setup(); } void loop() { Homie.loop(); debouncer.update(); } https://github.com/marvinroger/homie-esp8266
Arduino IDE
Le bouton devices/cea191e0/$nodes button:button devices/cea191e0/$online true devices/cea191e0/$name Le bouton devices/cea191e0/$localip
192.168.8.151 devices/cea191e0/$fwname button-homie devices/cea191e0/$fwversion 1.0.0 devices/cea191e0/$signal 100 devices/cea191e0/button/open true
homie-ota https://github.com/jpmens/homie-ota Retro/Vintage-style
Monitoring Temperature, movement (PIR), humidity, inexpensive sensors, many examples, LWT,
mqttwarn for integration, Node-Red
alerting: mqttwarn https://github.com/jpmens/mqttwarn
practical solutions alerting, metering, logging, location awareness, tracking, automation, and
controlling, host monitoring
MQTT in the wild Graylog, beaver, Ansible, RabbitMQ, collectd, openHAB,
Github, Wireshark, Flukso, RemakeElectric, Jenkins, Diamond, OwnTracks
mqtt.org @mqttorg
Particle Photon EUR 19.00
Particle Electron EUR 70.00
Omega2