[Xymon] --nongreen-colors=red,purple not displayed
Mark Falzon
Mark.Falzon at fujixerox.com
Thu Feb 27 21:54:36 CET 2014
Xymon version: 4.3.5
Hi all, We generate an only RED or PURPLE page through the xymongen --nongreen-colors=red,purple option.
The page generates fine however when a client that has a purple test alongside of a yellow test xymongen seems to drop the
client from the generated list. The client will still be part of "Current non-green systems" with its Purple and Yellow tests
A colleague of mine thinks he has found where our problem comes from.
This is based off the 4.3.16 code base.
We run xymongen with the -nongreencolor=red,purple flags to have an Operations view that hides yellow alerts, but is meant to display all red and purple alerts.
Our issue is for a sample Xymon client we might have a single client side test go into a purple state and also have one or more yellow statuses and this client will not be displayed in the "nongreen" page at all.
In process.c (line 44) the logic uses a simple greater than comparison to determine the maximum "nongreencolor" of the host, so in our sample, this would be set to COL_YELLOW.
In pagegen.c at line 1152, where the each host is being inspected to see if it is a candidate for inclusion in a page, the logic for setting "useit" uses the xymongen option of nongreencolors (which is a bit-shifted 1's complement) against a computed binary version of the host_t->nongreencolor. In our sample case, this means that the host_t->nongreencolor=COL_YELLOW and is currently excluded as we are not including Yellow's.
One method of resolving this which seems to work is to make the host_t->nongreencolor to be a bit-shifted one's complement of the all the entry_t->color of the tests.
--- process.c.orig 2014-02-28 07:14:30.000000000 +1100
+++ process.c 2014-02-28 07:16:17.000000000 +1100
@@ -41,10 +41,9 @@
if (e->propagate && (e->color > color)) color = e->color;
oldage &= e->oldage;
- if (e->propagate && (e->color > nongreencolor) && (strstr(nongreenignores, e->column->listname) == NULL)) {
- nongreencolor = e->color;
+ if (e->propagate && (strstr(nongreenignores, e->column->listname) == NULL)) {
+ nongreencolor = ( (1 << e->color ) | nongreencolor );
}
-
if (e->propagate && e->alert && (e->color > criticalcolor)) {
criticalcolor = e->color;
}
--- pagegen.c.orig 2014-01-20 08:49:42.000000000 +1100
+++ pagegen.c 2014-02-28 07:06:33.000000000 +1100
@@ -1152,7 +1152,7 @@
if (h->hostentry->nonongreen || (nongreennodialups && h->hostentry->dialup))
useit = 0;
else
- useit = (( (1 << h->hostentry->nongreencolor) & nongreencolors ) != 0);
+ useit = (( h->hostentry->nongreencolor & nongreencolors ) != 0);
break;
case PAGE_CRITICAL:
@@ -1172,12 +1172,18 @@
break;
}
- if (useit) {
+ if (useit) {
host_t *newhost, *walk;
switch (summarytype) {
case PAGE_NONGREEN:
- if (h->hostentry->nongreencolor > nongreenpage.color) nongreenpage.color = h->hostentry->nongreencolor;
+ dbgprintf("Setting highest page colour, currently on %s\n",h->hostentry);
+ // Work out what the highest colour number is in the nongreencolor - I'm sure there is a more elegant way!
+ int tempcolour = 0;
+ if ( h->hostentry->nongreencolor > 31 ) { tempcolour=5; }
+ else if ( h->hostentry->nongreencolor > 15 ) { tempcolour=4; }
+ else if ( h->hostentry->nongreencolor > 7 ) { tempcolour=3; }
+ if ( tempcolour > nongreenpage.color) nongreenpage.color = tempcolour;
break;
case PAGE_CRITICAL:
if (h->hostentry->criticalcolor > nongreenpage.color) nongreenpage.color = h->hostentry->criticalcolor;
Thanks all
Mark
***********************************************************************************
This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail.
The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of the organisation on any issue. This email has been swept for the presence of computer viruses known to the organisation's anti-virus systems.
***********************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140227/93d8662d/attachment.html>
More information about the Xymon
mailing list