addons:hobbitnotes

Xymon Notes Editor

Author Galen Johnson
Compatibility Xymon 4.2, Xymon 4.3
Requirements Perl, HTML::FromText, perl-CGI
Download None
Last Update 2017-12-05

A web-based editor for modifying your server notes files in Xymon. Xymon's built-in notes viewer will pick up any changes you make.

  • Install the prerequisite perl modules
  • Create the notesdata directory ($HOBBITSERVER/etc/notesdata) with ownerships and permissions for your webserver to write to it.
    mkdir -m 775 /usr/local/hobbit/server/etc/notesdata
    chgrp apache /usr/local/hobbit/server/etc/notesdata
  • Update the code for your paths
  • Put the header and footer file under $HOBBITSERVER/web
  • Put the bbnote_editor.cgi script under the $HOBBIT/cgi-secure
  • Update your Administration links in $HOBBITSERVER/www/menu/menu_items.js with
    ['Edit Notes', '/hobbit-seccgi/bbnote_editor.cgi'],
  • UPDATE: Ubuntu or Debian users should modify this file instead
     /etc/hobbit/web/menu.cfg
  • Insert the following line in Administration section
 <a class=\"inner\" href=\"$BBSERVERSECURECGIURL/bbnote_editor.cgi\">Edit Notes</a><span class=\"invis\"> | </span> \
  • For xymon 4.3.5 insert following line in $XYMONHOME/server/etc/xymonmenu.cfg
    <a class="inner" href="$XYMONSERVERCGIURL/bbnote_editor.cgi">Edit Notes</a><span class="invis"> | </span>

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 - Notes @ &BBDATE</TITLE>
 
<!-- Styles for the menu bar -->
<link rel="stylesheet" type="text/css" href="&BBMENUSKIN/menu.css">
 
<!-- 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>Current Status</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>

Show Code ⇲

Hide Code ⇱

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
 
<TITLE>Xymon - Notes</TITLE>
 
<script language="javascript" type="text/javascript">
 
