Column Overview

Author 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

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.

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!

hobbitcolumn.sh

Show Code ?

Hide Code ?

#!/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

Show Code ?

Hide Code ?

#!/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 "<CENTER><B><IMG SRC=\"$bb_gifs/${color}.gif\">$error_msg</FONT></B></CENTER><P>";
}

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 (<HEAD>) {
        if (/META/i && /HTTP-EQUIV/i && /REFRESH/i && /CONTENT/i) { s/<(.*?)>/<!-- Refresh removed -->/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 "<!-- $ENV{'BBDATE'}; -->";
        s/\'//g;
        print;
    }
    close HEAD;
print "<TABLE ALIGN=CENTER BORDER=0>";
if ($green eq "nongreen") { print "<TR><TD ALIGN=CENTER COLSPAN=20><A CLASS=WHITE HREF=\"/xymon-cgi/hobbitcolumn.sh?$test&nongreen=all\">Full Host Page</A></TD></TR><TR>"; }
else { print "<TR><TD ALIGN=CENTER COLSPAN=20><A CLASS=WHITE HREF=\"/xymon-cgi/hobbitcolumn.sh?$test&nongreen=nongreen\">Non-Green Page</A></TD></TR><TR>"; }
}

sub footer () {

# Close the HTML Page
print "</TD></TABLE>";
    open (FOOT, "<$bb_footer") or &print_error("I can't open $bb_footer for reading!");
    while (<FOOT>) {
        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, "<TD CLASS=$color><A $linkcolor HREF=http://hobbit/xymon-cgi/bb-hostsvc.sh?HOST=".$host."&SERVICE=$test>$hostname<IMG BORDER=0 SRC=".$image."></A></TD>";
#       if ($i > $columns) { push @statusline, "</TR><TR>"; $i = 0; } else { $i++; }
        }
}
}

header();
print "<TD ALIGN=CENTER COLSPAN=20><H2>$test</H2></TD></TR><TR>";
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 "<TD ALIGN=CENTER COLSPAN=20>Total: $totalcount  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <IMG SRC=\"$bb_gifs/green-recent.gif\"> $greencount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/red-recent.gif\"> $redcount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/yellow-recent.gif\"> $yellowcount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/purple-recent.gif\"> $purplecount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/blue-recent.gif\"> $bluecount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/clear-recent.gif\"> $clearcount &nbsp;&nbsp;&nbsp;<IMG SRC=\"$bb_gifs/unknown-recent.gif\"> $unknowncount</TD></TR><TR>";
foreach $line (@statusline) {
        if ($i > $columns) { print "$line</TR><TR>"; $i = 0; } else { print $line; $i++; }
}
print "</TABLE>";
footer();

dashboard_header

Show Code ?

Hide Code ?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="60">
<META HTTP-EQUIV="EXPIRES" CONTENT="Sat, 01 Jan 2001 00:00:00 GMT">
<META HTTP-EQUIV="Set-Cookie" CONTENT="pagepath=&BBPAGEPATH; path=/">
<META HTTP-EQUIV="Set-Cookie" CONTENT="host=; path=/">

<TITLE>&BBBACKGROUND : Xymon - Status @ &BBDATE</TITLE>

