[hobbit] Host Notes
Henrik Stoerner
henrik at hswn.dk
Fri Jul 28 09:19:32 CEST 2006
On Thu, Jul 27, 2006 at 07:05:04PM -0700, Charles Jones wrote:
> Do you plan on adding a cgi to enable live editing of "notes"
> (www/notes/hostname) files? I saw in the manpage for bb-gen mention of a
> script on dead-cat that gives that functionality, but I would like to
> eventually see something that builds a "nice looking" notes page that
> has the same background and font color etc as the rest of the Hobbit
> pages. Currently if you just put something in a notes file you get a big
> ugly white screen with the raw text.
>
> Maybe a header/footer for the notes page would solve that?
Here's a simple solution for viewing the host notes, using mostly the tools
you already have:
* a notes_header and notes_footer file, mostly cloned from the existing
bb_header and bb_footer files. These go in your ~hobbit/server/web/
directory.
* a simple CGI using the bb_webpage utility. This goes in your
~hobbit/cgi-bin/ directory.
Testing this revealed a bug in bb_webpage, so there's a patch for it as
well.
To use this, add "--docurl=$CGIBINURL/hostnotes.sh?HOST=%s" to BBGENOPTS in
hobbitserver.c and restart Hobbit.
The CGI shell-script currently looks only for files named
.../notes/HOSTNAME - you can probably figure out how to change this if
you want to look for HOSTNAME.html, HOSTNAME.txt or whatever you like.
Regards,
Henrik
-------------- next part --------------
--- web/bb-webpage.c 2006/05/03 21:12:33 1.8
+++ web/bb-webpage.c 2006/07/28 07:12:09
@@ -12,7 +12,7 @@
/* */
/*----------------------------------------------------------------------------*/
-static char rcsid[] = "$Id: bb-webpage.c,v 1.8 2006/05/03 21:12:33 henrik Exp $";
+static char rcsid[] = "$Id: bb-webpage.c,v 1.9 2006/07/28 07:12:00 henrik Exp $";
#include <stdio.h>
#include <string.h>
@@ -63,8 +63,8 @@
headfoot(stdout, hffile, "", "header", bgcolor);
do {
- n = fread(inbuf, sizeof(inbuf), 1, stdin);
- if (n > 0) fwrite(inbuf, n, 1, stdout);
+ n = fread(inbuf, 1, sizeof(inbuf), stdin);
+ if (n > 0) fwrite(inbuf, 1, n, stdout);
} while (n == sizeof(inbuf));
headfoot(stdout, hffile, "", "footer", bgcolor);
-------------- next part --------------
<!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">
<TITLE>&BBBACKGROUND : Hobbit - Host notes for &HOSTNAME</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> </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>Host notes - &HOSTNAME</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>
<CENTER>
<FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="silver">
-------------- next part --------------
</CENTER>
</FONT>
<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">Hobbit 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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hostnotes.sh
Type: application/x-sh
Size: 307 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20060728/656b47b2/attachment.sh>
More information about the Xymon
mailing list