mark: Archive for February, 2008

Splunk2LCD : Display your Alerts on an LCD

This morning I got a nice little LCD from Crystalfontz that allows me to connect to it via the open source project lcdproc. After a bit of compiling and installing, LCDproc (which runs natively on linux, darwin (osx) and most other unix distros) connects to any serial, parallel or USB LCD device. In this case, the Crystalfontz LCD is 4 line by 20 character display.

Splunk2LCD

Once configured and connected, you start the server and accept connections.

I then grabbed the IO-LCDproc perl module and modified it to display to the LCDproc server. You can get the IO-LCDproc through CPAN.

Here is the code that would go in your $SPLUNK_HOME/bin/scripts directory

[source:python]
#!/use/bin/perl -w
use IO::LCDproc;
use IO::Socket;
use strict;

&usage if (! $ARGV[0]);

my $client = IO::LCDproc::Client->new(host => “localhost”, name => “MYNAME”, port => “13666″);

my $screen = IO::LCDproc::Screen->new(name => “screen”);

my $title = IO::LCDproc::Widget->new( name => “date”, type => “title”);

my $first = IO::LCDproc::Widget->new(
name => “first”, align => “center”, type => “string”, xPos => 1, yPos => 2,
data => “test”);
my $second = IO::LCDproc::Widget->new(
name => “second”, align => “center”, type => “string”, xPos => 1, yPos => 3
);
my $third = IO::LCDproc::Widget->new(
name => “third”, align => “center”, type => “string”, xPos => 1, yPos => 4
);