#!/usr/bin/perl # # bb-pageinfo.pl # # A perl script which displays the current paging info for a BB display server # # Japheth Cleaver # http://www-rohan.sdsu.edu/~cleaver/software/ # # A heavily modified version of "bb-warnconfig.pl" v0.4, by # Author : Pierre Journel (journel@yahoo.com) # Web page : www.geocities.com/Paris/1070 # ######################################################################## # # INSTALL # # 1 - Put the script in your cgi-bin directory. # - rename to "bb-pageinfo.cgi" if desired # 2 - Modify the $BBHOME to reflect your setup. # 3 - Add the following hyperlink to one of your web pages: # http://your.web.server/cgi-bin/bb-pageinfo.pl(cgi) # # 4 - Click the link you just added! # ######################################################################## # # My changes # -Bug fixes # -Cleaner output/background # -Ignore most of bb-warnsetup.cfg, since I only care about the paging # -Add red background for negative rules # -Add separate tables for host and paging groups # # CHANGES (original) # # Version 0.4 - 15/05/00: # Added an embedded table to list the svcerrlist token in bbwarnstup.cfg. # # Version 0.3 - 11/05/00: # Links to host/service web page added in Services column. # Changed the name of the script from showrules.pl to bb-warnconfig.pl. # Added basic visualization of bbwarnsetup.cfg (not sure if more is needed). # Made it look more like a standard BB page (suggestion from Stephen Bates). # # Version 0.2 - 10/05/00: # First working version. # # Version 0.1 - 10/05/00: # Very early alpha version, not released ;-). # ######################################################################### ######################################################################### # # You SHOULD modify the following line to adjust it to your setup: # $BBHOME="/usr/home/bb/bb18"; $BBWEB="/bb"; $BBSKIN="/bb/gifs"; # ######################################################################### $BBWARNRULES = "$BBHOME/etc/bbwarnrules.cfg"; $BBWARNSETUP = "$BBHOME/etc/bbwarnsetup.cfg"; print ("Content-Type: text/html\n\n"); print qq! <\!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
help |
| = DO NOT notify this recipient (reverse the rule) |
| Hosts monitored | Hosts excluded | Services | Services excluded | Days | Time | Recipients:delay-frequency default frequency = $pagedelay min (^ = Always notify after delay min, ~ = Notify if un-ack'd for delay min) |
| "; } else { print " | ";
@parts = split(/\s+/, $str);
if (($field_num == 3) || ($field_num ==4)) {
#
# This is the Services or Services Excluded column
# So we include the html link to the host/service page.
#
if ( (($fields[0] ne "notify-admin") &&
($fields[0] ne "unmatched-*")) &&
($str ne "*")) {
foreach $part (@parts) {
print qq!
$part !; } } else { # # Exception for the notify-admin and unmatched-* # special hostname # print $str; } } elsif ($field_num == 1) { # # This is the host name so we put it in bold # print "",$str,""; } elsif ($field_num == 5) { # # This is days-of-week, so change from numeric to abbreviation # foreach $part (@parts) { $part =~ y/135/MWF/; $part =~ s/0/Su/g; $part =~ s/2/Tu/g; $part =~ s/4/Th/g; $part =~ s/6/Sa/g; print " "; } } else { # # Rest of the column # foreach $part (@parts) { print " "; } } print " | ";
}
}
print "
"; print "
| $line | $car | |
| Host Groups | ||
| "; print $hgname; print " | $hgdata | |
Paging Groups | ||
| "; print $pgname; print " | $pgdata | |