[Xymon] automated svcs listing with xymon ps client and analysis.d
Adam Thorn
alt36 at cam.ac.uk
Fri Jun 3 11:18:33 CEST 2022
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
More information about the Xymon
mailing list