Xymon Mailing List Archive search

Best way to monitor for configuration value?

10 messages in this thread

list Betsy Schwartz · Wed, 19 Sep 2012 17:18:47 -0400 ·
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.

What's the best and simplest way to do this with xymon? Is a custom
test the best/only way?

thanks Betsy
list Tim McCloskey · Wed, 19 Sep 2012 21:25:58 +0000 ·
quoted from Betsy Schwartz
From: xymon-bounces at xymon.com [xymon-bounces at xymon.com] on behalf of Betsy Schwartz [user-c61747246f66@xymon.invalid]
Sent: Wednesday, September 19, 2012 2:18 PM
To: xymon at xymon.com
Subject: [Xymon] Best way to monitor for configuration value?

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.

What's the best and simplest way to do this with xymon? Is a custom
test the best/only way?

thanks Betsy


You could use md5 but if the config file has other changes that you don't care about then this wont work.  Unless there is only one value that changes I don't see any other option except an external test, which whould be easy to implement.
list Jeremy Laidman · Thu, 20 Sep 2012 10:51:47 +1000 ·
quoted from Betsy Schwartz
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
list Jeremy Laidman · Thu, 20 Sep 2012 11:29:27 +1000 ·
quoted from Tim McCloskey
On 20 September 2012 07:25, Tim McCloskey <user-440820cc07d6@xymon.invalid> wrote:
You could use md5 but if the config file has other changes that you don't
care about then this wont work.  Unless there is only one value that
changes I don't see any other option except an external test, which whould
be easy to implement.
What would be really useful, I think, is the ability to specify a custom
hash command using backticks.  Something like this:

client-local.cfg:
    file:/path/to/file:`/usr/bin/sed -n '/^var=/s/^var=//p' /path/to/file`

analysis.cfg:
    HOST=blabla
        FILE /path/to/file HASH="foo"

J
list Tim McCloskey · Thu, 20 Sep 2012 02:49:20 +0000 ·
quoted from Jeremy Laidman

From: Jeremy Laidman [user-71895fb2e44c@xymon.invalid]

Sent: Wednesday, September 19, 2012 6:29 PM

To: Tim McCloskey

Cc: user-c61747246f66@xymon.invalid; xymon at xymon.com

Subject: Re: [Xymon] Best way to monitor for configuration value?


On 20 September 2012 07:25, Tim McCloskey 
<user-440820cc07d6@xymon.invalid> wrote:


You could use md5 but if the config file has other changes that you don't care about then this wont work.  Unless there is only one value that changes I don't see any other option except an external test, which whould be easy to implement.


What would be really useful, I think, is the ability to specify a custom hash command using backticks.  Something like this:


client-local.cfg:
    file:/path/to/file:`/usr/bin/sed -n '/^var=/s/^var=//p' /path/to/file`


analysis.cfg:
    HOST=blabla
        FILE /path/to/file HASH="foo"


J

Jeremy, 

Both pretty cool ideas, never knew about linecount.  Then, I'm still on 4.2.0 so there's alot I don't know :)
External scripts work fine for me, but I like the integration that Xymon now gives out of the box.

Thanks, 
-t
list Betsy Schwartz · Thu, 20 Sep 2012 11:25:25 -0400 ·
To clarify:

We are OK with having the configuration file changing, we are just
monitoring the existence of one particular variable.
(if we didn't have people editing this file I could just put it into
puppet and be done with it)

New requirement:
   var=ON may or may not exist, this is the default state.
   we just need to go yellow if var=OFF

Sounds like a custom test is what I need.


On Wed, Sep 19, 2012 at 5:18 PM, Betsy Schwartz
quoted from Jeremy Laidman
<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.

What's the best and simplest way to do this with xymon? Is a custom
test the best/only way?

thanks Betsy
list Jeremy Laidman · Fri, 21 Sep 2012 09:45:48 +1000 ·
quoted from Betsy Schwartz
On 21 September 2012 01:25, Betsy Schwartz <user-c61747246f66@xymon.invalid> wrote:
To clarify:

We are OK with having the configuration file changing, we are just
No problem.
quoted from Betsy Schwartz

New requirement:
   var=ON may or may not exist, this is the default state.
   we just need to go yellow if var=OFF
No problem.

Sounds like a custom test is what I need.
Nah, then you gotta deploy and manage the custom test on each of your
client hosts, and be sure to install it on any new hosts that come along.
 I hate that.

