Xymon Mailing List Archive search

Multiple regex on PAGE line of hobbit-alerts.cfg?

list Steve Holmes
Tue, 5 Oct 2010 11:05:25 -0400
Message-Id: <user-18223e01e4a3@xymon.invalid>

On Tue, Oct 5, 2010 at 10:55 AM, Cade Robinson <user-a187bb1b921c@xymon.invalid>wrote:
Is it possible to use multiple regex on a PAGE= line of hobbit-alerts.cfg?

EG bb-hosts

page prodlinux Linux Servers
       ...
       subpage criticalprodlinux Critical Prod Linux Servers
       ...
       subpage noncriticalprodlinux Non-Critical Prod Linux Servers
       ...
page prodwin Windows Servers
       ...
       subpage criticalprodwin Critical Prod Windows Servers
       ...
       subpage noncriticalprodwin Non-Critical Prod Windows Servers
       ...


So what I have is my "prod" servers and then a subpage of critical ones
that
I want to get sms text pages on and then non-critical prod servers that I
don't really need a page at 3am on.

In my hobbit-alerts.cfg I want an email if any prodlinux or prodwin goes
yellow and a page if the critical ones go red

So in hobbit-alerts something like this:

PAGE=%prodlinux/.*,%prodwin/.*,someotherpage
       ...
       COLOR=yellow
       ...

PAGE=prodlinux/criticalprodlinux,prodwin/criticalprodwin,someotherpage
       ...
       COLOR=red
       ...

The red part works but the yellow doesn't.
Presumably because I am trying to do two regex in the PAGE line?

Thanks
Cade

Since you are using the pcre on the first one, replace the commas with '|'
(or).

e.g.:

PAGE=%prodlinux/.*|prodwin/.*|someotherpage

Note you only need the % at the beginning of the string.

Steve

-- 
The test of a democracy is not the magnificence of buildings or the speed of
automobiles or the efficiency of air transportation, but rather the care
given to the welfare of all the people. -Helen Adams Keller, lecturer and
author (1880-1968)

Truth never damages a cause that is just. -Mohandas Karamchand Gandhi
(1869-1948)