FILES in analysis.cfg
list Roland Soderstrom
Hi,
I started monitoring some files.
I can't really understand how this works.
Xymon 4.3.10 on Solaris 10
client-local.cfg:
[sunos]
file:`ls -1 /var/tmp/sys-heartbeat-*`
analysis.cfg:
HOST=myhost
FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700
FILE /var/tmp/sys-heartbeat-testing red MTIME<3700
On myhost I got a file /var/tmp/sys-heartbeat-myhost but /var/tmp/sys-heartbeat-testing is missing (for testing)
If sys-heartbeat-myhost is older than 3700 second the files test goes red.
If sys-heartbeat-testing doesn't exist nothing happens at all.
The sys-heartbeat-testing line does not show up on the test but sys-heartbeat-myhost does.
Clicking on the sys-heartbeat-myhost shows me all the file data.
The syntax in the manual states.
FILE filename [color] [things to check] [TRACK]
noexist
triggers a warning if the file exists. By default, a warning is triggered for files that have a FILE entry, but which do not exist.
That should mean that if the file doesn't exist it should go red.
In the examples in analysis.cfg the color is in another spot.
# Example: Check that the /var/log/messages file is not empty and was updated
# within the past 10 minutes, and go yellow if either fails:
# FILE /var/log/messages SIZE>0 MTIME<600 yellow
I guess that is just a typo.
I have tried both and it seems it doesn't matter.
What am I doing wrong?
- Roland Soderstrrom
list Phil Crooker
Coming out of left field - when we were using heartbeat (just a simple pair) I set up a client script on each box that ran cl_status:
HOST=`uname -n`
RESULT=`/usr/bin/cl_status nodestatus $HOST`
if test -n "$RESULT" # IF WE HAVE OUTPUT...
then
if echo "$RESULT" | egrep -qi "error|cannot"
then
COLOR="red"
elif echo "$RESULT" | egrep -qi "active"
then
COLOR="green"
else
COLOR="yellow"
fi
else
RESULT="No result for cl_status, please check."
COLOR="yellow"
fi
You'd probably want to tweak it but this worked pretty well. You can also just run cl_status from one host to test both but sometimes cl_status hangs when heartbeat doesn't respond, so two hosts are a bit more reliable. You can also better parse the cl_status response for when the normal slave becomes master....
cheers, Phil
▸
From: Xymon on behalf of Roland Soderstrom
Sent: Tuesday, 18 February 2014 8:18 AM
To: xymon at xymon.com
Subject: [Xymon] FILES in analysis.cfg
Hi,
I started monitoring some files.
I can't really understand how this works.
Xymon 4.3.10 on Solaris 10
client-local.cfg:
[sunos]
file:`ls -1 /var/tmp/sys-heartbeat-*`
analysis.cfg:
HOST=myhost
FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700
FILE /var/tmp/sys-heartbeat-testing red MTIME<3700
On myhost I got a file /var/tmp/sys-heartbeat-myhost but /var/tmp/sys-heartbeat-testing is missing (for testing)
If sys-heartbeat-myhost is older than 3700 second the files test goes red.
If sys-heartbeat-testing doesn't exist nothing happens at all.
The sys-heartbeat-testing line does not show up on the test but sys-heartbeat-myhost does.
Clicking on the sys-heartbeat-myhost shows me all the file data.
The syntax in the manual states.
FILE filename [color] [things to check] [TRACK]
noexist
triggers a warning if the file exists. By default, a warning is triggered for files that have a FILE entry, but which do not exist.
That should mean that if the file doesn't exist it should go red.
In the examples in analysis.cfg the color is in another spot.
# Example: Check that the /var/log/messages file is not empty and was updated
# within the past 10 minutes, and go yellow if either fails:
# FILE /var/log/messages SIZE>0 MTIME<600 yellow
I guess that is just a typo.
I have tried both and it seems it doesn't matter.
What am I doing wrong?
- Roland Soderstrrom
list Roland Soderstrom
Hi, This is actually not a cluster it is just a homebrew perl app that sort of looses it sometimes. We use a function that creates this heartbeat file within the perl code so we know it's not hung. It is on all our hosts so I wanted to use the native FILE function. - Roland
▸
From: Phil Crooker [mailto:user-e8e31cd73303@xymon.invalid]
Sent: Tuesday, 18 February 2014 9:38 AM
To: Roland Soderstrom; xymon at xymon.com
Subject: RE: FILES in analysis.cfg
Coming out of left field - when we were using heartbeat (just a simple pair) I set up a client script on each box that ran cl_status:
HOST=`uname -n`
RESULT=`/usr/bin/cl_status nodestatus $HOST`
if test -n "$RESULT" # IF WE HAVE OUTPUT...
then
if echo "$RESULT" | egrep -qi "error|cannot"
then
COLOR="red"
elif echo "$RESULT" | egrep -qi "active"
then
COLOR="green"
else
COLOR="yellow"
fi
else
RESULT="No result for cl_status, please check."
COLOR="yellow"
fi
You'd probably want to tweak it but this worked pretty well. You can also just run cl_status from one host to test both but sometimes cl_status hangs when heartbeat doesn't respond, so two hosts are a bit more reliable. You can also better parse the cl_status response for when the normal slave becomes master....
cheers, Phil
From: Xymon on behalf of Roland Soderstrom
Sent: Tuesday, 18 February 2014 8:18 AM
To: xymon at xymon.com<mailto:xymon at xymon.com>
Subject: [Xymon] FILES in analysis.cfg
Hi,
I started monitoring some files.
I can't really understand how this works.
Xymon 4.3.10 on Solaris 10
client-local.cfg:
[sunos]
file:`ls -1 /var/tmp/sys-heartbeat-*`
analysis.cfg:
HOST=myhost
FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700
FILE /var/tmp/sys-heartbeat-testing red MTIME<3700
On myhost I got a file /var/tmp/sys-heartbeat-myhost but /var/tmp/sys-heartbeat-testing is missing (for testing)
If sys-heartbeat-myhost is older than 3700 second the files test goes red.
If sys-heartbeat-testing doesn't exist nothing happens at all.
The sys-heartbeat-testing line does not show up on the test but sys-heartbeat-myhost does.
Clicking on the sys-heartbeat-myhost shows me all the file data.
The syntax in the manual states.
FILE filename [color] [things to check] [TRACK]
noexist
triggers a warning if the file exists. By default, a warning is triggered for files that have a FILE entry, but which do not exist.
That should mean that if the file doesn't exist it should go red.
In the examples in analysis.cfg the color is in another spot.
# Example: Check that the /var/log/messages file is not empty and was updated
# within the past 10 minutes, and go yellow if either fails:
# FILE /var/log/messages SIZE>0 MTIME<600 yellow
I guess that is just a typo.
I have tried both and it seems it doesn't matter.
What am I doing wrong?
- Roland Soderstrrom
--Please consider the environment before printing this e-mail This message from ORIX Australia may contain confidential and/or privileged information. If you are not the intended recipient, any use, disclosure or copying of this message (or of any attachments to it) is not authorised. If you have received this message in error, please notify the sender immediately and delete the message and any attachments from your system. Please inform the sender if you do not wish to receive further communications by email. ORIX handles personal information according to a Privacy Policy that is consistent with the National Privacy Principles. Please let us know if you would like a copy. It is also available at http://www.orix.com.au
list Mark Felder
On Mon, Feb 17, 2014, at 15:48, Roland Soderstrom wrote:
client-local.cfg: [sunos] file:`ls -1 /var/tmp/sys-heartbeat-*`
I'm pretty sure you can't do that. You need to list every file individually.
list Paul Root
No that will work.
▸
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Mark Felder
Sent: Tuesday, February 18, 2014 6:33 AM
To: xymon at xymon.com
Subject: Re: [Xymon] FILES in analysis.cfg
On Mon, Feb 17, 2014, at 15:48, Roland Soderstrom wrote:client-local.cfg: [sunos] file:`ls -1 /var/tmp/sys-heartbeat-*`
I'm pretty sure you can't do that. You need to list every file individually.
list Henrik Størner
▸
Den 2014-02-18 13:32, Mark Felder skrev:
On Mon, Feb 17, 2014, at 15:48, Roland Soderstrom wrote:client-local.cfg: [sunos] file:`ls -1 /var/tmp/sys-heartbeat-*`I'm pretty sure you can't do that. You need to list every file individually.
I'm afraid you are wrong, it should work fine. Henrik
list Mike Burger
▸
On Mon, Feb 17, 2014, at 15:48, Roland Soderstrom wrote:client-local.cfg: [sunos] file:`ls -1 /var/tmp/sys-heartbeat-*`I'm pretty sure you can't do that. You need to list every file individually.
If the user really wants to be able to use a wildcard, another option might be something like: file:`find /var/tmp -type f -name sys-heartbeat-* | sort -r` -- Mike Burger http://www.bubbanfriends.org "It's always suicide-mission this, save-the-planet that. No one ever just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1
list Roland Soderstrom
Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file? - Roland
▸
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Mike Burger
Sent: Wednesday, 19 February 2014 2:43 AM
To: Mark Felder
Cc: xymon at xymon.com
Subject: Re: [Xymon] FILES in analysis.cfg
On Mon, Feb 17, 2014, at 15:48, Roland Soderstrom wrote:client-local.cfg: [sunos] file:`ls -1 /var/tmp/sys-heartbeat-*`I'm pretty sure you can't do that. You need to list every file individually.
If the user really wants to be able to use a wildcard, another option might be something like: file:`find /var/tmp -type f -name sys-heartbeat-* | sort -r` -- Mike Burger http://www.bubbanfriends.org "It's always suicide-mission this, save-the-planet that. No one ever just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1
list Mike Burger
▸
Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file?
The only way to do so is if you specify filename in question in your analysis.cfg...you might need to use the TRACK option, to do so.
▸
-- Mike Burger http://www.bubbanfriends.org "It's always suicide-mission this, save-the-planet that. No one ever just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1
list Roland Soderstrom
Sorry that didn't work either. FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 TRACK - Roland
▸
-----Original Message-----
From: Mike Burger [mailto:user-cc5c6e80f4c5@xymon.invalid] Sent: Wednesday, 19 February 2014 8:02 AM
To: Roland Soderstrom
Cc: xymon at xymon.com
Subject: Re: [Xymon] FILES in analysis.cfg
Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file?
The only way to do so is if you specify filename in question in your analysis.cfg...you might need to use the TRACK option, to do so. -- Mike Burger http://www.bubbanfriends.org "It's always suicide-mission this, save-the-planet that. No one ever just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1
list Henrik Størner
▸
Den 18-02-2014 21:52, Roland Soderstrom skrev:
Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file?
OK, I had to do some testing with this. The problem is that when the file does not exist, then the `ls -1 ...` will not produce any output. Without any output, Xymon cannot tell that there is a file-check happening. If you have an explicit filename in client-local.cfg, then the FILE check in analysis.cfg works as expected, because the xymon client will report that the specific file is missing. So: client-local.cfg: [myhost] file:/var/tmp/sys-heartbeat-myhost analysis.cfg HOST=myhost FILE %^/var/tmp/sys-heartbeat-.* MTIME<3700 This will go red if the file is missing, or it exists and is older than 3700 seconds. Regards, Henrik
list Roland Soderstrom
That worked perfectly! Just have to reverse the logic.... Thanks Henrik, amazing as always :D
▸
- Roland
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Henrik Størner
Sent: Wednesday, 19 February 2014 8:55 AM
To: xymon at xymon.com
Subject: Re: [Xymon] FILES in analysis.cfg
Den 18-02-2014 21:52, Roland Soderstrom skrev:Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file?
OK, I had to do some testing with this. The problem is that when the file does not exist, then the `ls -1 ...` will not produce any output. Without any output, Xymon cannot tell that there is a file-check happening. If you have an explicit filename in client-local.cfg, then the FILE check in analysis.cfg works as expected, because the xymon client will report that the specific file is missing. So: client-local.cfg: [myhost] file:/var/tmp/sys-heartbeat-myhost analysis.cfg HOST=myhost FILE %^/var/tmp/sys-heartbeat-.* MTIME<3700 This will go red if the file is missing, or it exists and is older than 3700 seconds. Regards, Henrik
list Nick Pettefar
Is there also a way to have the red with a wildcard? I am thinking specifically about /var/core/core* files which are very important to know if they exist but have undetermined names. We also need the alarm to stay on until the core* files are removed. Regards, Nick Pettefar
▸
Date: Tue, 18 Feb 2014 22:54:30 +0100 From: Henrik St?rner <user-ce4a2c883f75@xymon.invalid> Subject: Re: [Xymon] FILES in analysis.cfgSo how do I get the files test go RED on a missing file?OK, I had to do some testing with this. The problem is that when the file does not exist, then the `ls -1 ...` will not produce any output. Without any output, Xymon cannot tell that there is a file-check happening. If you have an explicit filename in client-local.cfg, then the FILE check in analysis.cfg works as expected, because the xymon client will report that the specific file is missing. So: client-local.cfg: [myhost] file:/var/tmp/sys-heartbeat-myhost analysis.cfg HOST=myhost FILE %^/var/tmp/sys-heartbeat-.* MTIME<3700 This will go red if the file is missing, or it exists and is older than 3700 seconds. Regards, Henrik
Call Send SMS Add to Skype You'll need Skype CreditFree via Skype
list Paul Root
I do that now: analysis.cfg: FILE %^/core.* YELLOW NOEXIST client-local.cfg:file:`ls /core.*` so change YELLOW to RED, and adjust the path.
▸
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Nick Pettefar
Sent: Wednesday, February 19, 2014 10:29 AM
To: xymon
Subject: Re: [Xymon] FILES in analysis.cfg
Is there also a way to have the red with a wildcard? I am thinking
specifically about /var/core/core* files which are very important to
know if they exist but have undetermined names. We also need the
alarm to stay on until the core* files are removed.
Regards,
Nick Pettefar
Date: Tue, 18 Feb 2014 22:54:30 +0100 From: Henrik St?rner <user-ce4a2c883f75@xymon.invalid> Subject: Re: [Xymon] FILES in analysis.cfgSo how do I get the files test go RED on a missing file?OK, I had to do some testing with this. The problem is that when the file does not exist, then the `ls -1 ...` will not produce any output. Without any output, Xymon cannot tell that there is a file-check happening. If you have an explicit filename in client-local.cfg, then the FILE check in analysis.cfg works as expected, because the xymon client will report that the specific file is missing. So: client-local.cfg: [myhost] file:/var/tmp/sys-heartbeat-myhost analysis.cfg HOST=myhost FILE %^/var/tmp/sys-heartbeat-.* MTIME<3700 This will go red if the file is missing, or it exists and is older than 3700 seconds. Regards, Henrik
Call Send SMS Add to Skype You'll need Skype CreditFree via Skype
list Roland Soderstrom
This is really bugging me.
I had everything working fine for ONE host when I was testing.
Then I added all the other hosts and nothing worked anymore...
Ok,
I went back to first "working" config but that isn't working either.
Now I've been fiddling around so much I can hardly recall what I've tested and not.
Current config
client-local.cfg:
[myhost]
file:/var/tmp/ sys-heartbeat-myhost
file:/var/tmp/ sys-watchfor-myhost
analysis.cfg:
HOST=myhost
FILE %^/var/tmp/sys-watchfor-test4 red MTIME<3700
FILE /var/tmp/sys-watchfor-test5 MTIME<3700 RED
FILE %^/var/tmp/sys-watchfor-test6 MTIME<3700 red
FILE %^/var/tmp/sys-heartbeat-* red MTIME<3700
As before it shows the two files that actually are there on the files test page.
Clicking on those will show the actual data about the file..
/var/tmp/ sys-heartbeat-myhost
/var/tmp/ sys-watchfor-myhost
But nothing happens with my 3 "test" files.
I tried to debug this with
bin/xymond_client --debug --test
28605 2014-02-21 12:53:05 Transport setup is:
28605 2014-02-21 12:53:05 xymondportnumber = 1984
28605 2014-02-21 12:53:05 xymonproxyhost = NONE
28605 2014-02-21 12:53:05 xymonproxyport = 0
28605 2014-02-21 12:53:05 Recipient listed as '192.168.1.1
28605 2014-02-21 12:53:05 Standard protocol on port 1984
28605 2014-02-21 12:53:05 Will connect to address 192.168.1.1 port 1984
28605 2014-02-21 12:53:05 Connect status is 0
28605 2014-02-21 12:53:05 Sent 16 bytes
28605 2014-02-21 12:53:05 Read 3860 bytes
28605 2014-02-21 12:53:05 Closing connection
28605 2014-02-21 12:53:05 Opening file /usr/local/xymon/server/etc/analysis.cfg
<snip>
28605 2014-02-21 12:53:05 Compiling regex ^/var/tmp/swatch-sys-watchfor-test4
28605 2014-02-21 12:53:05 Compiling regex ^/var/tmp/swatch-sys-watchfor-test6
<snip>
So it actually do parse the FILE lines.
The actual test seems to not work with the FILE directive though....
Hostname (.=end, ?=dump, !=reload) []: myhost
Hosttype []:
Test (cpu, mem, disk, proc, log, port): files
Hostname (.=end, ?=dump, !=reload) [myhost]:
And I tried to add this to debug further in tasks,cfg
[clientdata]
ENVFILE /usr/local/xymon/server/etc/xymonserver.cfg
NEEDS xymond
CMD xymond_channel --debug --channel=client --log=$XYMONSERVERLOGS/clientdata.log xymond_client --debug
But can't see anything more in the logfile.
Any more ideas? I'm stuck.
▸
- Roland
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Henrik Størner
Sent: Wednesday, 19 February 2014 8:55 AM
To: xymon at xymon.com
Subject: Re: [Xymon] FILES in analysis.cfg
Den 18-02-2014 21:52, Roland Soderstrom skrev:Hi, That part work just fine. Anything the * expands to will be picked up by xymon. My question is the FILE directive in the analysis.cfg If I just set it to FILE /var/tmp/sys-heartbeat-myhost red MTIME<3700 Everything works just fine. But, If I change it to: FILE /var/tmp/sys-heartbeat-myhostttt red MTIME<3700 If I read the manual correctly it should go RED because there is no file called /var/tmp/sys-heartbeat-myhostttt If I touch the new myhostttt file it will show up on the test page That means the file:`ls -1 /var/tmp/sys-heartbeat-*` Works just fine as it should. So how do I get the files test go RED on a missing file?
OK, I had to do some testing with this. The problem is that when the file does not exist, then the `ls -1 ...` will not produce any output. Without any output, Xymon cannot tell that there is a file-check happening. If you have an explicit filename in client-local.cfg, then the FILE check in analysis.cfg works as expected, because the xymon client will report that the specific file is missing. So: client-local.cfg: [myhost] file:/var/tmp/sys-heartbeat-myhost analysis.cfg HOST=myhost FILE %^/var/tmp/sys-heartbeat-.* MTIME<3700 This will go red if the file is missing, or it exists and is older than 3700 seconds. Regards, Henrik