That's what I was afraid of. If the macro functionality could be extended to all the config files that would make things much simpler.
JC, can I put in a feature request for extending the macro to all the config files?
Scot Kreienkamp |Senior Systems Engineer | La-Z-Boy Corporate
One La-Z-Boy Drive| Monroe, Michigan 48162 | Office: XXX-XXX-XXXX | | Mobile: XXXXXXXXXX | Email: user-9678697f1438@xymon.invalid
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of John Thurston
Sent: Wednesday, May 16, 2018 2:18 PM
To: xymon at xymon.com
Subject: Re: [Xymon] Variables in config files
On 5/16/2018 9:53 AM, Scot Kreienkamp wrote:
Yes, I realize I could use the .default line, but I can’t set that once
then have that available everywhere. If I change it later in the config
then it won’t be available to the rest of the config yet to come.
I'm not contesting your desire for a variable (or 'macro'), but ponder
your statement about .default. lines.
Something set in a .default. line remains the 'default' until changed in
a later .default. line. It can be altered per-host without affecting its
status as a 'default'.
0.0.0.0 .default. # nopropred:+msgs
0.0.0.0 foo.xyz.com # nopropred:-msgs
0.0.0.0 bar.xyz.com #
0.0.0.0 .default. #
0.0.0.0 baz.xyz.com #
In the above example, hosts foo and baz will propagate their red msgs
results. Foo, because the default value has been overridden with a
specific tag. Baz, because the default value has been changed.
Answering your specific question about variables. The 'macro' capability
available in alerts.cfg is not available in hosts.cfg
If I had to solve the problem you are describing, I'd probably create
create a meta-hosts.cfg and a post-edit-processing script to implement a
macro function similar to what is available in alerts.cfg. It wouldn't
be too hard to:
grep all lines leading with $
build a sed command file with search/replace from those lines
sed the meta-hosts.cfg to create an active hosts.cfg
--
Do things because you should, not just because you can.
John Thurston XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska
This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you.