Xymon Mailing List Archive search

Reg Exp matching in hobbit-clients.cfg

list Henrik Størner
Wed, 29 Aug 2007 17:36:41 +0200
Message-Id: <user-2ef0d53ea574@xymon.invalid>

On Wed, Aug 29, 2007 at 11:19:17AM -0400, Bill Matthews wrote:
Greetings,

I've been able to do some basic regular expression matching using the
examples in hobbit-clients.cfg.

For example, this works fine:
HOST=%(server1|server2|server3).domain.com

But this doesn't:
HOST=%(server*).domain.com

I'm sure I'm just missing the syntax for wildcard matching?
Yep, this one is a classic: "*" means "zero or more occurrences of the
previous letter", so when you write "server*", it means "0 or more
occurrences of letter 'r'". I.e. it matches "serve", "server", "serverr"
and so on.

You should use the "." wildcard character. Like
	HOST=%(server.*).domain.com
Also is there a way to define a test for every server except some hosts?  I
have a lot of tests I would love to put in the DEFAULT section, but I have a
couple hosts that the tests would fail for.
Use the EXHOST setting, just like "HOST" but it excludes hosts - this
can be used with or without a HOST setting. E.g.

	EXHOST=%badhost.*\.domain\.com
	   PROC cron

is a valid way of checking that "cron" is running on all hosts, except
those called "badhost<something>"


Regards,
Henrik