The document discusses using Arduino boards and the Nagduino library to monitor physical environments and send sensor data to Nagios for monitoring. Arduino allows reading inputs from sensors like temperature, humidity, and motion sensors using code. The Nagduino library facilitates sending passive check results from Arduino to Nagios via NRDP. A live demo shows a magnetic sensor detecting door openings and closings, sending alerts to Nagios. Future directions include supporting additional protocols and interfaces to expand physical monitoring with Nagios.
1. Monitoring the Physical World
with Nagios and Arduino
Trevor McDonald
tmcdonald@nagios.com
http://github.com/tmcnag
2. Who Am I?
● Support Tech at Nagios Enterprises
– tmcdonald on Support Forum
– Docs, Bugs, Testing, PPeerrll
● Other Things I Do:
– World Languages
– Computer Security
– Electronics
3. Who Am I Not?
● Affiliated with Arduino
– Not being paid to advertise
– All images copyright their respective owners
– <Legal disclaimer here>
● Iron Man
4. Who Am I Not?
● Affiliated with Arduino
– Not being paid to advertise
– All images copyright their respective owners
– <Legal disclaimer here>
● Iron Man (yet)
5. What's This Talk About?
● Physical Monitors:
– Temperature
– Humidity
– Light
– Motion
– Open/Close of Doors/Windows
6. How Do We Do That?
● Existing Solutions:
– Closed-source
– Limited scope
– Expensive* ($1,000+)
● Arduino:
– 100% open-source
– Customizable
– Cheap ($5 to $50)
7. What is Arduino?
● Arduino Uno
– 8-bit Microprocessor
– 32K Flash Memory
– 2K RAM
– 16 MHz Clock Speed
– Runs on 5V
– 14 Digital + 6 Analog I/O Pins
8. Assumptions
● You know a bit of C/C++
● You understand passive checks (NRDP)
● You understand the following:
– Flip switch up, light goes on
– Flip switch down, light goes off
– AKA “Digital logic”
9. How Does It Work?
● Hardware is attached to pins
● Each I/O pin either reads or writes data
– Reading might detect if a button is pressed
– Writing could turn on a LED or motor
● Pins can be configured for either task
● Regular C code is used to control pins
and handle program logic
16. The Missing Link
● We're able to...
– Read the state of a button/switch
– Take action accordingly (light an LED)
● We want to...
– Send passive results to Nagios
● So we need...
– Networking capability (HTTP for NRDP)
17. Arduino Shields
● Stack on top of and expand an Arduino
– Relay shield for high-powered device control
– MP3 shield for adding quality audio output
– LCD + buttons shield for a basic UI
– Ethernet shield for network connectivity
● Relatively cheap ($30 to $60 on average)
● Save on RAM, CPU, code, and time
19. Introducing Nagduino
● C++ “library” I built to facilitate NRDP calls
– No NSCA (not enough RAM for crypto)
– No SNMP Traps (not enough patience)
● Very small, very simple code
– 6 lines to get you going
● Bells + whistles not included
– No checking NRDP result
– Debug code? What debug code?
20. Putting It All Together
● Magnetic sensor attached to input
● Arduino checks sensor on a loop
● If open, send NRDP Critical to Nagios
– “Latch” to avoid repeat messages
● If closed, do nothing and loop
– Reset latch, re-check every 100ms
● Alert based on preferences/settings
25. Tying In With Nagios
● Graphing
– View historical information
– Capacity planning (XI)
– Use multistacked graphs for correlations (XI)
● Physical Event Handlers
– Turn on fan if temp is Warning
– Turn on AC if temp is Critical
29. The End
Trevor McDonald
tmcdonald@nagios.com
http://github.com/tmcnag
Editor's Notes
- Interested in talking if they speak another lang.
- Degree in forensics, work with Spenser on sec.
- Electronics hobbyist “which brings me to what this talk is all about”
- Interested in talking if they speak another lang.
- Degree in forensics, work with Spenser on sec.
- Electronics hobbyist “which brings me to what this talk is all about”
- Interested in talking if they speak another lang.
- Degree in forensics, work with Spenser on sec.
- Electronics hobbyist “which brings me to what this talk is all about”
- Traditional monitoring targets software
- The physical world can be just as critical
- What are some things you might want to monitor in the physical world?
- Temp without humidity could be problematic
- Light + Motion for security system
- “But today we are going to focus on detecting the state of a door or window”
- Closed-source prevents modification
- Related to closed-source, if they don&apos;t do what you want you either buy another device or make do
- Expense is relative, and you get what you pay for, but not everyone can afford it
- Hardware and software is open-source
- Customizable means no lock-in
- Price starts low at $5 for a Micro and goes up for the Mega
- The GPIO is what sets this apart from just a small computer
- Don&apos;t have to be a C guru, but at least be able to read basic code
- Experience with other languages could probably fit as well
- [ Give brief overview of 1/0, on/off, HIGH/LOW ]
- Hardware can be input: buttons, switches, light sensors, pressure pads; or output: lights, motors, buzzers, speakers
- Explain setup() and loop() sections
- And to do that, we are going to use Shields
- Essentially a piece of hardware of similar shape and size
- Note the pin passthrough and the ethernet jack
- Handles all the low-level networking details
- I use the term “library” loosely – it is only a single function right now
- More powerful models might be able to handle crypto
- Netduino is a library that handles SNMP Get but not Trap
- Reiterate: I am not a professional programmer
- This was all done in my spare time
- Here&apos;s how the demo will hopefully play out
- Nagios takes over at the end and it is just like any other passive check
- Basically a switch just like with the LED example