Xymon Mailing List Archive search

Critical Systems 'Hosts docs'-URL does not show correct URL

4 messages in this thread

list Peter Welter · Wed, 27 Jul 2011 16:50:47 +0200 ·
Hello all,

After years of Xymon usage, I start to use the Critical Systems view. I have
setup a BBGENOPTS to use a docurl. I expect this URL to show up on the
Critical Systems view.

Either as the clickable host; either as the Host docs.

However, neither show the correct documentation.

In more detail:

   - I have tested this with 2 Xymon distributions: 4.2.3 and Xymon
   4.3.0-0.beta2
   - So I have setup:

BBGENOPTS="--recentgifs --subpagecolumns=2 --docurl=
https://wiki.ourserver.nl/syntax/index.php/ServerInformatie:%s --rss
--rsslimit=yellow --rssversion=2.0"     # Standard options for bbgen.


   - Below the screen that shows the Priority 2 call. The link shows the
   Info-text instead of the expected wiki-docs that does show in normal
   operation. Not on this screen:


 *disk* <https://monxy.leidenuniv.nl/xymon-cgi/hobbitcolumn.sh?disk>;
PRIO 2host (BSO-8x5 - Backup
(XXX))<https://xymon.somewhere.nl/xymon-cgi/bb-hostsvc.sh?HOST=host&SERVICE=info>[image:
red]<https://xymon.somehwere.nl/xymon-cgi/bb-hostsvc.sh?HOST=host&SERVICE=disk&NKPRIO=2&NKTTGROUP=bvs%5funix&NKTTEXTRA=>;


And when I click the smiley, you get this screen... The Host info shows
again the info-text. The Host-docs gives the same screen; it links to
itself.

PriorityResolver groupDocumentation2bvs_unixHost info
Host docs<https://xymon.ourserver.nl/xymon-cgi/bb-hostsvc.sh?HOST=hostname&SERVICE=disk&NKPRIO=2&NKTTGROUP=bvs%5funix&NKTTEXTRA=>;
    Host-ack              30 minutes          1 hour          2 hours
    3 hours          6 hours          12 hours          24 hours          2
days          3 days          4 days          5 days          1 week
 4 weeks

From the man-pages:

"The detailed status view

When looking at the status of one of the items shown on the Critical Systems
view, a number of additional items show up. On the example Critical Systems
view above, you will notice that the instructions we entered about what to
do with the disk status is shown here, so they are available to the
operators. There are links to the host documentation and host information. "
So is there something I understand wrong and does it work as expected? Or is
this something else?

Any help much appreciated,

Peter
list Peter Welter · Mon, 15 Aug 2011 12:09:23 +0200 ·
I tried to edit the hobbit-nkview.cfg to make this show up:

unix_8x5|http|||W:0800:1700|3|bvs_unix|<a href="
https://somewhere.our.domain/mediawiki/index.php/Hobbit_Repair_Actions#http">http</a>|user
2008-01-09 13:45:26

However, the html-markup (<a href etc) is stripped... :-(

Regard, Peter


2011/7/27 Peter Welter <user-f55666bd0d1e@xymon.invalid>
quoted from Peter Welter
Hello all,

After years of Xymon usage, I start to use the Critical Systems view. I
have setup a BBGENOPTS to use a docurl. I expect this URL to show up on the
Critical Systems view.

Either as the clickable host; either as the Host docs.

However, neither show the correct documentation.

In more detail:

   - I have tested this with 2 Xymon distributions: 4.2.3 and Xymon
   4.3.0-0.beta2
   - So I have setup:

BBGENOPTS="--recentgifs --subpagecolumns=2 --docurl=
https://wiki.ourserver.nl/syntax/index.php/ServerInformatie:%s --rss
--rsslimit=yellow --rssversion=2.0"     # Standard options for bbgen.


   - Below the screen that shows the Priority 2 call. The link shows the
   Info-text instead of the expected wiki-docs that does show in normal
   operation. Not on this screen:


 *disk* <https://monxy.leidenuniv.nl/xymon-cgi/hobbitcolumn.sh?disk>;
PRIO 2host (BSO-8x5 - Backup (XXX))<https://xymon.somewhere.nl/xymon-cgi/bb-hostsvc.sh?HOST=host&SERVICE=info>[image:
red]<https://xymon.somehwere.nl/xymon-cgi/bb-hostsvc.sh?HOST=host&SERVICE=disk&NKPRIO=2&NKTTGROUP=bvs%5funix&NKTTEXTRA=>;


And when I click the smiley, you get this screen... The Host info shows
again the info-text. The Host-docs gives the same screen; it links to
itself.

PriorityResolver groupDocumentation2bvs_unixHost info
Host docs<https://xymon.ourserver.nl/xymon-cgi/bb-hostsvc.sh?HOST=hostname&SERVICE=disk&NKPRIO=2&NKTTGROUP=bvs%5funix&NKTTEXTRA=>;
     Host-ack              30 minutes          1 hour          2 hours
       3 hours          6 hours          12 hours          24 hours
    2 days          3 days          4 days          5 days          1 week
       4 weeks

