<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I'm still having this problem. If anyone has any ideas I'm open to
suggestions :)<br>
<br>
-Charles<br>
<br>
Charles Jones wrote:
<blockquote cite="mid4553A4CA.3060600@cisco.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
I am trying to use a regex macro to exclude a number of hosts from an
alert.  Here is the one I was using at first:<br>
  <pre wrap="">$UNUSED_PROD=%prod-app-(2|3|4|5|6|7|8|9|10|11|12|18|20|21|22|23|24)|prod-web-(1|2|3|4|9|10|11)

  </pre>
Here is how I am using it for the actual alert definition:<br>
  <pre wrap="">HOST=%(prod-.*) SERVICE=* EXHOST=$UNUSED_PROD
     MAIL $PRIMARY color=red REPEAT=60 RECOVERED NOTICE format=sms
     MAIL $SECONDARY color=red DURATION>20 REPEAT=60 RECOVERED NOTICE format=sms

  </pre>
I ran into a problem with the host "prod-app-12" matching the regex. I
realized this was because I was not terminating the numbers, so I
changed my variable to:<br>
  <br>
  <pre wrap="">$UNUSED_PROD=%prod-app-(2|3|4|5|6|7|8|9|10|11|12|18|20|21|22|23|24)$|prod-web-(1|2|3|4|9|10|11)$

  </pre>
This SHOULD work according to online regex testing tools, and I also at
Henriks advice, verified it using "pcretest":<br>
  <pre wrap="">$ pcretest
PCRE version 6.6 06-Feb-2006

  re> /prod-app-(2|3|4|5|6|7|8|9|10|11|12|18|20|21|22|23|24)$|prod-web-(1|2|3|4|9|10|11)$/
data> prod-web-12
No match
data> prod-web-11
 0: prod-web-11
 1: <unset>
 2: 11
data>
  </pre>
As seen above, the host "prod-web-12" does NOT match, but "prod-web-11"
DOES, which is exactly how I want it. <br>
  <br>
  <b>However, when I use this in hobbit-alerts.cfg. I do not get the
expected behavior. Instead, ALL hosts match, according to pages sent
out and from viewing the "info" section.  </b>The strange thing is,
according to hobbitd_alert --test, the hostname was successfully
excluded, but clicking on the "info" column for hosts that are supposed
to be excluded reveals that they are still configured to alert.<br>
  <br>
  <pre>../bin/hobbitd_alert --test prod-web-11 procs --color-red</pre>
  <pre>00009993 2006-11-09 21:48:30 send_alert prod-web-11:procs state Paging</pre>
  <pre>00009993 2006-11-09 21:48:30 *** Match with 'HOST=%(prod-.*) SERVICE=*' ***</pre>
  <pre>00009993 2006-11-09 21:48:30 Matching host:service:page 'prod-web-11:procs:PROD/PRODWEB' against rule line 170</pre>
  <pre>00009993 2006-11-09 21:48:30 *** Match with 'MAIL $PRIMARY color=red REPEAT=60 RECOVERED NOTICE format=sms' ***</pre>
  <pre>00009993 2006-11-09 21:48:30 Mail alert with command 'mail <a
 class="moz-txt-link-abbreviated" href="mailto:xxxxx@cingularme.com">xxxxx@cingularme.com</a>'</pre>
  <pre>00009993 2006-11-09 21:48:30 Failed 'MAIL $SECONDARY color=red DURATION>20 REPEAT=60 RECOVERED NOTICE format=sms' (min. duration 0<1200)</pre>
  <pre>...</pre>
  <pre>00009993 2006-11-09 21:48:30 Failed 'HOST=* SERVICE=* EXHOST=$UNUSED_PROD' (hostname excluded)</pre>
  <br>
* Another thing, when I do the same test as above, using hostname
"prod-web-12", which is a host that should NOT be excluded,
hobbitd_alert still says that it was excluded (same last line of output
as the prod-web-11 test above).<br>
  <br>
I have also tried enclosing the regex in quotes, which didn't work
either.<br>
  <br>
If anyone has any insight, please let me know. I have contacted Henrik
about this, but I believe he misread my email, as he suggested that I
add $ to the regex, which I had already tried...so now I am hoping that
he or someone else sees this message and can see what Im doing wrong.<br>
  <br>
-Charles<br>
  <br>
</blockquote>
<br>
</body>
</html>