Xymon Mailing List Archive search

Best way to monitor for configuration value?

list Jeremy Laidman
Thu, 20 Sep 2012 10:51:47 +1000
Message-Id: <CAAnki7DP2a7iL-PorZjwnpawWVN5ZXhJiWp1C=user-a037a86f343a@xymon.invalid>

On 20 September 2012 07:18, Betsy Schwartz <user-c61747246f66@xymon.invalid> 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