From the man-pages:

"The detailed status view

When looking at the status of one of the items shown on the Critical
Systems view, a number of additional items show up. On the example Critical
Systems view above, you will notice that the instructions we entered about
what to do with the disk status is shown here, so they are available to the
operators. There are links to the host documentation and host information. "
So is there something I understand wrong and does it work as expected? Or
is this something else?

Any help much appreciated,

Peter
list Henrik Størner · Mon, 15 Aug 2011 14:47:13 +0200 ·
On Wed, 27 Jul 2011 16:50:47 +0200, Peter Welter <user-f55666bd0d1e@xymon.invalid>
quoted from Peter Welter
wrote:
 
After years of Xymon usage, I start to use the Critical Systems view. I
have setup a BBGENOPTS to use a docurl. I expect this URL to show up on
the
Critical Systems view.
BBGENOPTS (or XYMONGENOPTS in 4.3.x) is not used for the Critical Systems
view, since this setting only provides some default options for the
"xymongen" utility. And the Critical Systems view is generated by another
tool (criticalview.cgi).

It's something that I forgot to handle in the Critical systems view.

I've attached a patch that will be included in Xymon 4.3.5. It deprecates
the "docurl" option for xymongen, and replaces it with a new HOSTDOCURL
setting in xymonserver.cfg with the same function. This setting is also
used by the Critical Systems view (and other tools). So it should work as
you would expect.


Regards,
Henrik
-------------- next part --------------
Index: common/xymonserver.cfg.5
===================================================================
--- common/xymonserver.cfg.5	(revision 6731)
+++ common/xymonserver.cfg.5	(working copy)
@@ -316,7 +316,18 @@
 .I columndoc.sh(1)
 script to document a column.
 
+.IP HOSTDOCURL
+Format string used to build a link to the documentation for a host.
+If not set, then Xymon falls back to scanning the XYMONNOTES directory
+for files matching the hostname, or the hostname together with a common
+filename extension (.php, .html, .doc and so on). If set, this string
+becomes a formatting string for the documentation URL. E.g. for the host
+"myhost", a setting of HOSTDOCURL="/docs/%s.php" will generate a link to
+"/docs/myhost.php".
+Default: Not set, so host documentation will be retrieved from the
+XYMONNOTES directory.
 
• .SH SETTINGS FOR SENDING MESSAGES TO XYMON
 .IP XYMSRV
 The IP-address used to contact the
Index: xymongen/xymongen.1
===================================================================
--- xymongen/xymongen.1	(revision 6731)
+++ xymongen/xymongen.1	(working copy)
@@ -40,17 +40,14 @@
 Prints the version number of xymongen
 .sp
 .IP "--docurl=URL"
-Make hostnames be hyperlinks to documentation, accessed via a common
-web page (typically a CGI script or a PHP-driven dynamic page). The URL 
-parameter is a formatting string with the name of the web page - you can 
-put a "%s" in it which will be replaced by the hostname being accessed. 
-E.g. if you use the bb-notes extension from www.deadcat.net, you would
-enable this with "--docurl=/xymon/admin/notes.php?host=%s". For the host 
-www.storner.dk this will result in a link to 
-"/xymon/admin/notes.php?host=www.storner.dk". 
+This option is deprecated, use the HOSTDOCURL setting in
+.I xymonserver.cfg(5)
+instead.
 .sp
 .IP "--doccgi=URL"
-This option is deprecated; please use --docurl instead.
+This option is deprecated, use the HOSTDOCURL setting in
+.I xymonserver.cfg(5)
+instead.
 .sp
 .IP "--doc-window"
 Causes links to documentation for hosts and services to open in a
Index: lib/environ.c
===================================================================
--- lib/environ.c	(revision 6731)
+++ lib/environ.c	(working copy)
@@ -113,6 +113,7 @@
 	{ "RRDHEIGHT", "120" },
 	{ "RRDWIDTH", "576" },
 	{ "COLUMNDOCURL", "$CGIBINURL/columndoc.sh?%s" },
+	{ "HOSTDOCURL", "" },
 	{ "XYMONLOGO", "Xymon" },
 	{ "XYMONPAGELOCAL", "<B><I>Pages Hosted Locally</I></B>" },
 	{ "XYMONPAGEREMOTE", "<B><I>Remote Status Display</I></B>" },
Index: lib/links.c
===================================================================
--- lib/links.c	(revision 6731)
+++ lib/links.c	(working copy)
@@ -35,6 +35,7 @@
 static char *notesskin = NULL;
 static char *helpskin = NULL;
 static char *columndocurl = NULL;