In client-local.cfg, add the following:
[name-of-client]
    file:`grep -i "^var=OFF$" /path/to/file >/tmp/varcheck; echo
/tmp/varcheck`

Then, in analysis.cfg, add the following:
HOST=name-of-client
    FILE /tmp/varcheck YELLOW SIZE>0

Won't that do what you need?

J
list Betsy Schwartz · Fri, 21 Sep 2012 16:32:38 -0400 ·
Thanks, that is very interesting, I did not know the features could be
put together like that!
don't think that will work though because it's not going to clear when
the variable changes

(I'm starting to imagine something sick and twisted that *would*....)

anyway just for fun the requestor added a third requirement which is
to track how long it's been yellow, so I am definitely doing a custom
test (in anticipation of requirements #4...#n...)


On Thu, Sep 20, 2012 at 7:45 PM, Jeremy Laidman
quoted from Jeremy Laidman
<user-71895fb2e44c@xymon.invalid> wrote:
On 21 September 2012 01:25, Betsy Schwartz <user-c61747246f66@xymon.invalid> wrote:
To clarify:

We are OK with having the configuration file changing, we are just

No problem.
New requirement:
   var=ON may or may not exist, this is the default state.
   we just need to go yellow if var=OFF

No problem.
Sounds like a custom test is what I need.

Nah, then you gotta deploy and manage the custom test on each of your client
hosts, and be sure to install it on any new hosts that come along.  I hate
that.

In client-local.cfg, add the following:
[name-of-client]
    file:`grep -i "^var=OFF$" /path/to/file >/tmp/varcheck; echo
/tmp/varcheck`

Then, in analysis.cfg, add the following:
HOST=name-of-client
    FILE /tmp/varcheck YELLOW SIZE>0

Won't that do what you need?

J
list Ralph Mitchell · Fri, 21 Sep 2012 21:47:39 -0400 ·
Xymon already tracks how long a test has been yellow, red, green, etc.
 Just mouse over the colored dot...  You can also get that info from the
xymon server.  Check the xymon(1) man page for the "xymondboard" command.

Ralph Mitchell
quoted from Betsy Schwartz


On Fri, Sep 21, 2012 at 4:32 PM, Betsy Schwartz <user-c61747246f66@xymon.invalid>wrote:
Thanks, that is very interesting, I did not know the features could be
put together like that!
don't think that will work though because it's not going to clear when
the variable changes

(I'm starting to imagine something sick and twisted that *would*....)

anyway just for fun the requestor added a third requirement which is
to track how long it's been yellow, so I am definitely doing a custom
test (in anticipation of requirements #4...#n...)


On Thu, Sep 20, 2012 at 7:45 PM, Jeremy Laidman
<user-71895fb2e44c@xymon.invalid> wrote:
On 21 September 2012 01:25, Betsy Schwartz <user-c61747246f66@xymon.invalid>
wrote:
To clarify:

We are OK with having the configuration file changing, we are just

No problem.
New requirement:
   var=ON may or may not exist, this is the default state.
   we just need to go yellow if var=OFF

No problem.
Sounds like a custom test is what I need.

Nah, then you gotta deploy and manage the custom test on each of your
client
hosts, and be sure to install it on any new hosts that come along.  I
hate
that.

In client-local.cfg, add the following:
[name-of-client]
    file:`grep -i "^var=OFF$" /path/to/file >/tmp/varcheck; echo
/tmp/varcheck`

Then, in analysis.cfg, add the following:
HOST=name-of-client
    FILE /tmp/varcheck YELLOW SIZE>0

Won't that do what you need?

J
list Jeremy Laidman · Tue, 25 Sep 2012 15:52:12 +1000 ·
quoted from Betsy Schwartz
On 22 September 2012 06:32, Betsy Schwartz <user-c61747246f66@xymon.invalid> wrote:
Thanks, that is very interesting, I did not know the features could be
put together like that!
don't think that will work though because it's not going to clear when
the variable changes
I don't see why not.  The file will be either zero length or larger.  If
it's larger, the test goes yellow; if it's zero length, the test (by
default) goes green.
quoted from Ralph Mitchell

anyway just for fun the requestor added a third requirement which is
to track how long it's been yellow, so I am definitely doing a custom
test (in anticipation of requirements #4...#n...)
Scope creep *sigh* - yeah, an external script seems like the thing to do.

Cheers
Jeremy