More alert testing
list Rich Smrcina
I have email macros configured thusly:
$pg-rich=%user-cf452ff334e0@xymon.invalid
$pg-tom=%(user-30873c35cd66@xymon.invalid|user-c636915e0afe@xymon.invalid)
In other words, Rich can be reached at a single email address, Tom with two addresses.
The notification is set up like this:
HOST=%(vse*|vm*) DURATION>5m
MAIL $pg-tom
MAIL $pg-rich
So if any test on a host beginning with vse or vm fails, both Tom and Rich will get a page after 5 minutes.
When I test the process, I get the following:
hobbit at hobbit1:~/server/bin> ./bbcmd hobbitd_alert --test vm2 conn
2005-05-31 14:00:10 Using default environment file /home/hobbit/server/etc/hobbitserver.cfg
00002400 2005-05-31 14:00:10 send_alert vm2:conn state Paging
00002400 2005-05-31 14:00:10 Matching host:service:page 'vm2:conn:' against rule line 145
00002400 2005-05-31 14:00:10 Failed 'HOST=%(vse*|vm*) DURATION>5m' (min. duration 0<300)
This is certainly not what I expected. If I remove the DURATION value from the notification, I get:
hobbit at hobbit1:~/server/bin> ./bbcmd hobbitd_alert --test vm2 conn
2005-05-31 14:07:04 Using default environment file /home/hobbit/server/etc/hobbitserver.cfg
00002433 2005-05-31 14:07:04 send_alert vm2:conn state Paging
00002433 2005-05-31 14:07:04 Matching host:service:page 'vm2:conn:' against rule line 145
00002433 2005-05-31 14:07:04 *** Match with 'HOST=%(vse*|vm*)' ***
00002433 2005-05-31 14:07:04 Matching host:service:page 'vm2:conn:' against rule line 145
00002433 2005-05-31 14:07:04 *** Match with 'HOST=%(vse*|vm*)' ***
00002433 2005-05-31 14:07:04 Mail alert with command 'mail -s "Hobbit [12345] vm2:conn CRITICAL (RED)" %(user-30873c35cd66@xymon.invalid|user-c636915e0afe@xymon.invalid)'
00002433 2005-05-31 14:07:04 Matching host:service:page 'vm2:conn:' against rule line 145
00002433 2005-05-31 14:07:04 *** Match with 'HOST=%(vse*|vm*)' ***
00002433 2005-05-31 14:07:04 Mail alert with command 'mail -s "Hobbit [12345] gredevm2:conn CRITICAL (RED)" %user-cf452ff334e0@xymon.invalid'
Is this correct? Do the macros get expanded when the emails are generated?
Thanks.
--
Rich Smrcina
VM Assist, Inc.
Main: (262)392-2026
Cell: (XXX)XXX-XXXX
Ans Service: (360)715-2467
user-61add9955ef9@xymon.invalid
Catch the WAVV! http://www.wavv.org
WAVV 2006 - Chattanooga, TN - April 7-11, 2006
list Rich Smrcina
Of course that works much better. Thanks. Henrik Stoerner wrote:
On Tue, May 31, 2005 at 02:05:52PM -0500, Rich Smrcina wrote:I have email macros configured thusly: $pg-rich=%user-cf452ff334e0@xymon.invalid $pg-tom=%(user-30873c35cd66@xymon.invalid|user-c636915e0afe@xymon.invalid)This is wrong. You're trying to use regular expressions for mail addresses - that has never been possible. Reg. expressions are for matching hostnames, testnames and such - not for mail adresses. $pg-rich=user-cf452ff334e0@xymon.invalid $pg-tom=user-30873c35cd66@xymon.invalid user-c636915e0afe@xymon.invalid will do what you want.
▸
HOST=%(vse*|vm*) DURATION>5m MAIL $pg-tom MAIL $pg-rich So if any test on a host beginning with vse or vm fails, both Tom and Rich will get a page after 5 minutes. When I test the process, I get the following: hobbit at hobbit1:~/server/bin> ./bbcmd hobbitd_alert --test vm2 conn 2005-05-31 14:00:10 Using default environment file /home/hobbit/server/etc/hobbitserver.cfg 00002400 2005-05-31 14:00:10 send_alert vm2:conn state Paging 00002400 2005-05-31 14:00:10 Matching host:service:page 'vm2:conn:' against rule line 145 00002400 2005-05-31 14:00:10 Failed 'HOST=%(vse*|vm*) DURATION>5m' (min. duration 0<300)
You need to pass a duration value to the --test option, otherwise it
runs the test matching assuming the alert has just triggered (so the
duration is 0 seconds, which is less than your setting of 5 minutes).
Try
./bbcmd hobbitd_alert --test vm2 conn 500
(the "500" is seconds).
Henrik
▸
-- Rich Smrcina VM Assist, Inc. Main: (262)392-2026 Cell: (XXX)XXX-XXXX Ans Service: (360)715-2467 user-61add9955ef9@xymon.invalid Catch the WAVV! http://www.wavv.org WAVV 2006 - Chattanooga, TN - April 7-11, 2006
list Henrik Størner
On Tue, May 31, 2005 at 02:05:52PM -0500, Rich Smrcina wrote:
I have email macros configured thusly: $pg-rich=%user-cf452ff334e0@xymon.invalid $pg-tom=%(user-30873c35cd66@xymon.invalid|user-c636915e0afe@xymon.invalid)
This is wrong. You're trying to use regular expressions for mail addresses - that has never been possible. Reg. expressions are for matching hostnames, testnames and such - not for mail adresses. $pg-rich=user-cf452ff334e0@xymon.invalid $pg-tom=user-30873c35cd66@xymon.invalid user-c636915e0afe@xymon.invalid will do what you want.
HOST=%(vse*|vm*) DURATION>5m
MAIL $pg-tom
MAIL $pg-rich
So if any test on a host beginning with vse or vm fails, both Tom and
Rich will get a page after 5 minutes.
When I test the process, I get the following:
hobbit at hobbit1:~/server/bin> ./bbcmd hobbitd_alert --test vm2 conn
2005-05-31 14:00:10 Using default environment file
/home/hobbit/server/etc/hobbitserver.cfg
00002400 2005-05-31 14:00:10 send_alert vm2:conn state Paging
00002400 2005-05-31 14:00:10 Matching host:service:page 'vm2:conn:'
against rule line 145
00002400 2005-05-31 14:00:10 Failed 'HOST=%(vse*|vm*) DURATION>5m' (min.
duration 0<300)You need to pass a duration value to the --test option, otherwise it runs the test matching assuming the alert has just triggered (so the duration is 0 seconds, which is less than your setting of 5 minutes). Try ./bbcmd hobbitd_alert --test vm2 conn 500 (the "500" is seconds). Henrik