[Xymon] Variables in config files
John Thurston
john.thurston at alaska.gov
Wed May 16 20:18:21 CEST 2018
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 907-465-8591
John.Thurston at alaska.gov
Department of Administration
State of Alaska
More information about the Xymon
mailing list