On 20 September 2012 07:18, Betsy Schwartz <betsy.schwartz at gmail.com> wrote:
We want to monitor a configuration file to see if a certain value has changed, that is, green if var=foo and red if var!= foo.
An external script is one way to do it. But you can get it done entirely within the Xymon server configuration.
One way to do it is using linecount.
In client-local.cfg, add the following: [name-of-client] linecount:/path/to/file OKmatch:var=foo
Then, in analysis.cfg, add the following: HOST=name-of-client DS msgs lines.,path,to,file#?OKmatch.rrd >0 COLOR=green "var=foo" DS msgs lines.,path,to,file#?OKmatch.rrd <=0 COLOR=red "var!=foo"
The status of "msgs" should get modified based on the number of matching lines, which will be 0 or 1. You can change "msgs" to something else, but I think the "DS" rule requires an existing column to modify, rather than creating a new column.
Another way is to create a dummy file by running code in a "file" check:
In client-local.cfg, add the following:
[name-of-client]
file:grep "^var=foo$" /path/to/file >/tmp/varcheck; echo /tmp/varcheck
Then, in analysis.cfg, add the following: HOST=name-of-client FILE /tmp/varcheck RED SIZE<1
I think the "dummy file" check is the neatest, but some people don't like the security implications of running arbitrary code like that.
J