Xymon Mailing List Archive search

alert macro and SERVICE rule

4 messages in this thread

list Mark Hinkle · Mon, 15 Oct 2007 14:30:06 -0700 ·
Hobbit 4.2.0 w/ all-in-one 2007-02-09

Can you use a macro in the hobbit-alerts.cfg and use the SERVICE rule in addition? Not able to do so at this end...

hobbit-alerts.cfg
$patrickemail=MAIL user-f44d4f97fff1@xymon.invalid RECOVERED
$chrisemail=MAIL user-6ad3dd3b2df0@xymon.invalid RECOVERED
$ediemail=MAIL user-ee32aa2e3225@xymon.invalid REPEAT=1440m RECOVERED

HOST=pd-gis
     $patrickemail
     $chrisemail SERVICE=http
     $ediemail SERVICE=status


Running "hobbitd_alert --dump-config" seems to just stop after the first macro replacement:

-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:20:07 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
         MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED

-bash-2.05b$


If I change/remove the "SERVICE=http" from the line w/ the $chrisemail macro (for instance make it "DURATION>30"), then it *will* parse that line, but stop at the next one with the "SERVICE" rule:

-  $chrisemail SERVICE=http
+  $chrisemail DURATION>30


-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:26:27 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
         MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED
         MAIL user-6ad3dd3b2df0@xymon.invalid FORMAT=TEXT REPEAT=30 DURATION>30 RECOVERED

-bash-2.05b$


Am I getting this wrong somewhere? Thanks in advance.

--
Mark Hinkle
user-c2bc90a2442b@xymon.invalid
list Mark Hinkle · Mon, 15 Oct 2007 14:45:38 -0700 ·
Further info:

Could it be the "=" sign causing my issue? It works w/ DURATION and NOTICE on the line after the macro variable, but not COLOR, SERVICE, REPEAT, etc. Of course, when I put any of these into the macro definition, the replacement works fine.


-- 
Mark L. Hinkle
user-9816e24cee8c@xymon.invalid
list Charles Jones · Mon, 15 Oct 2007 15:01:57 -0700 ·
Not sure if it makes a difference, but the macros I use do not contain any part of the alert commands. In other words, using your example, I use the macros like so:
hobbit-alerts.cfg
$patrickemail=user-f44d4f97fff1@xymon.invalid
$chrisemail=user-6ad3dd3b2df0@xymon.invalid
$ediemail=user-ee32aa2e3225@xymon.invalid

HOST=pd-gis
    MAIL $patrickemail RECOVERED
    MAIL $chrisemail SERVICE=http  RECOVERED
    MAIL $ediemail SERVICE=status REPEAT=24h RECOVERED

I use similar to above with no problems.  I think your problem is from using alert keywords inside your macros.
-Charles
quoted from Mark Hinkle

Mark Hinkle wrote:
Hobbit 4.2.0 w/ all-in-one 2007-02-09

Can you use a macro in the hobbit-alerts.cfg and use the SERVICE rule in addition? Not able to do so at this end...

hobbit-alerts.cfg
$patrickemail=MAIL user-f44d4f97fff1@xymon.invalid RECOVERED
$chrisemail=MAIL user-6ad3dd3b2df0@xymon.invalid RECOVERED
$ediemail=MAIL user-ee32aa2e3225@xymon.invalid REPEAT=1440m RECOVERED

HOST=pd-gis
    $patrickemail
    $chrisemail SERVICE=http
    $ediemail SERVICE=status


Running "hobbitd_alert --dump-config" seems to just stop after the first macro replacement:

-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:20:07 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
        MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED

-bash-2.05b$


If I change/remove the "SERVICE=http" from the line w/ the $chrisemail macro (for instance make it "DURATION>30"), then it *will* parse that line, but stop at the next one with the "SERVICE" rule:

-  $chrisemail SERVICE=http
+  $chrisemail DURATION>30


-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:26:27 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
        MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED
        MAIL user-6ad3dd3b2df0@xymon.invalid FORMAT=TEXT REPEAT=30 DURATION>30 RECOVERED

-bash-2.05b$


Am I getting this wrong somewhere? Thanks in advance.
list Paul Barton · Mon, 15 Oct 2007 18:34:31 -0500 ·
Hi Mark. I believe we've used a variation on this in the past. I think
we had to quote the string.

-Paul
quoted from Mark Hinkle

* Mark Hinkle (user-c2bc90a2442b@xymon.invalid) wrote:
Hobbit 4.2.0 w/ all-in-one 2007-02-09

Can you use a macro in the hobbit-alerts.cfg and use the SERVICE rule in addition? Not able to do so at this end...

hobbit-alerts.cfg
$patrickemail=MAIL user-f44d4f97fff1@xymon.invalid RECOVERED
$chrisemail=MAIL user-6ad3dd3b2df0@xymon.invalid RECOVERED
$ediemail=MAIL user-ee32aa2e3225@xymon.invalid REPEAT=1440m RECOVERED

HOST=pd-gis
    $patrickemail
    $chrisemail SERVICE=http
    $ediemail SERVICE=status


Running "hobbitd_alert --dump-config" seems to just stop after the first macro replacement:

-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:20:07 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
        MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED

-bash-2.05b$


If I change/remove the "SERVICE=http" from the line w/ the $chrisemail macro (for instance make it "DURATION>30"), then it *will* parse that line, but stop at the next one with the "SERVICE" rule:

-  $chrisemail SERVICE=http
+  $chrisemail DURATION>30


-bash-2.05b$ ./server/bin/bbcmd hobbitd_alert --dump-config
2007-10-15 14:26:27 Using default environment file /usr/hobbit/server/etc/hobbitserver.cfg
HOST=pd-gis
        MAIL user-f44d4f97fff1@xymon.invalid FORMAT=TEXT REPEAT=30 RECOVERED
        MAIL user-6ad3dd3b2df0@xymon.invalid FORMAT=TEXT REPEAT=30 DURATION>30 RECOVERED

-bash-2.05b$


Am I getting this wrong somewhere? Thanks in advance.

--
Mark Hinkle
user-c2bc90a2442b@xymon.invalid

Paul Barton             http://www.moonkhan.org
user-b79aeaeb8cc5@xymon.invalid
"Black holes are where God divided by zero."