+static char *hostdocurl = NULL;
 
 char *link_docext(char *fn)
 {
@@ -118,6 +119,7 @@
 	if (notesskin) { xfree(notesskin); notesskin = NULL; }
 	if (helpskin) { xfree(helpskin); helpskin = NULL; }
 	if (columndocurl) { xfree(columndocurl); columndocurl = NULL; }
+	if (hostdocurl) { xfree(hostdocurl); hostdocurl = NULL; }
 
 	if (xgetenv("XYMONNOTESSKIN")) notesskin = strdup(xgetenv("XYMONNOTESSKIN"));
 	else { 
@@ -132,11 +134,15 @@
 	}
 
 	if (xgetenv("COLUMNDOCURL")) columndocurl = strdup(xgetenv("COLUMNDOCURL"));
+	if (xgetenv("HOSTDOCURL")) hostdocurl = strdup(xgetenv("HOSTDOCURL"));
 
-	strcpy(dirname, xgetenv("XYMONNOTESDIR"));
-	load_links(dirname, notesskin);
+	if (!hostdocurl || (strlen(hostdocurl) == 0)) {
+		strcpy(dirname, xgetenv("XYMONNOTESDIR"));
+		load_links(dirname, notesskin);
+	}
 
 	/* Change xxx/xxx/xxx/notes into xxx/xxx/xxx/help */
+	strcpy(dirname, xgetenv("XYMONNOTESDIR"));
 	p = strrchr(dirname, '/'); *p = '\0'; strcat(dirname, "/help");
 	load_links(dirname, helpskin);
 
@@ -189,24 +195,19 @@
 	if (linkurl == NULL) linkurl = (char *)malloc(PATH_MAX);
 	if (!linksloaded) load_all_links();
 
-	link = find_link(hostname);
• -	if (link) {
-		sprintf(linkurl, "%s/%s", link->urlprefix, link->filename);
+	if (hostdocurl && *hostdocurl) {
+		snprintf(linkurl, PATH_MAX-1, hostdocurl, hostname);
 		return linkurl;
 	}
+	else {
+		link = find_link(hostname);
 
+		if (link) {
+			sprintf(linkurl, "%s/%s", link->urlprefix, link->filename);
+			return linkurl;
+		}
+	}
• return NULL;
 }
 
-char *hostlink_filename(char *hostname)
-{
-	link_t *link;
• -	if (!linksloaded) load_all_links();
• -	link = find_link(hostname);
• -	return (link ? link->filename : NULL);
-}
• Index: lib/links.h
===================================================================
--- lib/links.h	(revision 6731)
+++ lib/links.h	(working copy)
@@ -15,6 +15,5 @@
 extern void load_all_links(void);
 extern char *columnlink(char *colname);
 extern char *hostlink(char *hostname);
-extern char *hostlink_filename(char *hostname);
 
 #endif
Index: xymond/etcfiles/xymonserver.cfg.DIST
===================================================================
--- xymond/etcfiles/xymonserver.cfg.DIST	(revision 6731)
+++ xymond/etcfiles/xymonserver.cfg.DIST	(working copy)
@@ -157,7 +157,13 @@
 DOTHEIGHT="16"					# Height (in pixels) of the color GIF's
 DOTWIDTH="16"					# Width (in pixels) of the color GIF's
 COLUMNDOCURL="$CGIBINURL/columndoc.sh?%s"	# URL formatting string for column-links
+# HOSTDOCURL is a formatting string for generating links to host documentation.
+# If NOT set, Xymon will scan the "notes" directory for files matching the hostname 
+# and possibly a filename extension (php, html, doc, asp ...)
+#
+# HOSTDOCURL="$XYMONNOTESSKIN/%s.html"
 
• # HTML content
 HTMLCONTENTTYPE="text/html"                     # You can add charset options here.
list Peter Welter · Mon, 15 Aug 2011 15:44:54 +0200 ·
This is Great news Henrik!

Thank you very much, for the fix! I will apply it to the 4.3.4 that we are
going to install very soon.

This makes the critical system page much more valuable.

Regards, Peter

2011/8/15 <user-ce4a2c883f75@xymon.invalid>
quoted from Henrik Størner
On Wed, 27 Jul 2011 16:50:47 +0200, Peter Welter <user-f55666bd0d1e@xymon.invalid>
wrote:
After years of Xymon usage, I start to use the Critical Systems view. I
have setup a BBGENOPTS to use a docurl. I expect this URL to show up on
the
Critical Systems view.
BBGENOPTS (or XYMONGENOPTS in 4.3.x) is not used for the Critical Systems
view, since this setting only provides some default options for the
"xymongen" utility. And the Critical Systems view is generated by another
tool (criticalview.cgi).

It's something that I forgot to handle in the Critical systems view.

I've attached a patch that will be included in Xymon 4.3.5. It deprecates
the "docurl" option for xymongen, and replaces it with a new HOSTDOCURL
setting in xymonserver.cfg with the same function. This setting is also
used by the Critical Systems view (and other tools). So it should work as
you would expect.


Regards,
Henrik