Valid alerts decleration?
list Bruce Lysik
Hi,
I just wanted to verify that his alerts snippet is valid (and does what I think it should do). It appears so from the documentation, but I wanted to run it by the group:
HOST=$HG-ADMIN
SCRIPT=/blah/blah/paging onduty SERVICE=procs
SCRIPT=/blah/blah/paging ops SERVICE=procs
SCRIPT=/blah/blah/paging onduty SERVICE=http,ping DURATION=6
SCRIPT=/blah/blah/paging ops SERVICE=http,ping DURATION=6
SCRIPT=/blah/blah/paging ops SERVICE=* EXSERVICE=procs,http,ping
--
Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid>
Operations Engineer
list Henrik Størner
On Thu, Jan 27, 2005 at 10:54:44AM -0800, Bruce Lysik wrote:
I just wanted to verify that this alerts snippet is valid (and does
▸
what I think it should do). It appears so from the documentation,
but I wanted to run it by the group:HOST=$HG-ADMIN
SCRIPT=/blah/blah/paging onduty SERVICE=procs
SCRIPT=/blah/blah/paging ops SERVICE=procs
SCRIPT=/blah/blah/paging onduty SERVICE=http,ping DURATION=6
SCRIPT=/blah/blah/paging ops SERVICE=http,ping DURATION=6
SCRIPT=/blah/blah/paging ops SERVICE=* EXSERVICE=procs,http,ping
There are a couple of mistakes here, and it's really good that you
post them because it points at some silly items that perhaps I should
improve:
* The "SCRIPT" keyword doesnt take a "=" sign. Use
SCRIPT /blah/blah/paging onduty SERVICE=procs
This one I should probably allow, because it is an easy mistake
to make (I've done it myself).
* "DURATION=6" won't work. The duration should be greater than some
value, or less than some value. I suppose you really meant
"DURATION>6".
* "SERVICE=*" will work, but is superfluous.
If in doubt, you can make hobbitd_alert print out how it interpreted
the config file:
cd ~hobbit/server
./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-config
Regards,
Henrik
list Bruce Lysik
▸
If in doubt, you can make hobbitd_alert print out how it interpreted the config file: cd ~hobbit/server ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-config
Thanks! This is useful. A related question: if hobbit-alerts.cfg is modified, does hobbit automatically pick up the new version, or is a restart required? -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Henrik Størner
▸
On Thu, Jan 27, 2005 at 01:27:11PM -0800, Bruce Lysik wrote:
If in doubt, you can make hobbitd_alert print out how it interpreted the config file: cd ~hobbit/server ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-configThanks! This is useful. A related question: if hobbit-alerts.cfg is modified, does hobbit automatically pick up the new version, or is a restart required?
Restart's are evil - they disrupt things. Configuration changes will be picked up automatically - at least when the next alert happens. Henrik
list Bruce Lysik
▸
A related question: if hobbit-alerts.cfg is modified, does hobbit automatically pick up the new version, or is a restart required?Restart's are evil - they disrupt things. Configuration changes will be picked up automatically - at least when the next alert happens.
Excellent. Of course now I've found a problem...
My test hobit-alerts.cfg:
$HG-TEST=host01|host02
HOST=$HG-TEST
SCRIPT /opt/bb/server/ext/email bruce_mail
MAIL user-4e63a10f8934@xymon.invalid
And then I run the dump config:
-bash-2.05b$ ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-config
HOST=
SCRIPT /opt/bb/server/ext/email bruce_mail FORMAT=SCRIPT REPEAT=30
MAIL user-4e63a10f8934@xymon.invalid REPEAT=30
Shouldn't there be some hosts showing up after HOST= ?
--
Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid>
Operations Engineer
list Andy France
"Bruce Lysik" wrote on 28/01/2005 11:06:55:
▸
A related question: if hobbit-alerts.cfg is modified, does hobbit automatically pick up the new version, or is a restart required?Restart's are evil - they disrupt things. Configuration changes will be picked up automatically - at least when the next alert happens.
Excellent. Of course now I've found a problem...
My test hobit-alerts.cfg:
$HG-TEST=host01|host02
HOST=$HG-TEST
Looking back at Henrik's earlier email, I think this should be...
▸
HOST=%$HG-TEST
SCRIPT /opt/bb/server/ext/email bruce_mail MAIL user-4e63a10f8934@xymon.invalid And then I run the dump config:
-bash-2.05b$ ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert -- dump-config HOST= SCRIPT /opt/bb/server/ext/email bruce_mail FORMAT=SCRIPT REPEAT=30 MAIL user-4e63a10f8934@xymon.invalid REPEAT=30 Shouldn't there be some hosts showing up after HOST= ?
-- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
HTH,
Andy.
#####################################################################################
This email is intended for the person to whom it is addressed
only. If you are not the intended recipient, do not read, copy
or use the contents in any way. The opinions expressed may not
necessarily reflect those of ZESPRI Group of Companies ('ZESPRI').
While every effort has been made to verify the information
contained herein, ZESPRI does not make any representations
as to the accuracy of the information or to the performance
of any data, information or the products mentioned herein.
ZESPRI will not accept liability for any losses, damage or
consequence, however, resulting directly or indirectly from
the use of this e-mail/attachments.
#####################################################################################
list Andy France
Andy France wrote on 28/01/2005 11:12:09:
▸
"Bruce Lysik" wrote on 28/01/2005 11:06:55:
A related question: if hobbit-alerts.cfg is modified, does hobbit automatically pick up the new version, or is a restart required?Restart's are evil - they disrupt things. Configuration changes will be picked up automatically - at least when the next alert happens.
Excellent. Of course now I've found a problem...
My test hobit-alerts.cfg:
$HG-TEST=host01|host02
Whoops! Drop the $ from the start of this line too!
▸
HOST=$HG-TEST
Looking back at Henrik's earlier email, I think this should be...
HOST=%$HG-TEST
SCRIPT /opt/bb/server/ext/email bruce_mail MAIL user-4e63a10f8934@xymon.invalid And then I run the dump config:
-bash-2.05b$ ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert -- dump-config HOST= SCRIPT /opt/bb/server/ext/email bruce_mail FORMAT=SCRIPT REPEAT=30 MAIL user-4e63a10f8934@xymon.invalid REPEAT=30 Shouldn't there be some hosts showing up after HOST= ?
-- Bruce Z. Lysik Operations Engineer
HTH, Andy.
#####################################################################################
This email is intended for the person to whom it is addressed
only. If you are not the intended recipient, do not read, copy
or use the contents in any way. The opinions expressed may not
necessarily reflect those of ZESPRI Group of Companies ('ZESPRI').
While every effort has been made to verify the information
contained herein, ZESPRI does not make any representations
as to the accuracy of the information or to the performance
of any data, information or the products mentioned herein.
ZESPRI will not accept liability for any losses, damage or
consequence, however, resulting directly or indirectly from
the use of this e-mail/attachments.
#####################################################################################
list Bruce Lysik
▸
Looking back at Henrik's earlier email, I think this should be... HOST=%$HG-TEST
Nope, that doesn't work either:
▸
-bash-2.05b$ ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-config
HOST=%
SCRIPT /opt/bb/server/ext/email bruce_mail FORMAT=SCRIPT REPEAT=30
MAIL user-4e63a10f8934@xymon.invalid REPEAT=30
Nor does defining the definition like this work:
$HG-TEST=%host01|host02
or
$HG-TEST=%(host01|host02)
Hmm. Wonder what I'm missing.
--
Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid>
Operations Engineer
list Bruce Lysik
$HG-TEST=host01|host02Whoops! Drop the $ from the start of this line too!
I thought that might be a possibility too, but no go. -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Henrik Størner
▸
In <user-cbc4a6f02bf7@xymon.invalid> "Bruce Lysik" <user-4e63a10f8934@xymon.invalid> writes:
$HG-TEST=host01|host02
HOST=$HG-TEST
SCRIPT /opt/bb/server/ext/email bruce_mail
MAIL user-4e63a10f8934@xymon.invalidAnd then I run the dump config:
-bash-2.05b$ ./bin/bbcmd --env=etc/hobbitserver.cfg hobbitd_alert --dump-config
HOST=
SCRIPT /opt/bb/server/ext/email bruce_mail FORMAT=SCRIPT REPEAT=30
MAIL user-4e63a10f8934@xymon.invalid REPEAT=30 Shouldn't there be some hosts showing up after HOST= ?
Hmm - yes, there should. This should fix it:
diff -u -r1.28 hobbitd/do_alert.c
--- hobbitd/do_alert.c 2005/01/20 10:45:44 1.28
+++ hobbitd/do_alert.c 2005/01/27 22:20:46
@@ -355,7 +355,7 @@
delim = strchr(l, '=');
*delim = '\0';
- newtok->name = strdup(l);
+ newtok->name = strdup(l+1); /* Skip the '$' */
newtok->value = strdup(delim+1);
newtok->next = tokhead;
tokhead = newtok;
But your $HG-TEST definition is also wrong. If it's a regular
expression, it should be "$HG-TEST=(host01|host02)" - if it's just a
simple list, it should be "$HG-TEST=host01,host02
Henrik
list Henrik Størner
▸
On Thu, Jan 27, 2005 at 10:33:39PM +0000, Henrik Storner wrote:
But your $HG-TEST definition is also wrong. If it's a regular expression, it should be "$HG-TEST=(host01|host02)"
I'm tired ... "$HG-TEST=%(host01|host02)" since a "%" is needed to flag it as a pc-regex. Henrik
list Bruce Lysik
▸
On Thu, Jan 27, 2005 at 10:33:39PM +0000, Henrik Storner wrote:But your $HG-TEST definition is also wrong. If it's a regular expression, it should be "$HG-TEST=(host01|host02)"I'm tired ... "$HG-TEST=%(host01|host02)" since a "%" is needed to flag it as a pc-regex.
That plus the patch did the trick. -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Tom Georgoulias
▸
Henrik Storner wrote:
Hmm - yes, there should. This should fix it:
diff -u -r1.28 hobbitd/do_alert.c
--- hobbitd/do_alert.c 2005/01/20 10:45:44 1.28
+++ hobbitd/do_alert.c 2005/01/27 22:20:46
@@ -355,7 +355,7 @@
delim = strchr(l, '=');
*delim = '\0';
- newtok->name = strdup(l);
+ newtok->name = strdup(l+1); /* Skip the '$' */
newtok->value = strdup(delim+1);
newtok->next = tokhead;
tokhead = newtok;
I'm tired ... "$HG-TEST=%(host01|host02)" since a "%" is needed to flag it as a pc-regex.
OK, I'm trying to get my alerts file setup using the macros and I'd like to try and summarize all the findings from list postings into a single procedure. Let me know if this is correct, or at least help steer me in the right direction. So far:
1. I've used the non-tested, experimental shell script to convert my bbwarnsetup.cfg host groups into hobbit macros. An example of one host group converted is as follows:
$HG1=pinky.nandomedia.com|sys(.*)p.nandomedia.com
2. I applied the patch above to do_alert.c
Now I want to put that macro I got from the shell script into action. It should look something like this, right?
$HG1=%(pinky.nandomedia.com|sys(.*)p.nandomedia.com)
or better
$HG1=%(pinky|sys(.*)p).nandomedia.com
But that "(.*)" looks funny to me. All it should represent in that case is a number like 507, 405, etc., or something that perl could handle with a /\d{3}/. The end result needs to be a hostname like "sys452p.nandomedia.com". What would be the correct syntax, or is that indeed the correct syntax?
Tom
list Henrik Størner
In <user-2ff352ecd79c@xymon.invalid> Tom Georgoulias <user-e7ef09aae711@xymon.invalid> writes: [snip patch and example]
▸
Now I want to put that macro I got from the shell script into action. It should look something like this, right?
$HG1=%(pinky.nandomedia.com|sys(.*)p.nandomedia.com)
or better
$HG1=%(pinky|sys(.*)p).nandomedia.com
But that "(.*)" looks funny to me. All it should represent in that case is a number like 507, 405, etc., or something that perl could handle with a /\d{3}/. The end result needs to be a hostname like "sys452p.nandomedia.com". What would be the correct syntax, or is that indeed the correct syntax?
Feel free to educate me on the finer details of Perl and the way it
does regular expressions - I'm not in any way an expert on that
subject. (I never could get my head twisted enough to figure out what
all the different parenthesis and special chars do in Perl - so
there's another reason why I've tried to make LARRD obsolete).
Yes, I think you can do without those parentheses. I actually have a
small test tool to try and match names against expressions, and if I try your expression it works whether I have "(.*)" or just ".*". So
$HG1=%(pinky|sys.*p).nandomedia.com
should be fine.
Henrik
list Tom Georgoulias
▸
Henrik Storner wrote:
Feel free to educate me on the finer details of Perl and the way it does regular expressions - I'm not in any way an expert on that subject. (I never could get my head twisted enough to figure out what all the different parenthesis and special chars do in Perl - so there's another reason why I've tried to make LARRD obsolete).
Trust me, you don't want me teaching anyone perl. I struggle enough on my own. That regex I had in my last email was just to match 3 digits in a row (like a [0-9]). I guess what was confusing to me is the use of ".*" instead of just "*". I think this is an artifact of BB b/c I can remember having some problems many moons ago when I was trying to getting wildcarding to work properly, but correct me if I'm wrong.
▸
Yes, I think you can do without those parentheses. I actually have a small test tool to try and match names against expressions, and if I try your expression it works whether I have "(.*)" or just ".*". So $HG1=%(pinky|sys.*p).nandomedia.com should be fine.
You're right, it does. I could swear I tried using something like this before, but even though it was showing up when I ran bbcmd --env=/home/hobbit/server/etc/hobbitserver.cfg hobbitd_alert --dump-config it didn't actually page me. The only time it really started working was after I shut hobbit down completely, then brought it back up. I'm not ruling out a mistake on my part, though. I've been making plenty of them the last week or so.
Release candidate still coming out sometime soon? I'm looking forward to it.
Tom