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
From: xymon-bounces at xymon.com [xymon-bounces at xymon.com] on behalf of Betsy Schwartz [betsy.schwartz at gmail.com] 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
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
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.
On 20 September 2012 07:25, Tim McCloskey <tm at freedom.com> 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
From: Jeremy Laidman [jlaidman at rebel-it.com.au]
Sent: Wednesday, September 19, 2012 6:29 PM
To: Tim McCloskey
Cc: betsy.schwartz at gmail.com; xymon at xymon.com
Subject: Re: [Xymon] Best way to monitor for configuration value?
On 20 September 2012 07:25, Tim McCloskey <tm at freedom.com> 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
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
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 <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.
What's the best and simplest way to do this with xymon? Is a custom test the best/only way?
thanks Betsy
On 21 September 2012 01:25, Betsy Schwartz <betsy.schwartz at gmail.com> 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
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 <jlaidman at rebel-it.com.au> wrote:
On 21 September 2012 01:25, Betsy Schwartz <betsy.schwartz at gmail.com> 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/varcheckThen, in analysis.cfg, add the following: HOST=name-of-client FILE /tmp/varcheck YELLOW SIZE>0
Won't that do what you need?
J
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
On Fri, Sep 21, 2012 at 4:32 PM, Betsy Schwartz <betsy.schwartz at gmail.com>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 <jlaidman at rebel-it.com.au> wrote:
On 21 September 2012 01:25, Betsy Schwartz <betsy.schwartz at gmail.com> 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/varcheckThen, in analysis.cfg, add the following: HOST=name-of-client FILE /tmp/varcheck YELLOW SIZE>0
Won't that do what you need?
J
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
On 22 September 2012 06:32, Betsy Schwartz <betsy.schwartz at gmail.com> 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.
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
participants (4)
-
betsy.schwartz@gmail.com
-
jlaidman@rebel-it.com.au
-
ralphmitchell@gmail.com
-
tm@freedom.com