<!--
  today = new Date
  weekDayName = new Array ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
  monthName = new Array ("Jan","Feb","March","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
 
  function printDate() {
    document.write(weekDayName[today.getDay()]+ ", " + monthName[today.getMonth()] + " " + today.getDate()+ " " + " " + today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + " " +today.getFullYear())
  }
-->
 
</script>
 
<style type="text/css">
  body {
    background-repeat: repeat-y;
    background-color:black;
   }
</style>
 
 
<!-- Styles for the Xymon body  -->
<link rel="stylesheet" type="text/css" href="&XYMONBODYCSS">
 
<!-- Styles for the menu bar -->
<link rel="stylesheet" type="text/css" href="&XYMONBODYMENUCSS">
 
<!-- The favicon image -->
<link rel="shortcut icon" href="&XYMONSKIN/favicon-&XYMONBACKGROUND.ico">
 
</HEAD>
 
<BODY BGCOLOR="&XYMONBACKGROUND" BACKGROUND="&XYMONSKIN/bkg-&XYMONBACKGROUND.gif" TEXT="#FFFFFF" LINK="#00FFAA" VLINK="#FFFF44">
 
  &XYMONBODYHEADER
 
  <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><A HREF="https://pbrmon.unx.sas.com/xymon/" style="text-decoration: none">&XYMONLOGO</B></FONT>
    </TD>
    <TD VALIGN=MIDDLE ALIGN=CENTER WIDTH="40%">
      <CENTER><FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver"><B>Current Status</B></FONT></CENTER>
    </TD>
    <TD VALIGN=MIDDLE ALIGN=RIGHT WIDTH="30%">
     <FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver"><B><script language="javascript" type="text/javascript">printDate()</script></B></FONT>
    </TD>
  </TR>
  <TR>
    <TD COLSPAN=3> <HR WIDTH="100%"> </TD>
  </TR>
  </TABLE>
  <BR>

Show Code ⇲

Hide Code ⇱

<BR><BR>
 
<TABLE SUMMARY="Bottomline" WIDTH="100%">
<TR>
  <TD> <HR WIDTH="100%"> </TD>
</TR>
<TR>
  <TD ALIGN=RIGHT><FONT FACE="Arial, Helvetica" SIZE="-2" COLOR="silver"><B><A HREF="http://hobbitmon.sourceforge.net/" style="text-decoration: none">Xymon Monitor &HOBBITDREL</A></B></FONT></TD>
</TR>
</TABLE>
 
 
<!-- menu script itself. you should not modify this file -->
<script type="text/javascript" language="JavaScript" src="&BBMENUSKIN/menu.js"></script>
<!-- items structure. menu hierarchy and links are stored there -->
<script type="text/javascript" language="JavaScript" src="&BBMENUSKIN/menu_items.js"></script>
<!-- files with geometry and styles structures -->
<script type="text/javascript" language="JavaScript" src="&BBMENUSKIN/menu_tpl.js"></script>
<script type="text/javascript" language="JavaScript">
        new menu (MENU_ITEMS, MENU_POS);
</script>
 
</BODY>
</HTML>

Show Code ⇲

Hide Code ⇱

  <BR><BR>
 
  <TABLE SUMMARY="Bottomline" WIDTH="100%">
    <TR>
      <TD> <HR WIDTH="100%"> </TD>
    </TR>
    <TR>
      <TD ALIGN=RIGHT><FONT FACE="Arial, Helvetica" SIZE="-2" COLOR="silver"><B><A HREF="http://xymon.sourceforge.net/" style="text-decoration: none">Xymon &XYMONDREL</A></B></FONT></TD>
    </TR>
  </TABLE>
 
</BODY>
</HTML>

Show Code ⇲

Hide Code ⇱

#!/usr/bin/perl
 
#############################################
# Name: bbnote_editor.cgi
# Xymon update: Galen Johnson
# Original Author: Chris Naude
# Purpose: Manage HTML notes files
# Version: 1.0
# The text2html module can be downloaded from CPAN
#############################################
 
use strict;
use CGI ":standard";
use HTML::FromText;
 
# Your $BBHOME
my $bb_home = "/usr/local/hobbit/server";
# hobbit config file
my $hobbitcfg="/usr/local/hobbit/server/etc/hobbitserver.cfg";
# The web path to gifs.
my $bb_gifs = "/hobbit/gifs";
# The main web path for bb display.
my $bb_web  = "/hobbit/";
 
# The actual www notes dir on the server
my $bb_notes  = "$bb_home/www/notes";
# This is where the data files are stored.
# Not to be confused with the default notes dir.
my $bb_notesdata  = "$bb_home/etc/notesdata";
my $bb_header = "$bb_home/web/notes_header"; # Change this if needed.
my $bb_footer = "$bb_home/web/notes_footer"; # Change this if needed.
#Standard bb-hosts file
my $bb_hosts = "$bb_home/etc/bb-hosts";
my $bb_showhosts = "$bb_home/bin/bbhostshow";
 
# No changes needed below.
my $color = "blue";
my %hosts;
my $cmd = param("cmd");
my $host = param("host");
$host =~ s/(.*?)\///g;
$host =~ s/(\.html)$//g;
my $note = param("note");
my @lines;
 
# Set up the environment variables and dynamic variables from hobbitserver.cfg
foreach (`. $hobbitcfg; set`) {
    chomp;
    my ($var,$val) = /^\s*(.*?)\s*=\s*(.*)/;
    $ENV{$var}  = $val;
}
 
sub print_notesdata {
    open (NOTESDATA, "<$bb_notesdata/${host}") or &print_error("I can't read from $bb_notesdata/$host!");
    while (<NOTESDATA>) {
        print;
    }
    close NOTESDATA;
}
 
sub write_notesdata {
    open (NOTESDATA, ">$bb_notesdata/$host") or &print_error("I can't write to $bb_notesdata/$host!");
    print NOTESDATA $note;
    close NOTESDATA;
}
 
sub make_note {
    my ($color) = @_;
    my $note = "$bb_notes/${host}.html";
 
    open (NOTE, ">$note") or &print_error("I can't open $note for writing!");
    select NOTE;
    &print_header($color);
    &print_notesdata;
    &print_footer($color);
    select STDOUT;
    close NOTE;
 
}
 
sub save_note {
    &write_notesdata;
    &make_note('blue');
    &get_note;
    print '<center><b><font color="white">Note saved.</font></b></center><p>';
    &print_note;
}
 
sub edit_note {
    if ($cmd =~ /add html/) {
        my $t2h = HTML::FromText->new({
            blockcode  => 1,
            lines      => 1,
            tables     => 1,
            bullets    => 1,
            numbers    => 1,
            urls       => 1,
            email      => 1,
            bold       => 1,
            underline  => 1,
        });
        $note = $t2h->parse( $note );
        #$note =~ s/\n/<br>/sgi; #
 
    }
    if ($cmd =~ /strip html/) {
        $note =~ s/<.*?>//sgi;
    }
    print <<HTML;
<CENTER><TABLE BORDER="1" CELLPADDING="3><CAPTION><H2><CENTER>$host [$hosts{$host}]</CENTER></H2></CAPTION>
<TR><TD ALIGN="CENTER"><form method="POST"><input type="hidden" name="host" value="$host">
<TEXTAREA ROWS="35" COLS="80" NAME="note" STYLE="background-color:#000066;color:dddddd">
HTML
if ($note) {
    print $note;
} elsif ($lines[0]) {
    print @lines;
} else {
    print '<!-- Remember to use proper HTML formatting here. -->';
}
    print <<HTML;
</TEXTAREA><br>
<input name="cmd" value="preview" type="submit">
<input name="cmd" value="add html tags" type="submit">
<input name="cmd" value="strip html tags" type="submit">
<input name="cmd" value="cancel" type="submit"></form></TD></TR></TABLE></CENTER>
HTML
}
 
sub print_note {
    print <<HTML;
<CENTER><TABLE WIDTH="75%" BORDER="1" CELLPADDING="3"><CAPTION><CENTER><H2>$host [$hosts{$host}]</H2></CENTER></CAPTION><TR><TD>
HTML
    if ($lines[0]) {
        print @lines;
        print <<HTML;
</TD></TR><TR><TD ALIGN="CENTER"><form method="POST"><input type="hidden" name="host" value="$host">
HTML
    } elsif ($cmd =~ /preview/) {
        print <<HTML;
$note</TD></TR><TR><TD ALIGN="CENTER"><form method="POST"><input type="hidden" name="host" value="$host">
<input name="cmd" value="save" type="submit">
HTML
    } else {
        print <<HTML;
The are no notes for $host [$hosts{$host}].</TD></TR>
<TR><TD ALIGN="CENTER"><form method="POST"><input type="hidden" name="host" value="$host">
HTML
}
    print <<HTML;
<input type="hidden" name="note" value='$note'>
<input name="cmd" value="edit" type="submit">
<input name="cmd" value="list" type="submit"></form></TD></TR></TABLE></CENTER>
HTML
}
 
sub print_error {
    my $error = shift;
    print "<center><b><font color=\"red\">$error</font></b></center><p>";
}
 
sub get_note {
    if ( -s "$bb_notesdata/$host") {
        open (NOTE, "<$bb_notesdata/$host") or &print_error("I can't open $bb_notesdata/$host for reading!");
        while (my $note = <NOTE>) {
            push @lines, $note;
        }
        close NOTE;
    }
}
 
sub print_menu{
    print '<CENTER><TABLE BORDER="1" CELLPADDING="3"><CAPTION><H2><CENTER>Xymon Notes</CENTER></H2><b></b></CAPTION>';
    for my $host(sort keys %hosts) {
        print <<HTML;
<TR><TD>$host</TD><TD>$hosts{$host}</TD>
<TD><form method="POST"><input type="hidden" name="host" value="$host">
<input name="cmd" value="view" type="submit">
<input name="cmd" value="edit" type="submit"></form></TD></TR>
HTML
    }
    print '</TABLE></CENTER>';
}
 
sub get_hosts{
    open (HOSTS, "-|", $bb_showhosts, $bb_hosts) or &print_error("I can't open $bb_hosts!");
    while (<HOSTS>) {
        if (/^(\d+\.\d+\.\d+\.\d+)\s+(.*?)\s+/) {
            $hosts{$2} = $1;
        }
    }
    close HOSTS;
}
 
sub print_header {
    my $color = shift;
    print "Content-type: text/html; charset=iso-8859-1\n\n";
    open (HEAD, "<$bb_header") or &print_error("I can't open $bb_header for reading!");
    while (<HEAD>) {
       # It's a bit hard to edit with a refresh ;)
        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/$ENV{'BBMENUSKIN'}/g;
        s/&BBPAGEPATH/$ENV{'BBPAGEPATH'}/g;
        s/&BBSKIN/$ENV{'BBSKIN'}/g;
        s/&BBDATE/$ENV{'BBDATE'}/g;
        print;
    }
    close HEAD;
}
 
sub print_footer{
    open (FOOT, "<$bb_footer") or &print_error("I can't open $bb_footer for reading!");
    while (<FOOT>) {
        s/&BBMENUSKIN/$ENV{'BBMENUSKIN'}/g;
        s/&HOBBITDREL/$ENV{'HOBBITDREL'}/g;
        print;
    }
    close FOOT;
}
 
# Main
my ($oldbar) = $|;
my $cfh = select (STDOUT);
$| = 1;
 
&get_hosts;
&print_header($color); # I like blue ;)
if ($cmd =~ /edit|html/) {
    &get_note;
    &edit_note;
} elsif ($cmd eq 'view') {
    &get_note;
    &print_note;
} elsif ($cmd eq 'preview') {
    &print_note;
} elsif ($cmd eq 'preview as html') {
    &print_note;
} elsif ($cmd eq 'save') {
    &save_note;
} else {
    &print_menu;
}
 
&print_footer;
 
$| = $oldbar;
 select ($cfh);

Show Code ⇲

Hide Code ⇱

#!/usr/bin/perl
#
#############################################
# Name: bbnote_editor.cgi
# Xymon update: Galen Johnson
# Original Author: Chris Naude
# Purpose: Manage HTML notes files
# Version: 1.0
# The text2html module can be downloaded from CPAN #############################################
 
use strict;
use CGI ":standard";
use HTML::FromText;
 
# Your $XYMONHOME
my $xymon_home = "/usr/share/xymon";
my $xymon_cmd = "$xymon_home/bin/xymon";
# xymon config file
my $xymoncfg = "$xymon_home/etc/xymonserver.cfg";
 
# The actual www notes dir on the server
my $xymon_notes  = "/var/www/xymon/notes"; # This is where the data files are stored.
# Not to be confused with the default notes dir.
my $xymon_notesdata  = "$xymon_home/etc/notesdata";
my $xymon_header = "$xymon_home/web/notes_header"; # Change this if needed.
my $xymon_footer = "$xymon_home/web/notes_footer"; # Change this if needed.
 
#Standard hosts.cfg file
my $xymon_hosts = "$xymon_home/hosts.cfg";
my $xymon_menu = "$xymon_home/etc/xymonmenu.cfg";
 
# No changes needed below.
my $version = "4.3.28";
my $color = "blue";
my %hosts;
my $cmd = param("cmd");
my $host = param("host");
$host =~ s/(.*?)\///g;
$host =~ s/(\.html)$//g;
my $note = param("note");
my @lines;
 
# Set up the environment variables and dynamic variables from xymonserver.cfg
foreach (`$xymon_home/bin/xymoncmd env | /usr/bin/grep XYMON`) {
  chomp;
  next if $_ =~ /^directory/;
  my ($var,$val) = /^\s*(.*?)\s*=\s*(.*)/;
  $ENV{$var} = $val;
}
 
sub print_notesdata {
  open (NOTESDATA, "<$xymon_notesdata/${host}") or &print_error("I can't read from $xymon_notesdata/$host!");
  while (<NOTESDATA>) {
    print;
  }
  close NOTESDATA;
}
 
sub write_notesdata {
  open (NOTESDATA, ">$xymon_notesdata/$host") or &print_error("I can't write to $xymon_notesdata/$host!");
  print NOTESDATA $note;
  close NOTESDATA;
}
 
sub make_note {
  my ($color) = @_;
  my $note = "$xymon_notes/${host}.html";
 
  open (NOTE, ">$note") or &print_error("I can't open $note for writing!");
  select NOTE;
  &print_header($color);
  &print_notesdata;
  &print_footer($color);
  select STDOUT;
  close NOTE;
}
 
sub save_note {
  &write_notesdata;
  &make_note('blue');
  &get_note;
  print '<center><b><font color="white">Note saved.</font></b></center><p>';
  &print_note;
}
 
sub edit_note {
  if ($cmd =~ /add html/) {
    my $t2h = HTML::FromText->new({
              blockcode  => 1,
              lines      => 1,
              tables     => 1,
              bullets    => 1,
              numbers    => 1,
              urls       => 1,
              email      => 1,
              bold       => 1,
              underline  => 1,
              });
    $note = $t2h->parse( $note );
    #$note =~ s/\n/<br>/sgi; #
  }
 
  if ($cmd =~ /strip html/) {
    $note =~ s/<.*?>//sgi;
  }
 
  print <<HTML;
<CENTER>
  <TABLE BORDER="1" CELLPADDING="3">
    <CAPTION>
      <H2><CENTER>$host [$hosts{$host}]</CENTER></H2>
    </CAPTION>
    <TR>
      <TD ALIGN="CENTER">
        <form method="POST">
          <input type="hidden" name="host" value="$host">
          <TEXTAREA ROWS="35" COLS="80" NAME="note" STYLE="background-color:#000033;color:dddddd">
HTML
  if ($note) {
    print $note;
  } elsif ($lines[0]) {
    print @lines;
  } else {
    print '<!-- Remember to use proper HTML formatting here. -->'; }
    print <<HTML;
          </TEXTAREA><br>
          <input name="cmd" value="preview" type="submit"> <input name="cmd" value="add html tags" type="submit"> <input name="cmd" value="strip html tags" type="submit"> <input name="cmd" value="cancel" type="submit">
        </form>
      </TD>
    </TR>
  </TABLE>
</CENTER>
HTML
}
 
sub print_note {
  print <<HTML;
<CENTER>
  <TABLE WIDTH="75%" BORDER="1" CELLPADDING="3">
    <CAPTION>
      <CENTER><H2>$host [$hosts{$host}]</H2></CENTER>
    </CAPTION>
    <TR>
      <TD>
HTML
  if ($lines[0]) {
    print @lines;
    print <<HTML;
      </TD>
    </TR>
    <TR>
      <TD ALIGN="CENTER">
        <form method="POST">
          <input type="hidden" name="host" value="$host">
HTML
  } elsif ($cmd =~ /preview/) {
    print <<HTML;
        $note
      </TD>
    </TR>
    <TR>
      <TD ALIGN="CENTER">
        <form method="POST">
          <input type="hidden" name="host" value="$host"> <input name="cmd" value="save" type="submit">
HTML
  } else {
    print <<HTML;
      The are no notes for $host [$hosts{$host}].
    </TD>
  </TR>
  <TR>
    <TD ALIGN="CENTER">
      <form method="POST">
        <input type="hidden" name="host" value="$host">
HTML
  }
    print <<HTML;
          <input type="hidden" name="note" value='$note'> <input name="cmd" value="edit" type="submit"> <input name="cmd" value="list" type="submit">
        </form>
      </TD>
    </TR>
  </TABLE>
</CENTER>
HTML
}
#
sub print_error {
  my $error = shift;
  print "<center><b><font color=\"red\">$error</font></b></center><p>";
}
 
sub get_note {
  if ( -s "$xymon_notesdata/$host") {
    open (NOTE, "<$xymon_notesdata/$host") or &print_error("I can't open $xymon_notesdata/$host for reading!");
    while (my $note = <NOTE>) {
      push @lines, $note;
    }
    close NOTE;
  }
}
 
sub print_menu {
  print '<CENTER><TABLE BORDER="1" CELLPADDING="3"><CAPTION><H2><CENTER>Xymon Notes</CENTER></H2><b></b></CAPTION>';
  for my $host(sort keys %hosts) {
    print <<HTML;
<TR><TD>$host</TD><TD>$hosts{$host}</TD>
<TD><form method="POST"><input type="hidden" name="host" value="$host"> <input name="cmd" value="view" type="submit"> <input name="cmd" value="edit" type="submit"></form></TD></TR>
HTML
  }
  print '</TABLE></CENTER>';
}
 
sub get_hosts {
  open (HOSTS, "-|", $xymon_cmd, '127.0.0.1', 'hostinfo') or &print_error("I can't open $xymon_hosts!");
  while (<HOSTS>) {
    my ($hostname, $hostip, @dummy) = split('\|');
    $hosts{$hostname} = $hostip;
  }
  close HOSTS;
}
 
sub print_header {
  my $color = shift;
  print "Content-type: text/html; charset=iso-8859-1\n\n";
  open (HEAD, "<$xymon_header") or &print_error("I can't open $xymon_header for reading!");
  while (<HEAD>) {
    # It's a bit hard to edit with a refresh ;)
    if (/META/i && /HTTP-EQUIV/i && /REFRESH/i && /CONTENT/i) { s/<(.*?)>/<!-- Refresh removed -->/g; }
    s/&XYMONLOGO/$ENV{'XYMONLOGO'}/g;
    s/&XYMONBACKGROUND/$color/g;
    s/&XYMONBODYCSS/$ENV{'XYMONBODYCSS'}/g;
    s/&XYMONBODYMENUCSS/$ENV{'XYMONBODYMENUCSS'}/g;
    s/&XYMONMENUSKIN/$ENV{'XYMONMENUSKIN'}/g;
    s/&XYMONPAGEPATH/$ENV{'XYMONPAGEPATH'}/g;
    s/&XYMONSKIN/$ENV{'XYMONSKIN'}/g;
    s/&XYMONDATE/$ENV{'XYMONDATE'}/g;
 
    if (/&XYMONBODYHEADER/) {
      s/&XYMONBODYHEADER//g;
      open (MENU, "<$xymon_menu") or &print_error("I can't open $xymon_menu for reading!");
      while (<MENU>) {
        s/\$XYMONSERVERWWWURL/$ENV{'XYMONSERVERWWWURL'}/g;
        s/\$XYMONSERVERCGIURL/$ENV{'XYMONSERVERCGIURL'}/g;
        s/\$XYMONSERVERSECURECGIURL/$ENV{'XYMONSERVERSECURECGIURL'}/g;
        print;
      }
      close MENU;
    }
    print;
  }
  close HEAD;
}
 
sub print_footer {
  open (FOOT, "<$xymon_footer") or &print_error("I can't open $xymon_footer for reading!");
  while (<FOOT>) {
    s/&XYMONMENUSKIN/$ENV{'XYMONMENUSKIN'}/g;
    s/&XYMONDREL/$version/g;
    print;
  }
  close FOOT;
}
 
# Main
my ($oldbar) = $|;
my $cfh = select (STDOUT);
$| = 1;
&get_hosts;
&print_header($color); # I like blue ;)
if ($cmd =~ /edit|html/) {
  &get_note;
  &edit_note;
} elsif ($cmd eq 'view') {
  &get_note;
  &print_note;
} elsif ($cmd eq 'preview') {
  &print_note;
} elsif ($cmd eq 'preview as html') {
  &print_note;
} elsif ($cmd eq 'save') {
  &save_note;
} else {
  &print_menu;
}
 
&print_footer;
 
$| = $oldbar;
select ($cfh);
  • 2012/01/03
    • Adjustments made to make it work and display properly in xymon 4.3.x. My thanks goes to KVDO
    • for helping me out with the javascript code and everybody that worked on this add-on.
    • Note: Working but code not perfect.
  • 2010-11-03
    • Removed the local statement on line 224 in the cgi script as it gave errors when compiling.
    • Changed <my local ($oldbar) = $|;> into <my ($oldbar) = $|;>
  • 2010-08-14
    • Minor modification to explicitly set the package for local variables (ie, add “my”)
  • 2009-11-26
    • Updated the installation section. Ubuntu/Debian uses menu.cfg instead
  • 2007-07-02
    • Added code to force Perl to flush its buffers after each output statement. This will, hopefully, address any 'premature end of script headers' errors.
  • 2007-05-05
    • Updated to use strict
    • Config variables are added to environment
    • Capture hosts in include files
  • 2007-05-01
  • Initial release
  • addons/hobbitnotes.txt
  • Last modified: 2017/12/05 05:54
  • by wikiadmin