Thx Adam,
that was fast. Your perl snippet looks interesting, but, as you said, it is maybe a bit oversophisticated for my needs. But anyway, you pointed me to a suitable idea: not to collect all data and add to a (then lengthy and hard to manage) analysis.cfg, but to create single files, have a analysis_master.cfg, and combine all of these regularly (nightly cronjob) into a working analysis.cfg. If I have to edit the master cfg this must be done manually.
I wonder why there is the host.d and tasks.d functionality implemented (never needed or used this), but no analysis.d or alerts.d, as those files can become very large and complex. Maybe a small feature request for the next version?
regards Norbert
Am Fr., 3. Juni 2022 um 11:19 Uhr schrieb Adam Thorn <alt36 at cam.ac.uk>:
On 03/06/2022 09:49, nor krie wrote:
I thought I can just create these cfg files in $XYMONHOME/etc/analysis.d and it will be used similar to hosts.d or tasks.d directories. But obviously this does not work (and also there is no mention of analysis.d in the manuals).
Of course I can add all these lines directly into analysis.cfg, but this would create a very huge file.
analysis.cfg is read by xymond_client. Having looked quickly at the xymond_client.c source, it is definitely written to only load config from a single config file, which defaults to $XYMONHOME/etc/analysis.cfg
I've a somewhat experimental small gitlab project that I've never really used for anything in production:
https://github.com/alt36/cgifs
which lets you use Fuse to "mount" an arbitrary script at a directory of your choice. So, if you used it to..
./cgifs.pl /etc/xymon/foo/ /path/to/script.sh
and then adjusted your tasks.cfg entry for xymond_client to use --config=/etc/xymon/foo/analysis.cfg rather than the default, then reading the specified config file would return the output of
/path/to/script.sh analysis.cfg
script.sh could then just be something like
#!/bin/bash cat /etc/xymon/analysis.d/*.cfg
Of course, you'd achieve a very similar effect (and probably a lot more robustly than my slightly hacky perl!) by having a cron job generate your analysis.cfg from fragments you've put in an analysis.d directory. Although, with my cgifs.pl version you could have script.sh instead run the bash loop you posted (but echoing to stdout rather than writing to servername.cfg) and always have the "live" version available...
Adam
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon