<div class="gmail_quote">On 20 September 2012 07:18, Betsy Schwartz <span dir="ltr"><<a href="mailto:betsy.schwartz@gmail.com" target="_blank">betsy.schwartz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

We want to monitor a configuration file to see if a certain value has<br>
changed, that is, green if var=foo and red if var!= foo.<br></blockquote><div><br></div><div>An external script is one way to do it.  But you can get it done entirely within the Xymon server configuration.</div><div><br>

</div><div>One way to do it is using linecount.</div><div><br></div><div>In client-local.cfg, add the following:</div><div>[name-of-client]</div><div>    linecount:/path/to/file</div><div>    OKmatch:var=foo</div><div><br>

</div><div>Then, in analysis.cfg, add the following:</div><div>HOST=name-of-client</div><div>    DS msgs lines.,path,to,file#?OKmatch.rrd >0 COLOR=green "var=foo"</div><div><div>    DS msgs lines.,path,to,file#?OKmatch.rrd <=0 COLOR=red "var!=foo"</div>

<div><br></div><div>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.</div>

<br class="Apple-interchange-newline"></div><div>Another way is to create a dummy file by running code in a "file" check:</div><div><br></div><div>In client-local.cfg, add the following:</div><div>[name-of-client]</div>

<div>    file:`grep "^var=foo$" /path/to/file >/tmp/varcheck; echo /tmp/varcheck`</div><div><br></div><div>Then, in analysis.cfg, add the following:</div><div>HOST=name-of-client</div><div>    FILE /tmp/varcheck RED SIZE<1</div>

<div><br></div><div>I think the "dummy file" check is the neatest, but some people don't like the security implications of running arbitrary code like that.</div><div><br></div><div>J</div><div><br></div></div>