Xymon Mailing List Archive search

Hobbit WebPage Question

list Henrik Størner
Wed, 26 Jan 2011 14:22:11 +0000 (UTC)
Message-Id: <ihpamj$h1f$user-e356fad9864f@xymon.invalid>

In <user-6bee9a06d6b6@xymon.invalid> James Isolder <user-7de8f896e813@xymon.invalid> writes:
I wonder if it would be possible on the All Non Green View to have instead =
of gifs how long the service has been in that state with the relevant colou=
r.
That information is available if you let your mouse "hover" over the 
status icon.

It is possible to change from showing the status icon to showing
the duration of the latest status - I've included a small patch
against 4.3.0-RC1 that does this (on the "All non-green" and the
"Critical systems" pages, and only for red/yellow status). But I 
don't think it is something that I would want generally.

Regards,
Henrik

Index: xymongen/pagegen.c
===================================================================
--- xymongen/pagegen.c	(revision 6626)
+++ xymongen/pagegen.c	(working copy)
@@ -53,6 +53,7 @@
 int  critonlyreds = 0;
 int  wantrss = 0;
 int  nongreencolors = ((1 << COL_RED) | (1 << COL_YELLOW) | (1 << COL_PURPLE));
+int  showstatusduration = 1;
 
 /* Format strings for htaccess files */
 char *htaccess = NULL;
@@ -471,10 +472,17 @@
 						do_rss_item(rssoutput, h, e);
 					}
 
-					fprintf(output, "<IMG SRC=\"%s/%s\" ALT=\"%s\" TITLE=\"%s\" HEIGHT=\"%s\" WIDTH=\"%s\" BORDER=0></A>",
-						skin, dotgiffilename(e->color, e->acked, e->oldage),
-						htmlalttag, htmlalttag,
-						xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH"));
+					if (showstatusduration && ((e->color == COL_RED) || (e->color == COL_YELLOW)) && (pagetype != PAGE_NORMAL)) {
+						fprintf(output, "<font color=%s>%s</font>", colorname(e->color), e->age);
+					}
+					else {
+						fprintf(output, "<IMG SRC=\"%s/%s\" ALT=\"%s\" TITLE=\"%s\" HEIGHT=\"%s\" WIDTH=\"%s\" BORDER=0>",
+							skin, dotgiffilename(e->color, e->acked, e->oldage),
+							htmlalttag, htmlalttag,
+							xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH"));
+					}
• +					fprintf(output, "</A>");
 				}
 				else {
 					/* Report format output */