<!-- Styles for the menu bar -->
<link rel="stylesheet" type="text/css" href="&BBMENUSKIN/menu.css">
<STYLE type=\"text/css\">
body {font-family: Century Gothic, Verdana, Arial, SunSans-Regular, Sans-Serif;background-color: #000000;color:#FFFFFF;padding:0px;margin:0px;text-align: center;white-space: nowrap;vertical-align: center;}
.table{background-color: #007BFF;color:#FFFFFF;font-family: Century Gothic,Verdana;font-size: 12pt;border-collapse: collapse;border-style: solid;border-width: 1px;margin-top: 0px;text-align: center;white-space: nowrap;position:absolute;}
th{background-image: url(/img/bgHeaderS.png);background-repeat: repeat-x;background-color: #000000;white-space: nowrap;text-align: center;font-family: Century Gothic;color:#FFFFFF;font-size: 9pt;padding:4px;margin-left:auto;margin-right:auto;position:relative;vertical-align: center;z-index:0;}
td{font-size: 9pt;vertical-align: top;z-index:0;}
img{border: 0px solid;}
.table_header{background-image: url(/img/bgHeaderR.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic, Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:0px;margin:0px;margin-left:auto;margin-right:auto;margin-top: 0px;position:relative;width:100%;white-space: nowrap;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;z-index:0;}
.table_footer{background-image: url(/img/bgHeaderR.png);background-repeat: repeat-x;background-color: #FFFFFF;font-family: Century Gothic, Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:0px;margin:0px;margin-left:auto;margin-right:auto;margin-top: 0px;position:relative;width:100%;white-space: nowrap;vertical-align: center;z-index:0;}
.page_header{background-image: url(/img/bgHeaderR.png);background-repeat: repeat-x;background-color: #000000;font-size: 22px ;white-space: nowrap;text-align: center;font-family: Century Gothic;color:#FFFFFF;padding:4px;margin-left:auto;margin-right:auto;margin-top: 0px;position:relative;vertical-align: center;z-index:0;}
.host{background-image: url(/img/bgHeaderS.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic;color:#FFFFFF;padding:4px;text-align: center;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;}
.lighter{background-repeat: repeat-x;background-color: #777777;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;z-index:0;font-family: Century Gothic,Verdana;font-size: 9pt;white-space: nowrap;}
.darker{background-repeat: repeat-x;background-color: #444444;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;z-index:0;font-family: Century Gothic,Verdana;font-size: 9pt;white-space: nowrap;}
.tableheader{background-color: #798BA1;font-family: Candara,Verdana;font-size: 11pt;font-style: bold;text-align: center;white-space: nowrap;vertical-align: center;}
input{color: #781351;background: #fee3ad;border: 1px solid #781351}
.submit input{color: #000;background: #ffa20f;border: 2px outset #d7b9c9}
.green{background-image: url(/img/bgHeaderSG.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#000000;text-align: center;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;z-index:0;}
.red{background-image: url(/img/bgHeaderSR.png);background-repeat: repeat-x;background-color: #000000;text-align: center;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#000000;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;}
.critical{background-image: url(/img/bgHeaderSC.gif);background-repeat: repeat-x;background-color: #000000;text-align: center;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#000000;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;}
.yellow{background-image: url(/img/bgHeaderSY.png);background-repeat: repeat-x;background-color: #000000;text-align: center;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#000000;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;}
.purple{background-image: url(/img/bgHeaderSP.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#000000;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;text-align: center;white-space: nowrap;vertical-align: center;}
.blue{background-image: url(/img/bgHeaderSB.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;text-align: center;vertical-align: center;}
.none{background-image: url(/img/bgHeaderSN.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:4px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;width: 0px;z-index:0;}
.normal{background-image: url(/img/bgHeaderSN.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: left;padding:4px;margin:0px auto;margin-left:auto;margin-right:auto;vertical-align: left;width: 0px;z-index:0;}
.v-ellip{text-overflow: ellipsis;-o-text-overflow: ellipsis;-moz-binding: url( 'bindings.xml#ellipsis' );white-space: nowrap;overflow: hidden;display: inline-block;max-width: 400px;text-align: left;line-height: .01em;}
p {text-align: left;margin: .2em;line-height: .01em;padding: .5em;}
.footer{line-height: .002em;background-image: url(/img/bgHeaderR.png);background-repeat: repeat-x;background-color: #000000;font-family: Century Gothic,Verdana, Arial, SunSans-Regular, Sans-Serif;color:#FFFFFF;text-align: center;padding:10px;margin:0px;margin-left:auto;margin-right:auto;position:relative;white-space: nowrap;vertical-align: center;z-index:0;}
A:link    { text-decoration: none; color: #000000; padding: 0px; }
A:visited { text-decoration: none; color: #000000; padding: 0px; }
A:active  { text-decoration: none; color: #000000; padding: 0px; }
A:hover   { text-decoration: none; color: #000000; padding: 0px; }
A.white:link    { text-decoration: none; color: #FFFFFF; padding: 0px; border: 0px solid; }
A.white:visited { text-decoration: none; color: #FFFFFF; padding: 0px; border: 0px solid;}
A.white:active  { text-decoration: none; color: #FFFFFF; padding: 0px; border: 0px solid;}
A.white:hover   { text-decoration: none; color: #FFFFFF; padding: 0px; border: 0px solid;}
</STYLE>

<!-- The favicon image -->
<link rel="shortcut icon" href="&BBSKIN/favicon-&BBBACKGROUND.ico">

</HEAD>

<BODY BGCOLOR="&BBBACKGROUND" BACKGROUND="&BBSKIN/bkg-&BBBACKGROUND.gif" TEXT="#D8D8BF" LINK="#00FFAA" VLINK="#FFFF44">

<TABLE SUMMARY="Topline" WIDTH="100%">
<TR><TD HEIGHT=16>&nbsp;</TD></TR>  <!-- For the menu bar -->
<TR>
  <TD VALIGN=MIDDLE ALIGN=LEFT WIDTH="30%">
    <FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver"><B>&HOBBITLOGO</B></FONT>
  </TD>
  <TD VALIGN=MIDDLE ALIGN=CENTER WIDTH="40%">
    <CENTER><FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver"><B>Dashboard</B></FONT></CENTER>
  </TD>
  <TD VALIGN=MIDDLE ALIGN=RIGHT WIDTH="30%">
   <FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver"><B>&BBDATE</B></FONT>
  </TD>
</TR>
<TR>
  <TD COLSPAN=3> <HR WIDTH="100%"> </TD>
</TR>
</TABLE>
<BR>
  • 2012-04-11
    • Initial release
  • addons/column_overview.txt
  • Last modified: 2012/04/12 08:45
  • (external edit)