creating a macro made of macro's in hobbit-alerts.cfg
Is it possible to create some macros of hosts, then bundle combinations of those smaller macros into larger ones?
Say I have 3 groups of systems:
$DB=%(db1|data1|dbase).domain.com
$MAIL=%(mail1|smtp|webmail).domain.com
$WS=%(ws1|fred|wilma).domain.com
I'd like to make 2 macros of those systems, one for critical systems, the other for everthing on my network:
$CRITICAL=%($DB|$MAIL)
$ALL=%($DB|$MAIL|$WS)
Then use only the variables $CRITICAL or $ALL as my HOST=<variable name> entry.
If this can be done, I'm having problems getting the syntax right. Any pointers?
Thanks, Tom
On Wed, May 25, 2005 at 02:58:18PM, Tom Georgoulias wrote:
Is it possible to create some macros of hosts, then bundle combinations of those smaller macros into larger ones?
Say I have 3 groups of systems:
$DB=%(db1|data1|dbase).domain.com
$MAIL=%(mail1|smtp|webmail).domain.com
$WS=%(ws1|fred|wilma).domain.com
I'd like to make 2 macros of those systems, one for critical systems, the other for everthing on my network:
$CRITICAL=%($DB|$MAIL)
$ALL=%($DB|$MAIL|$WS)
Then use only the variables $CRITICAL or $ALL as my HOST=<variable name> entry.
If this can be done, I'm having problems getting the syntax right. Any pointers?
I could benefit from this too. What I found out is that it does not like macro made out of macro.
Thanks
-- Asif Iqbal PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu "..there are two kinds of people: those who work and those who take the credit...try to be in the first group;...less competition there." - Indira Gandhi
On Wed, May 25, 2005 at 02:58:18PM -0400, Tom Georgoulias wrote:
Is it possible to create some macros of hosts, then bundle combinations of those smaller macros into larger ones?
It's supposed to work, yes. And yes - there's a bug in how this is handled. You need the attached patch first.
Say I have 3 groups of systems:
$DB=%(db1|data1|dbase).domain.com
$MAIL=%(mail1|smtp|webmail).domain.com
$WS=%(ws1|fred|wilma).domain.com
I'd like to make 2 macros of those systems, one for critical systems, the other for everthing on my network:
$CRITICAL=%($DB|$MAIL)
$ALL=%($DB|$MAIL|$WS)
When doing this, remember that the macros are simple text-substitutions. So I'd leave out the "%" in the macros, because you end up with too many of them they way you have it. Instead, I'd do it like this:
$DB=(db1|data1|dbase).domain.com $MAIL=(mail1|smtp|webmail).domain.com $WS=(ws1|fred|wilma).domain.com
$CRITICAL=($DB|$MAIL) $ALL=($DB|$MAIL|$WS)
HOST=%$CRITICAL MAIL tom at domain.com
If in doubt, you can always run "hobbitd_alert --dump-config" to see what your configuration ends up with - it shows the configuration after expanding the macros.
Regards, Henrik
Henrik Stoerner wrote:
On Wed, May 25, 2005 at 02:58:18PM -0400, Tom Georgoulias wrote:
Is it possible to create some macros of hosts, then bundle combinations of those smaller macros into larger ones?
It's supposed to work, yes. And yes - there's a bug in how this is handled. You need the attached patch first.
Thanks for the patch and the tip on grouping. I've got nested macros working now, and it has really cleaned up my hobbit-alerts.cfg file! :)
Tom
participants (3)
-
henrik@hswn.dk
-
iqbala-hobbit@qwestip.net
-
tgeorgoulias@mcclatchy.com