Xymon Mailing List Archive search

alert configuration wildcard HOST

3 messages in this thread

list Bakkies Gatvol · Wed, 27 Jul 2016 12:38:16 -0400 ·
This works 


HOST=%_ip_printer SERVICE=conn

matches any host ending in %_ip_printer

 ../bin/xymoncmd xymond_alert --test   DGMSA_HP4050_ip_printer conn


00017968 2016-07-27 12:35:29 *** Match with 'HOST=%_ip_printer SERVICE=conn' ***


what I want to match now

usphl0tsasdbv0
usphl0tsasvav1

I tried 

HOST=usphl0tsas% SERVICE=disk_app

but it does not match


00017809 2016-07-27 12:34:21 Matching host:service:dgroup:page 'usphl0tsasvav1:disk_app:NONE:test' against rule line 30
00017809 2016-07-27 12:34:21 Failed 'HOST=usphl0tsas% SERVICE=disk_app' (hostname not in include list)


Is there any way to have the wildcard be at the end?

Thanks
list John Thurston · Wed, 27 Jul 2016 09:00:47 -0800 ·
On 7/27/2016 8:38 AM, Bakkies Gatvol wrote:
This works


HOST=%_ip_printer SERVICE=conn

matches any host ending in %_ip_printer
No, the percent character is not a wildcard. It indicates that what follows is a regular expression. Yours matches any host _containing_ "_ip_printer"

http://perldoc.perl.org/5.8.8/perlre.html
what I want to match now

usphl0tsasdbv0
usphl0tsasvav1
HOST=%foo.

Would match any host containing "foo" followed by any other character. That gets close to what you want in the fewest characters. But it will match "food" just as well as "shesafool" or "ofoo8".

HOST=%^foo.

requires that the host name begin with "foo" and is followed by any character. This would match "food", and "foo8".

host=%^foo\d

requires the hostname begins with "foo" and is followed by a digit.


-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list Bakkies Gatvol · Wed, 27 Jul 2016 13:14:40 -0400 ·
Thanks!!!   john.thurston

what I really really wanted t=test d=dev p=prod etc

 *** Match with 'HOST=%^usphl0(p|d|t)sas\w+ SERVICE=disk_app' ***
quoted from John Thurston

To: xymon at xymon.com
From: user-ce4d79d99bab@xymon.invalid
Date: Wed, 27 Jul 2016 09:00:47 -0800
Subject: Re: [Xymon] alert configuration wildcard HOST

On 7/27/2016 8:38 AM, Bakkies Gatvol wrote:
This works


HOST=%_ip_printer SERVICE=conn

matches any host ending in %_ip_printer
No, the percent character is not a wildcard. It indicates that what follows is a regular expression. Yours matches any host _containing_ "_ip_printer"

http://perldoc.perl.org/5.8.8/perlre.html
what I want to match now

usphl0tsasdbv0
usphl0tsasvav1
HOST=%foo.

Would match any host containing "foo" followed by any other character. That gets close to what you want in the fewest characters. But it will match "food" just as well as "shesafool" or "ofoo8".

HOST=%^foo.

requires that the host name begin with "foo" and is followed by any character. This would match "food", and "foo8".

host=%^foo\d

requires the hostname begins with "foo" and is followed by a digit.


-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska