Xymon Mailing List Archive search

badTEST:x:y:z not working

list Henrik Størner
Thu, 11 Aug 2005 15:49:01 +0200
Message-Id: <user-18c7d1284df9@xymon.invalid>

On Thu, Aug 11, 2005 at 01:46:16PM +0200, user-c9ab24a501e1@xymon.invalid wrote:
Dear all,
 
looks to me, as if the "badTEST:x:y:z" tags are not working. 
 
I.e. "badssh:1:2:3" turns immediatley red if ssh goes down at the monitored host. 
There has been some reports about this, but I never got around to
looking into exactly what caused it.
I've looked into bbtest-net.c and figured out, that ..
 
- At line 775, the for loop << "for (swalk=svchead; (swalk && strcmp(swalk->testname, testname)); swalk = swalk->next) >>
compares swalk->testname and testname ---> which are never equal, because the string testname always includes the :x.y:z settings and swalk->testname (of course) not.
Aha - that would explain it.

I think this patch should fix it, then.


Henrik

-------------- next part --------------
--- bbnet/bbtest-net.c	2005/08/10 15:13:21	1.220
+++ bbnet/bbtest-net.c	2005/08/11 13:42:56
@@ -773,9 +773,12 @@
 			if (timespec) inscope = periodcoversnow(timespec);
 
 			if (strlen(testname) && badcounts && inscope) {
+				char *p;
 				twalk = NULL;
 
+				p = strchr(testname, ':'); if (p) *p = '\0';
 				for (swalk=svchead; (swalk && strcmp(swalk->testname, testname)); swalk = swalk->next) ;
+				if (p) *p = ':';
 				if (swalk) {
 					if (swalk == httptest) twalk = h->firsthttp;
 					else if (swalk == ldaptest) twalk = h->firstldap;