[hobbit] PAGE= matching not working (Hobbit 4.0.2 Debian package)

Henrik Stoerner henrik at hswn.dk
Sun May 15 08:32:32 CEST 2005


On Fri, May 13, 2005 at 04:47:39PM +0200, Christian Perrier wrote:
> > The "PAGE" directive actually matches on the full page-path.
> > Your "CP" page is a subpage, so it must have a path longer than
> > just "CP" - so "PAGE=something/CP" should work. Or if you dont
> > care about the name of the higher-level page, use "PAGE=%.*/CP"
> 
> Hmmm, I'm afraid it doesnt work either..

[snip config]

> root at nephtys:/etc/hobbit# /usr/lib/hobbit/server/bin/bbcmd --env=/etc/hobbit/hobbitserver.cfg hobbitd_alert --test bastet conn
> 00023371 2005-05-13 16:46:32 send_alert bastet:conn state Paging
> 00023371 2005-05-13 16:46:32 Matching host:service:page 'bastet:conn:' against rule line 115
> 00023371 2005-05-13 16:46:32 Failed (pagename not in include list)

The good news is that it's only the --test option that doesn't work.
It doesn't look up what the page-path is for a host, so it runs the
test assuming the host is on the top-level page.

When really used that info is provided differently, so it would work
as intended.

Attached is a patch that makes --test work the way you would expect
it to.


Regards,
Henrik

-------------- next part --------------
--- hobbitd/hobbitd_alert.c	2005/05/07 15:04:18	1.55
+++ hobbitd/hobbitd_alert.c	2005/05/15 06:29:24
@@ -269,7 +269,19 @@
 				return 1;
 			}
 
-			if (testpage == NULL) testpage = "";
+			if (testpage == NULL) {
+				namelist_t *hinfo;
+
+				load_hostnames(xgetenv("BBHOSTS"), NULL, get_fqdn());
+				hinfo = hostinfo(testhost);
+				if (hinfo) {
+					testpage = strdup(bbh_item(hinfo, BBH_PAGEPATH));
+				}
+				else {
+					errprintf("Host not found in bb-hosts - assuming it is on the top page\n");
+					testpage = "";
+				}
+			}
 
 			awalk = (activealerts_t *)malloc(sizeof(activealerts_t));
 			awalk->hostname = find_name(&hostnames, testhost);


More information about the Xymon mailing list