Feature Rich Nagios Clock

Introduction: Feature Rich Nagios Clock

This one is for sysadmin's like me who like to know when things go wrong before your boss starts screeming. With the feature rich Nagios clock, you will never miss anything hapennig on you network any more.

Step 1: What I Used.... or What You'll Need.

Hello Sysadmin builders working in the shadow for a smoother world. Did it ever happened to you to be so deeply immersed in intense work that you forgot to keep an eye on your favorite monitoring tool for such a long time that you didn't notice a server failing slowly. Until you boss rushes in shouting mad. Screeming at you for answers you obviously don't have since you weren't even aware of the issue ?

Well, if it never happened to you you are lucky. It happens to me from time to time. well... it used to happen to me. I should say cause now, I have my "feature rich Nagios Clock" ;-) **- Yes yes yes, i am pretty proud of the name... -**

Not only it displays the time, but also, with just a super quick look at the display you will be aware of every potential issues currently happenning on the network under your suppervision. And all of that from scrap pieces reclaimed on decommissionned electronic gambling machines. But of course, it you don't have an electronique gambling machine to scrap pieces from, you can find identical pieces on many old electronic devices or even buy them 2nd hand.

Here is the list of the parts I used.

- A raspberry PI (I am using a PI model 2 with a 40 pin GPIO, though any model would fit just fine, if you decide to use another one, you'll have to make the nessesary pin connection adjustments.)

- A clear plastic document holder.

- wires

- a 5v regulator (LM7805)

- 2 capacitors

- A cooler (for the regulator) -- optional

- A 5volts ac-dc adaptor

- A 16 segment 16 caracters vacuum fluorecent display. (model no: 16lf01ua12)

And, last but not least ... ... A nagios server and a network of machines to monitor.

Step 2: Connecting It All Together

Now that you're all enthousiast about this awesome feature rich nagios clock, let's see how it works.

The raspberry pi is pretty well documented, and finding out what GPIO Pin does what is just a matter of googling...

On the other hand, the pinout for the VFD was mutch trickier to workout. A close look at the components on the display module reveled the controler is an MSC1937-1. (and datasheet for this is largely available)... looking at the datasheet, I was able to figur where the SCLK, DATA, RST, VCC and GND are on the display processor. following them on the pcd (a multimeter did greatly help) gave me the following : VCC pin is on 1 and 2, GND is connected to pin 11 and 12, SCLK goes to pin 7 and DATA is on pin 10. RST goes from the controler to a quad nand gate who's input ends on pin 9. (Be ware !! the NAND gate reverses the signal, so when the controlers datasheet tells you RST is active HIGH, you have to set it to LOW in order to use the display... smarty manufacturers ;-) ) the rest is either not connected, or undifined but we already know enough to use it.

Now that you know where to plug what, a good way to start would be The Power !

Every electonic applyances needs to be powered... and sensitive electronic devices needs a nice regulated power suply.

Because I didn't want to have multiple power supplie hooked to my Nagios clock, I decided to power the raspberry PI directly using it's GPIO pins. Since the +5v GPIO Pins (pin 2 and 4) are not protected, be very cautious with what you feed your raspberry pi. (If you don't, you'll turn your raspberry pi into a nice little smoke generator that will only work once.). When you take this option, the power supply must be a neat 5volts regulated power supply. Luckily, this isn't somthing hard to build. 2 capa and a regulator does the trick. Now that you have a nice and smooth 5 volt power supply, connect the ground to pin 6 of raspberry pi and pin 11 of the display. And of course, connect the regulated +5v to pin 4 of raspberry pi and and pin 1 of the VFD.

The rest is straigh forward, connect the following :

SCLK - Raspberry PI pin 11 --> VFD pin 7

DATA - Raspberry PI pin 13 --> VFD pin 10

RST - Raspberry PI pin 16 --> VFD pin 9

Once you did all that power the regulator with 5 volts from the mains adaptor and.... TADAA.... nothing happens. :-(.... hey... cheer up, that's normal. ;-) the only thing you should see at this point, is the raspebrry pi power and activity leds glowing faintly. But we are making good progress. and we are almost ready to display messages on our awesome display.

Step 3: Software : the Dirplay Driver

The display driver, is a piece of software that reads messages from an input pipe and generates the ad-hoc signals on the SCLK, DATA and RST lines to comunicate with the display in order to have the display behave as we would like (Display stuff, clear display, move cursor and set brightness).

I am not going to go over the configuration of raspbian here -- there are plenty tutorials out there to explain how to do it. All I will say, is this : To continue with this instructable you need an ssh access to a raspbian with all requiered packets to compile cpp source code.

before you start the display driver, you need to have a named pipe to comunicate with the driver.

to create one, type the command : mkfifo /tmp/nagios_fifo

then compile the display driver : gcc -Wall -o display display.cpp -lwiringPi -lm -lstdc++

the display driver code was inspired by the code for arduino found on


and start it in background : ./display &

The display should wake up and show a nice welcom animation.

then you can send him commands in the following way :

echo "COMMAND" > /tmp/nagios_fifo

where command can be any of the following :

"Hello world" - A string to display on the screeen

\boot - fires the bootsequence animation.

\reset - resets the display screen

\brightness:X - Set brightness lever to X (must be a integer between 0 and 31)

\resetall:C - Reset the display and fill it wiht char C

\position:X - Set the cursor position to X (must be an integer in the range 1 - 16)

Step 4: The Software - Part II : the Message Formating.

AH !.... It's nice.... it's pretty and it is super fun to be able to write messages on that VFD. But you'll get tired of that pretty fast (Well... at least I would). So, let's do something really useful with that now. Let's program that raspberry PI to querry our nagios server for overall network health and display ad-hoc information on the VFD.

I am pretty sure there are many ways to achieve this, but a convenient one for me was to use a nagios plugin called "nagios2json". This easy to install plugin creates a plain text report in a table like format about every failing services monitored by the nagios server.

host1 | check_ups | UNKNOWN | ACK | 0d 23h 59m 53s | "Unknown error."

host2 | check_temp | CRITICAL | ___ | 13d 10h 48m 25s | "zone 5 too hot."

host2 | check_fan | CRITICAL | ___ | 9d 7h 6m 22s | "fan 100%"

From left to right you have the following informations : Host name reporting the issue, name of the failed check, status of that check (can be : unknown, warning or critical), an acknolegement flag, how long was the service in that actual state, and a comment.

To get that information on the raspberry pi, I setup a user on the nagios server who can only issue one command :

/usr/lib/cgi-bin/nagios3/nagios2json.cgi (the command to get the service table). you can configure this in the /etc/passwd file. In order to maximize the security of the nagios server, that user will connect to using a set of RSA keys. Once all thet is ready, run the bash script "format.sh (format.txt attached)" to display the network status on the VFD.

Step 5: Enjoy Knowledge of Your Network Health

All done !

Thank you for reading me all the way here. if you did all exactly as I have, you should have a full feature rich nagios clock that works like this :

when everything is fine on the network, the nagios clock displays the time hours and minutes separated by a blinking colon once per second.

When warning/critical services arises the system start cycling through diferent displays : the First 5 seconds, it displays the time followed by a string of symbols (a 'star' for every critical service, a '+' for every warning and a '_' for every unknown service.) then, for another 5 seconds it shows a count of warning / critical service in a blinking messages to attract attention.

there you go, I whish you all awarness and happy building.

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge