nagios conference 2014 - trevor mcdonald - monitoring the physical world with nagios and arduino

Download Nagios Conference 2014 - Trevor McDonald - Monitoring The Physical World With Nagios and Arduino

If you can't read please download the document

Upload: nagios

Post on 16-Apr-2017

797 views

Category:

Technology


2 download

TRANSCRIPT

PowerPoint Presentation

Monitoring the Physical World
with Nagios and Arduino

Trevor McDonald

[email protected]

http://github.com/tmcnag

Who Am I?

Support Tech at Nagios Enterprisestmcdonald on Support Forum

Docs, Bugs, Testing, Perl

Other Things I Do:World Languages

Computer Security

Electronics

- 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

Who Am I Not?

Affiliated with ArduinoNot being paid to advertise

All images copyright their respective owners

Iron Man

- 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

Who Am I Not?

Affiliated with ArduinoNot being paid to advertise

All images copyright their respective owners

Iron Man (yet)

- 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

What's This Talk About?

Physical Monitors:Temperature

Humidity

Light

Motion

Open/Close of Doors/Windows

- 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

How Do We Do That?

Existing Solutions:Closed-source

Limited scope

Expensive* ($1,000+)

Arduino:100% open-source

Customizable

Cheap ($5 to $50)

- Closed-source prevents modification- Related to closed-source, if they don'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

What is Arduino?

Arduino Uno8-bit Microprocessor

32K Flash Memory

2K RAM

16 MHz Clock Speed

Runs on 5V

14 Digital + 6 Analog I/O Pins

- The GPIO is what sets this apart from just a small computer

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

- Don'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 ]

How Does It Work?

Hardware is attached to pins

Each I/O pin either reads or writes dataReading 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

- Hardware can be input: buttons, switches, light sensors, pressure pads; or output: lights, motors, buzzers, speakers

A Simple Blink

[ Picture of LED breadboard ]

A Simple Blink

[ Example Blink sketch ]

- Explain setup() and loop() sections

A Simple Blink

Button Press

Button Press

Button Press

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)

- And to do that, we are going to use Shields

Arduino Shields

Stack on top of and expand an ArduinoRelay 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

- Essentially a piece of hardware of similar shape and size

Ethernet Shield

- Note the pin passthrough and the ethernet jack- Handles all the low-level networking details

Introducing Nagduino

C++ library I built to facilitate NRDP callsNo NSCA (not enough RAM for crypto)

No SNMP Traps (not enough patience)

Very small, very simple code6 lines to get you going

Bells + whistles not includedNo checking NRDP result

Debug code? What debug code?

- 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

Putting It All Together

Magnetic sensor attached to input

Arduino checks sensor on a loop

If open, send NRDP Critical to NagiosLatch to avoid repeat messages

If closed, do nothing and loopReset latch, re-check every 100ms

Alert based on preferences/settings

- Here's how the demo will hopefully play out- Nagios takes over at the end and it is just like any other passive check

The Hardware

- Basically a switch just like with the LED example

The Code

- Explain the object creation- Explain sendNRDP() call- Explain loop + latching

The Code

- Explain the object creation- Explain sendNRDP() call- Explain loop + latching

Live Demo

Tying In With Nagios

GraphingView historical information

Capacity planning (XI)

Use multistacked graphs for correlations (XI)

Physical Event HandlersTurn on fan if temp is Warning

Turn on AC if temp is Critical

- Capacity planning could relate to body weight

Use Cases

Applications in:Farming (soil moisture, temp, light)

Security (light, motion, sound, contacts)

Home Automation (temp, light, infrared LED)

Beekeeping (Talk to Sally Reich)

- Sally's talk is mostly theory

Moving Forward

Support for NSCA + SNMP Traps

Web interface (CCM for Arduino checks)

Beyond ArduinoRaspberry Pi (I'm looking at you, Dave)

Smartphone (Mobile environment readings)

Intel Edison (Very cool)

- Some things I would like to see down the road- Raspberry Pi = Dave Williams

Questions?

Thank You!

If there is time at the end, talk about personal projects using Arduino?

The End

Trevor McDonald

[email protected]

http://github.com/tmcnag

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

Click to edit Master title style

Click to edit Master subtitle style

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

10/22/14

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

PRESENTATION TITLE

Presenter Name

10/22/14

[email protected]

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

PRESENTATION TITLE

Presenter Name

10/22/14

[email protected]

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14

Click to edit Master title style

10/22/14

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles

10/22/14

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles

Second level

Third level

Fourth level

Fifth level

10/22/14

Click to edit Master title style

Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level

10/22/14