Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0

Are you jealous at the cool scrolling signs that stockbrokers have at their offices. Of course, stock rates are boring, it is much more fun/cooler/geekier to have op5 Monitor or Nagios messages at your scrolling LED.


I find one at Clas Ohlson for 37SEK approx 4 EUR, and after a late night with some perl hacking I got it working. The price at the website is incorrect, when you buy it it costs 37SEK, I bought seven so I know:-)


To be able to program it from a Linux machine you need to download e-badge.

My serial port on my op5 Monitor system was occupied by a GSM modem so I used another machine and did a ssh key exchange so I could run remote commands.

Pre. req. to get my script working is the perl module Nagios::StatusLog. If you use op5 Monitor 4.x or Nagios 3.x you have to diff. patch the /usr/lib/perl5/site_perl/5.8.8/Nagios/StatusLog.pm or where your Statuslog.pm are located.


This is the result:


My perl script that collects the data and sends it to the LED display:

#!/usr/bin/perl
#By peter@it-slav.net
use Nagios::StatusLog;
my $log = Nagios::StatusLog->new(
                Filename => "/opt/monitor/var/status.log",
                Version  => 3.0
           );

my @hosts = $log->list_hosts;
foreach my $host (@hosts) {
  my $hcs = $log->host( "$host" );
  if ( $hcs->status eq 'OK' ) {
    my @host_services = $log->list_services_on_host($host);
    foreach my $service (@host_services) {
      my $svcs = $log->service( $host, $service );
      if ( $svcs->status ne 'OK' ) { # only print for service not in OK
                                     # comment out the if () { } to print everything
        my $output = "\'Service $service on $host is ".$svcs->status."\'";
        &sendtoled ($output);
        }

    }
  } else {
    my $output = "\'Host $host is ".$hcs->status."\'";
    &sendtoled ($output);
  }
}

sub sendtoled {
  print length($_[0])." ".$_[0]."\n";
  system "/usr/bin/ssh", "-l", "peter", "192.168.0.153", "/home/peter/dl/e-badge-1.1/e-badge", "-s", "4", "-r", "1", "$_[0]";
  sleep (int(length($_[0])/3+3));
}

The output from the script is the number of characters and the text sent to the LED.

If you want it to run over and over again you can start an infinite while loop:

 [root@op5 nagiostestscript]# while true; do ./monitor_status_to_led.pl ; done
38 'Service OpenVPN Op5 on gw is WARNING'
38 'Service dc0 Errors on gw is CRITICAL'
42 'Service OpenVPN Sjoberg on gw is WARNING'


2 Responses to “Scroll LED for Nagios/op5 Monitor”

  1. Thad Says:

    YouTube actually suggested your video to me based upon mine, which I thought you might be interested in:

    Nagios linked in to a LED Matrix Display
    http://www.youtube.com/watch?v=d-343pVHDbI

  2. peter Says:

    Do you have any more information, like scripts that feed the display and so on?

Leave a Reply





Book reviews
FreePBX 2.5
Powerful Telephony Solutions






Asterisk 1.6
Build a feature rich telephony system with Asterisk






Learning NAGIOS 3.0





Cacti 0.8 Network Monitoring,
Monitor your network with ease!