Xymon Mailing List Archive search

File check question

6 messages in this thread

list Galen Johnson · Fri, 13 Dec 2013 17:10:57 -0500 ·
Hey,

I have a question about file tests.  The man pages say

FILE filename [color] [things to check] [TRACK]

I have a test defined as

FILE /tmp/ldap2pw.lck red NOEXIST MTIME>900

How does the "[things to check]" actually parse?  Is it an "and" or an
"or"?  In other words, would that read "the file exists AND hasn't been
modified for more than 15 minutes" or "the file exists OR hasn't been
modified for more than 15 minutes".  I'm assuming "and"...actually I
need it to be "and" in this case.  Or do I have to explicitly say
something like "NOEXIST and MTIME>900"?  I can't find anything about that.

thx

=G=
list Paul Root · Sat, 14 Dec 2013 02:59:04 +0000 ·
You saying no exist not exist. The way I read it they are ANDs. 
quoted from Galen Johnson


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Galen Johnson
Sent: Friday, December 13, 2013 4:11 PM
To: xymon at xymon.com
Subject: [Xymon] File check question

Hey,

I have a question about file tests.  The man pages say

FILE filename [color] [things to check] [TRACK]

I have a test defined as

FILE /tmp/ldap2pw.lck red NOEXIST MTIME>900

How does the "[things to check]" actually parse?  Is it an "and" or an
"or"?  In other words, would that read "the file exists AND hasn't been
modified for more than 15 minutes" or "the file exists OR hasn't been
modified for more than 15 minutes".  I'm assuming "and"...actually I
need it to be "and" in this case.  Or do I have to explicitly say
something like "NOEXIST and MTIME>900"?  I can't find anything about that.

thx

=G=
list Galen Johnson · Sat, 14 Dec 2013 21:38:03 +0000 ·
Figured it out.  I made the mistake of believing the man page and doc in analysis.cfg.

FILE filename [color] [things to check] [TRACK]

Should read:

FILE filename [things to check] [color] [TRACK]

color needs to come after the checks.  I happened to notice one of the examples used this and changed mine to use it and (surprise) my file test started working.

=G=
quoted from Paul Root
From: Root, Paul T <user-76fdb6883669@xymon.invalid>
Sent: Friday, December 13, 2013 9:59 PM
To: Galen Johnson; xymon at xymon.com
Subject: RE: [Xymon] File check question

You saying no exist not exist. The way I read it they are ANDs.


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Galen Johnson
Sent: Friday, December 13, 2013 4:11 PM
To: xymon at xymon.com
Subject: [Xymon] File check question

Hey,

I have a question about file tests.  The man pages say

FILE filename [color] [things to check] [TRACK]

I have a test defined as

FILE /tmp/ldap2pw.lck red NOEXIST MTIME>900

How does the "[things to check]" actually parse?  Is it an "and" or an
"or"?  In other words, would that read "the file exists AND hasn't been
modified for more than 15 minutes" or "the file exists OR hasn't been
modified for more than 15 minutes".  I'm assuming "and"...actually I
need it to be "and" in this case.  Or do I have to explicitly say
something like "NOEXIST and MTIME>900"?  I can't find anything about that.

thx

=G=
list Galen Johnson · Sat, 14 Dec 2013 19:50:13 -0500 ·
Well, this sucks.  Since I'm monitoring a tmp file, it only needs to
trigger if the file is older than 15 minutes.  However, if I use noexist,
is squawks if it exists, if I don't it squawks when it doesn't. Ultimately,
I don't care if it is there or not, only that it isn't older than 15
minutes if it does exist.  I'm stumped...maybe setting delayred to 20???
Anyone else ever had to solve this?
quoted from Galen Johnson


On Sat, Dec 14, 2013 at 4:38 PM, Galen Johnson <user-87f955643e3d@xymon.invalid>wrote:
Figured it out.  I made the mistake of believing the man page and doc in
analysis.cfg.

FILE filename [color] [things to check] [TRACK]

Should read:

FILE filename [things to check] [color] [TRACK]

color needs to come after the checks.  I happened to notice one of the
examples used this and changed mine to use it and (surprise) my file test
started working.

=G=
From: Root, Paul T <user-76fdb6883669@xymon.invalid>
Sent: Friday, December 13, 2013 9:59 PM
To: Galen Johnson; xymon at xymon.com
Subject: RE: [Xymon] File check question

You saying no exist not exist. The way I read it they are ANDs.


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Galen Johnson
Sent: Friday, December 13, 2013 4:11 PM
To: xymon at xymon.com
Subject: [Xymon] File check question

Hey,

I have a question about file tests.  The man pages say

FILE filename [color] [things to check] [TRACK]

I have a test defined as

FILE /tmp/ldap2pw.lck red NOEXIST MTIME>900

How does the "[things to check]" actually parse?  Is it an "and" or an
"or"?  In other words, would that read "the file exists AND hasn't been
modified for more than 15 minutes" or "the file exists OR hasn't been
modified for more than 15 minutes".  I'm assuming "and"...actually I
need it to be "and" in this case.  Or do I have to explicitly say
something like "NOEXIST and MTIME>900"?  I can't find anything about that.

thx

=G=

list Betsy Schwartz · Sat, 14 Dec 2013 21:03:33 -0500 ·
I think I'd just use a really short local ext script, along the lines of
if ((file exists) and (mtime >15)) then red else green
quoted from Galen Johnson


On Sat, Dec 14, 2013 at 7:50 PM, Galen Johnson <user-fc632e705d24@xymon.invalid> wrote:
Well, this sucks.  Since I'm monitoring a tmp file, it only needs to
trigger if the file is older than 15 minutes.  However, if I use noexist,
is squawks if it exists, if I don't it squawks when it doesn't. Ultimately,
I don't care if it is there or not, only that it isn't older than 15
minutes if it does exist.  I'm stumped...maybe setting delayred to 20???
Anyone else ever had to solve this?
list Henrik Størner · Mon, 20 Jan 2014 09:54:19 +0100 ·
quoted from Galen Johnson
 
Den 15.12.2013 01:50, Galen Johnson skrev: 
Well, this sucks.
Since I'm monitoring a tmp file, it only needs to trigger if the file is
older than 15 minutes. However, if I use noexist, is squawks if it
exists, if I don't it squawks when it doesn't. Ultimately, I don't care
if it is there or not, only that it isn't older than 15 minutes if it
does exist. I'm stumped...maybe setting delayred to 20??? Anyone else
ever had to solve this?

A late response ... but: 
There is an
(apparently undocumented) option for file- and log-checks. Adding
"optional" to the rule causes the check to be skipped if the file does
not exist. Sounds like this is what you need. So: 
FILE /tmp/blabla
mtime>600 optional color=red 
is what you are after. 
Regards, Henrik