Xymon Mailing List Archive search

Valid alerts decleration?

15 messages in this thread

list Bruce Lysik · Thu, 27 Jan 2005 10:54:44 -0800 ·
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 · Thu, 27 Jan 2005 22:01:13 +0100 ·
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
quoted from Bruce Lysik
 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 · Thu, 27 Jan 2005 13:27:11 -0800 ·
quoted from Henrik Størner
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 · Thu, 27 Jan 2005 22:40:56 +0100 ·
quoted from Bruce Lysik
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-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?
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 · Thu, 27 Jan 2005 14:06:55 -0800 ·
quoted from Henrik Størner
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 · Fri, 28 Jan 2005 11:12:09 +1300 ·

"Bruce Lysik" wrote on 28/01/2005 11:06:55:
quoted from 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

Looking back at Henrik's earlier email, I think this should be...
quoted from Bruce Lysik

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 · Fri, 28 Jan 2005 11:17:34 +1300 ·

Andy France wrote on 28/01/2005 11:12:09:
quoted from 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

Whoops!  Drop the $ from the start of this line too!
quoted from Andy France

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 · Thu, 27 Jan 2005 14:17:51 -0800 ·
quoted from Andy France
Looking back at Henrik's earlier email, I think this should be...

HOST=%$HG-TEST
Nope, that doesn't work either:
quoted from Andy France

-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 · Thu, 27 Jan 2005 14:27:33 -0800 ·
$HG-TEST=host01|host02

Whoops!  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 · Thu, 27 Jan 2005 22:33:39 +0000 (UTC) ·
quoted from Bruce Lysik
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.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= ?
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 · Thu, 27 Jan 2005 23:35:31 +0100 ·
quoted from 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 · Thu, 27 Jan 2005 15:06:49 -0800 ·
quoted from 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.
That plus the patch did the trick.

--
Bruce Z. Lysik  <user-4e63a10f8934@xymon.invalid>
Operations Engineer
list Tom Georgoulias · Mon, 31 Jan 2005 14:17:47 -0500 ·
quoted from Henrik Størner
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 · Mon, 31 Jan 2005 21:00:38 +0000 (UTC) ·
In <user-2ff352ecd79c@xymon.invalid> Tom Georgoulias <user-e7ef09aae711@xymon.invalid> writes:

[snip patch and example]
quoted from Tom Georgoulias
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 · Mon, 31 Jan 2005 16:59:21 -0500 ·
quoted from Henrik Størner
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.
quoted from Henrik Størner
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