Nagios Notifications Using an Arduino Driven RGB Mood Light

As a systems administrator monitoring systems are what let me sleep at night and allow me to be responsive to problems. Nagios (www.nagios.org) employs a scale of responses going from noticing a problem to automatically taking action then sending notifications. For notifications I use a combination of push e-mails and SMS messages. In the office and the datacenter I wanted a visual indicator that kicked in at the noticing problem stage - well before notifications were sent. This project is the result.

The project requirements were:

The final design used: The EtherTen provided in a single board an Ethernet interface and an SD card - the SD card provided a simple mechanism for configuring the project. In particular, it allowed easy configuration of the MAC address and IP parameters by writing a text configuration file onto the SD card on a separate computer.

Connection Diagram

The Arduino sketch (RGBLightShow.ino):

The sketch employs a custom library (ConfigFile.zip) that parses a simple key value configuration file. Configuration files may contain comments delimited by a hash ("#") and terminiated by a new line. Keys and values are separated by an equals ("=") sign and terminated by a new line. The library employs a simple state machine design. As with all library files the library should be unpacked in your library folder to install it.

The Nagios interface is provided by a small Perl program trafficlights.pl run out of inetd. The program uses Nagios::StatusLog module available from CPAN. The module reads the status log and chooses a color based on whether hosts are critical or unreachable or services are critical or warning otherwise everything is green. The program checks for a flag file ("/tmp/moodoff") that turns off the mood light if it is present.

The design takes security and scalability into account. On the security side the Arduino board acts as a client which polls the Nagios server. Access to the server can be controlled through firewall rules or tcpwrappers. The script on the Nagios server only provides information and takes no input so is easily secured against attackes. The Arduino code is a client only and uses only a single character read which while although inefficient limits opertunities for buffer overruns - provided the base Arduino TCP stack works correctly. Furthremore, it is anticipated that the client is likely to be run behind firewalls on non-public networks therefore somewhat protected from attacks. Scalability is managed through making the Nagios server do most of the work when new clients are added and through having a contollable query interval.

Files:

Links:


Back to Electronics / Blog: OddsAndEnds: An Occassional Blog by a Specialising Non-Specialist / Twitter: @MauriceDCastro