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”
Leave a Reply
You must be logged in to post a comment.
August 26th, 2009 at 3:23 am
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
August 26th, 2009 at 8:24 am
Do you have any more information, like scripts that feed the display and so on?