====== Column Overview ====== ^ Author | [[ gudm00@gmail.com | Gudmundur Ingvarsson ]] | ^ Compatibility | Xymon 4.2+ | ^ Requirements | Perl | ^ Download | http://sourceforge.net/projects/xymonesxi/files/redboard-imagepack.tar.gz/download | ^ Last Update | 2012-04-11 | ===== Description ===== When you click on a column header link you get a overview page for that test that displays the status of all hosts using the given test. ===== Installation ===== Find a this line in your hobbitserver.cfg and change it to this COLUMNDOCURL="$CGIBINURL/hobbitcolumn.sh?%s" # URL formatting string for column-links hobbitcolumn.sh goes under the base cgi-bin directory bb-csvinfo.cgi goes under the web cgi-bin directory dashboard_header goes under the server/web directory with the rest of the headers. Enjoy! ===== Source ===== ==== hobbitcolumn.sh ==== #!/bin/sh QS="${QUERY_STRING}" QUERY_STRING="db=columndoc.csv&key=${QS}&nongreen=all" export QUERY_STRING . /usr/local/xymon/server/etc/hobbitcgi.cfg exec /usr/local/xymon/server/bin/bb-csvinfo.cgi $CGI_HOBBITCOLUMN_OPTS ==== bb-csvinfo.cgi ==== #!/usr/local/bin/perl # Written by Gudmundur Orn Ingvarsson # Last update: May 31st 2011 # Please contact me at: gudm00@gmail.com for questions or comments #use strict; use warnings; use diagnostics; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use Math::Complex; # Basic Config Variables $version = "0.1"; my $bb_home = "/usr/local/xymon"; my $bb_header = "$bb_home/server/web/dashboard_header"; # Change this if needed. my $bb_footer = "$bb_home/server/web/edit_footer"; # Change this if needed. my $bb_web = "/"; my $bb_gifs = "/gifs"; my $hobbitcfg="/usr/local/xymon/server/etc/hobbitserver.cfg"; my $hobbitdrel = `$bb_home/server/bin/bb --version | awk '{print \$3}'`; my $BBMENUSKIN = "/menu"; $i = 0; $greencount = 0; $redcount = 0; $bluecount = 0; $yellowcount = 0; $clearcount = 0; $unknowncount = 0; $purplecount = 0; $incoming = $ENV{"QUERY_STRING"}; ($arg1,$arg2,$arg3,$arg4) = split(/\&/, $incoming); ($db,$dbvalue) = split(/\=/, $arg1); ($testkey,$test) = split(/\=/, $arg2); ($non,$green) = split(/\=/, $arg3); $date = localtime; sub print_error() { my $error_msg = shift; my $color = shift || 'clear'; $error = 1; print "
$error_msg

"; } sub header () { # Basic HTML Code at the top print "Content-type: text/html\n\n"; my $color = "black"; open (HEAD, "<$bb_header") or &print_error("I can't open $bb_header for reading!"); while () { if (/META/i && /HTTP-EQUIV/i && /REFRESH/i && /CONTENT/i) { s/<(.*?)>//g; } s/&HOBBITLOGO/$ENV{'HOBBITLOGO'}/g; s/&BBBACKGROUND/$color/g; s/&BBMENUSKIN/$BBMENUSKIN/g; s/&BBPAGEPATH/$ENV{'BBPAGEPATH'}/g; s/&BBSKIN/$ENV{'BBSKIN'}/g; s/&BBDATE/$date/g; print ""; s/\'//g; print; } close HEAD; print ""; if ($green eq "nongreen") { print ""; } else { print ""; } } sub footer () { # Close the HTML Page print "
Full Host Page
Non-Green Page
"; open (FOOT, "<$bb_footer") or &print_error("I can't open $bb_footer for reading!"); while () { s/&BBMENUSKIN/$BBMENUSKIN/g; s/&HOBBITDREL/$hobbitdrel/g; print; } close FOOT; } sub sdd() { # Fetch latest Service Statistics @sddstatus = `/usr/local/xymon/server/bin/bb localhost \"hobbitdboard test=$test\"`; foreach $sddstatus (@sddstatus) { ($host,$test,$color) = split("\\|", $sddstatus); $hostname = $host; if ($color eq "green") { $image = "$bb_gifs/green-recent.gif"; $linkcolor=""; $greencount = $greencount +1; } elsif ($color eq "red") { $image = "$bb_gifs/red-recent.gif"; $linkcolor=""; $redcount = $redcount +1; } elsif ($color eq "blue") { $image = "$bb_gifs/blue-recent.gif"; $linkcolor=""; $bluecount = $bluecount +1; } elsif ($color eq "clear") { $image = "$bb_gifs/clear-recent.gif"; $linkcolor="CLASS=white"; $color="none"; $clearcount = $clearcount +1;} elsif ($color eq "purple") { $image = "$bb_gifs/purple-recent.gif"; $linkcolor=""; $purplecount = $purplecount +1; } elsif ($color eq "unknown") { $image = "$bb_gifs/unknown-recent.gif"; $linkcolor=""; $unknowncount = $unknowncount +1; } elsif ($color eq "yellow") { $image = "$bb_gifs/yellow-recent.gif"; $linkcolor=""; $yellowcount = $yellowcount +1; } unless(($green eq "nongreen")&&($color eq "green")) { push @statusline, "$hostname"; # if ($i > $columns) { push @statusline, ""; $i = 0; } else { $i++; } } } } header(); print "

$test

"; sdd(); $totalcount = $greencount+$redcount+$bluecount+$clearcount+$purplecount+$unknowncount+$yellowcount; if ($green eq "nongreen") { $totalcount = $totalcount - $greencount; $greencount = 0;} if ($totalcount < 10) { $columns = 2; } elsif ($totalcount < 31) { $columns = 3; } elsif ($totalcount < 81) { $columns = 4; } elsif ($totalcount < 125) { $columns = 5; } elsif ($totalcount > 124) { $columns = 6; } print "Total: $totalcount         $greencount     $redcount     $yellowcount     $purplecount     $bluecount     $clearcount     $unknowncount"; foreach $line (@statusline) { if ($i > $columns) { print "$line"; $i = 0; } else { print $line; $i++; } } print ""; footer();
==== dashboard_header ==== &BBBACKGROUND : Xymon - Status @ &BBDATE
 
&HOBBITLOGO
Dashboard
&BBDATE


===== Known Bugs and Issues ===== ===== To Do ===== ===== Credits ===== ===== Changelog ===== * **2012-04-11** * Initial release