Xymon Mailing List Archive search

File existence monitoring

6 messages in this thread

list David Stuffle · Tue, 27 Nov 2007 15:58:38 -0500 ·
Hi,

I'm wanting to check the existence of specific files in a directory and
that they are at leat 1K in size.  I have this in the hobbit-clients.cfg
file:

 
HOST=hostname1

        PROC httpd

        FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

        FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
TIME=*:0730:1800

        FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
TIME=*:0730:1800

        FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
TIME=*:0730:1800

        FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
TIME=*:0730:1800

        FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
TIME=*:0730:1800

        FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
TIME=*:0730:1800

 
And this in client-local.cfg:

 
[hostname1]

file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls -1tr |
tail -1`

file:`ls -1 /usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

file:`ls -1 /usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

file:`ls -1 /usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

file:`ls -1 /usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

file:`ls -1 /usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

file:`ls -1 /usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

 
They all show up under the files column.  To test it, I deleted the file
specified in the last line from the directory, but all Hobbit does is
remove it from displaying.  I want it to go red saying that the file
does not exist.

 
The man pages says "By default, a warning is triggered for files that
have a FILE entry, but which do not exist."  But, I'm not seeing this
occur.

 
Any ideas?

 
D. Stuffle   

DISCLAIMER:
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.
list Greg L Hubbard · Tue, 27 Nov 2007 15:48:50 -0600 ·
If the file names never change, then specify the file name in the
client-local.cfg instead of running the ls command.  If you delete the
file, then the ls command will return nothing.  That is what I would try
first, anyway.
 
Or, it could be your check -- you are only asking for an alarm if the
file size is bigger than 1K.  A missing file is not bigger than 1K is
it?  And it seems like you need to do some other things as well to get
this correct.  I am working from memory...
 
GLH


	From: Stuffle, David (Corporate)
[mailto:user-b750360cbb5f@xymon.invalid] 
	Sent: Tuesday, November 27, 2007 2:59 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] File existence monitoring
quoted from David Stuffle
	
	
	Hi,

	I'm wanting to check the existence of specific files in a
directory and that they are at leat 1K in size.  I have this in the
hobbit-clients.cfg file:

	 
	HOST=hostname1

	        PROC httpd

	        FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

	        FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
TIME=*:0730:1800

	 
	And this in client-local.cfg:

	 
	[hostname1]

	file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls
-1tr | tail -1`

	file:`ls -1
/usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

	file:`ls -1
/usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

	file:`ls -1
/usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

	file:`ls -1
/usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

	file:`ls -1
/usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

	file:`ls -1
/usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

	 
	They all show up under the files column.  To test it, I deleted
the file specified in the last line from the directory, but all Hobbit
does is remove it from displaying.  I want it to go red saying that the
file does not exist.

	 
	The man pages says "By default, a warning is triggered for files
that have a FILE entry, but which do not exist."  But, I'm not seeing
this occur.

	 
	Any ideas?

	 
	D. Stuffle   

	DISCLAIMER:
	The information transmitted is intended only for the person or
entity to 
	which it is addressed and may contain confidential and/or
privileged material.
	Any review, retransmission, dissemination or other use of, or
taking of
	any action in reliance upon, this information by persons or
entities other
	than the intended recipient is prohibited. If you received this
in error,
	please contact the sender and destroy any copies of this
document and
	any attachments.
list David Stuffle · Tue, 27 Nov 2007 17:15:10 -0500 ·
Thanks Greg, 

The filenames do change, they have the date appended to them.  I'm
wanting to check that the files are there and that they're not 0 bytes.


I know that when I was first setting it up I messed up something and it
said "File missing" when it didn't find the file.  Now it doesn't seem
to care.  

 
D. Stuffle
quoted from Greg L Hubbard


From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] 
Sent: Tuesday, November 27, 2007 4:49 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] File existence monitoring

 
If the file names never change, then specify the file name in the
client-local.cfg instead of running the ls command.  If you delete the
file, then the ls command will return nothing.  That is what I would try
first, anyway.

 
Or, it could be your check -- you are only asking for an alarm if the
file size is bigger than 1K.  A missing file is not bigger than 1K is
it?  And it seems like you need to do some other things as well to get
this correct.  I am working from memory...

 
GLH

	 
	From: Stuffle, David (Corporate)
[mailto:user-b750360cbb5f@xymon.invalid] 
	Sent: Tuesday, November 27, 2007 2:59 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] File existence monitoring

	Hi,

	I'm wanting to check the existence of specific files in a
directory and that they are at leat 1K in size.  I have this in the
hobbit-clients.cfg file:

	 
	HOST=hostname1

	        PROC httpd

	        FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

	        FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
TIME=*:0730:1800

	 
	And this in client-local.cfg:

	 
	[hostname1]

	file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls
-1tr | tail -1`

	file:`ls -1
/usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

	file:`ls -1
/usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

	file:`ls -1
/usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

	file:`ls -1
/usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

	file:`ls -1
/usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

	file:`ls -1
/usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

	 
	They all show up under the files column.  To test it, I deleted
the file specified in the last line from the directory, but all Hobbit
does is remove it from displaying.  I want it to go red saying that the
file does not exist.

	 
	The man pages says "By default, a warning is triggered for files
that have a FILE entry, but which do not exist."  But, I'm not seeing
this occur.

	 
	Any ideas?

	 
	D. Stuffle   

	DISCLAIMER:
	The information transmitted is intended only for the person or
entity to 
	which it is addressed and may contain confidential and/or
privileged material.
	Any review, retransmission, dissemination or other use of, or
taking of
	any action in reliance upon, this information by persons or
entities other
	than the intended recipient is prohibited. If you received this
in error,
	please contact the sender and destroy any copies of this
document and
	any attachments.

DISCLAIMER:
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.
list David Stuffle · Wed, 28 Nov 2007 12:10:34 -0500 ·
I found part of my problem of why the file existence isn't working.  I
wasn't specifying the full path in the hobbit-clients.cfg file.  I also
had to escape the forward slashes and underscores with backslashes.
Plus, the "red" parameter wasn't valid from what the log said.

 
But still, I want to know if a file doesn't exist.  The hobbitcleint.log
file on the client just keeps saying

 "ls: /usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*: No such
file or directory".  Therefore, it doesn't report anything about it.
But I want to be alerted that it doesn't exist.

 
Is anyone successfully monitoring file existence?

 
D. Stuffle
quoted from David Stuffle

 
From: Stuffle, David (Corporate) [mailto:user-b750360cbb5f@xymon.invalid] 
Sent: Tuesday, November 27, 2007 5:15 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] File existence monitoring

 
Thanks Greg, 

The filenames do change, they have the date appended to them.  I'm
wanting to check that the files are there and that they're not 0 bytes.


I know that when I was first setting it up I messed up something and it
said "File missing" when it didn't find the file.  Now it doesn't seem
to care.  

 
D. Stuffle


From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] 
Sent: Tuesday, November 27, 2007 4:49 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] File existence monitoring

 
If the file names never change, then specify the file name in the
client-local.cfg instead of running the ls command.  If you delete the
file, then the ls command will return nothing.  That is what I would try
first, anyway.

 
Or, it could be your check -- you are only asking for an alarm if the
file size is bigger than 1K.  A missing file is not bigger than 1K is
it?  And it seems like you need to do some other things as well to get
this correct.  I am working from memory...

 
GLH

	 
	From: Stuffle, David (Corporate)
[mailto:user-b750360cbb5f@xymon.invalid] 
	Sent: Tuesday, November 27, 2007 2:59 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] File existence monitoring

	Hi,

	I'm wanting to check the existence of specific files in a
directory and that they are at leat 1K in size.  I have this in the
hobbit-clients.cfg file:

	 
	HOST=hostname1

	        PROC httpd

	        FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

	        FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
TIME=*:0730:1800

	 
	And this in client-local.cfg:

	 
	[hostname1]

	file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls
-1tr | tail -1`

	file:`ls -1
/usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

	file:`ls -1
/usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

	file:`ls -1
/usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

	file:`ls -1
/usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

	file:`ls -1
/usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

	file:`ls -1
/usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

	 
	They all show up under the files column.  To test it, I deleted
the file specified in the last line from the directory, but all Hobbit
does is remove it from displaying.  I want it to go red saying that the
file does not exist.

	 
	The man pages says "By default, a warning is triggered for files
that have a FILE entry, but which do not exist."  But, I'm not seeing
this occur.

	 
	Any ideas?

	 
	D. Stuffle   

	DISCLAIMER:
	The information transmitted is intended only for the person or
entity to 
	which it is addressed and may contain confidential and/or
privileged material.
	Any review, retransmission, dissemination or other use of, or
taking of
	any action in reliance upon, this information by persons or
entities other
	than the intended recipient is prohibited. If you received this
in error,
	please contact the sender and destroy any copies of this
document and
	any attachments.

DISCLAIMER:
The information transmitted is intended only for the person or entity to

which it is addressed and may contain confidential and/or privileged
material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities
other
than the intended recipient is prohibited. If you received this in
error,
please contact the sender and destroy any copies of this document and
any attachments.
DISCLAIMER:
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.
list Charles Jones · Wed, 28 Nov 2007 17:22:33 -0700 ·
It won't work the way you are doing it now.  You are using an ls command to dynamically create the list of files to check in your client-local, so when that file is missing, the ls command doesn't output it as a filename to check, so the test drops off when that file dissappears,

Since the files are dynamic, I assume created every day, you are going to have to figure out a way to tell if one of them goes away.  Maybe you could have a cron job that runs every morning, and does an ls of the files and saves the output somewhere like /var/tmp/todays_files.txt, and then in your client-local you could do something like:

[hostname]
file:`head -1 /var/tmp/todays_files.txt|tail -1`
file:`head -2 /var/tmp/todays_files.txt|tail -1`
file:`head -3 /var/tmp/todays_files.txt|tail -1`
...

That would add a file entry for every line of todays_files.txt.  So if one of the files got deleted, it would still be referenced in todays_files.txt, and thus continue to be monitored (including notification that it was no longer there).

That is a frightful way to do it, but I can't think of anything better at the moment :)  Dealing with randomly generated filenames is a pain.

-Charles
quoted from David Stuffle

Stuffle, David (Corporate) wrote:
I found part of my problem of why the file existence isn't working.  I wasn't specifying the full path in the hobbit-clients.cfg file.  I also had to escape the forward slashes and underscores with backslashes.  Plus, the "red" parameter wasn't valid from what the log said.

 
But still, I want to know if a file doesn't exist.  The hobbitcleint.log file on the client just keeps saying

 "ls: /usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*: No such file or directory".  Therefore, it doesn't report anything about it.  But I want to be alerted that it doesn't exist.

 
Is anyone successfully monitoring file existence?

 
D. Stuffle

 
*From:* Stuffle, David (Corporate) [mailto:user-b750360cbb5f@xymon.invalid]
*Sent:* Tuesday, November 27, 2007 5:15 PM
*To:* user-ae9b8668bcde@xymon.invalid
*Subject:* RE: [hobbit] File existence monitoring

 
Thanks Greg,

The filenames do change, they have the date appended to them.  I'm wanting to check that the files are there and that they're not 0 bytes. 
 
I know that when I was first setting it up I messed up something and it said "File missing" when it didn't find the file.  Now it doesn't seem to care. 
 
D. Stuffle


*From:* Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid]
*Sent:* Tuesday, November 27, 2007 4:49 PM
*To:* user-ae9b8668bcde@xymon.invalid
*Subject:* RE: [hobbit] File existence monitoring

 
If the file names never change, then specify the file name in the client-local.cfg instead of running the ls command.  If you delete the file, then the ls command will return nothing.  That is what I would try first, anyway.

 
Or, it could be your check -- you are only asking for an alarm if the file size is bigger than 1K.  A missing file is not bigger than 1K is it?  And it seems like you need to do some other things as well to get this correct.  I am working from memory...

 
GLH

     
    *From:* Stuffle, David (Corporate) [mailto:user-b750360cbb5f@xymon.invalid]
    *Sent:* Tuesday, November 27, 2007 2:59 PM
    *To:* user-ae9b8668bcde@xymon.invalid
    *Subject:* [hobbit] File existence monitoring

    Hi,

    I'm wanting to check the existence of specific files in a
    directory and that they are at leat 1K in size.  I have this in
    the hobbit-clients.cfg file:

     
    HOST=hostname1

            PROC httpd

            FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

            FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
    TIME=*:0730:1800

            FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
    TIME=*:0730:1800

            FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
    TIME=*:0730:1800

            FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
    TIME=*:0730:1800

            FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
    TIME=*:0730:1800

            FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
    TIME=*:0730:1800

     
    And this in client-local.cfg:

     
    [hostname1]

    file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls -1tr
    | tail -1`

    file:`ls -1 /usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

    file:`ls -1 /usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

    file:`ls -1 /usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

    file:`ls -1 /usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

    file:`ls -1 /usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

    file:`ls -1 /usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

     
    They all show up under the files column.  To test it, I deleted
    the file specified in the last line from the directory, but all
    Hobbit does is remove it from displaying.  I want it to go red
    saying that the file does not exist.

     
    The man pages says "By default, a warning is triggered for files
    that have a FILE entry, but which do not exist."  But, I'm not
    seeing this occur.

     
    Any ideas?

     
    D. Stuffle   
    DISCLAIMER:

    The information transmitted is intended only for the person or entity to 
    which it is addressed and may contain confidential and/or privileged material.

    Any review, retransmission, dissemination or other use of, or taking of

    any action in reliance upon, this information by persons or entities other

    than the intended recipient is prohibited. If you received this in error,

    please contact the sender and destroy any copies of this document and

    any attachments.

DISCLAIMER:
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.
DISCLAIMER:
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.
list David Stuffle · Thu, 29 Nov 2007 15:45:37 -0500 ·
Well, I finally have file existence working with changing filenames.
Thanks for the suggestion Charles.  It wouldn't exactly work for me
though since the files may never be created.

 
The documentation of client-local.cfg says "Putting wildcards directly
into the file: entry will not work."  But, you can do something like
this:

 
file:`echo /usr/local/scripts/logs/logfile.*`

 
Since the beginning of the filename is always the same, doing the echo
command on the filename still reported a name that Hobbit could check
against.

 
Then, in the hobbit-client.cfg, I have this:

FILE %^\/usr\/local\/scripts\/logs\/logfile.* SIZE>1K

 
This checks that the file is there and that it's over 1K in size.

 
Thanks!

 
D. Stuffle  
quoted from Charles Jones


From: Charles Jones [mailto:user-e86b4aeade4e@xymon.invalid] 
Sent: Wednesday, November 28, 2007 7:23 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] File existence monitoring

 
It won't work the way you are doing it now.  You are using an ls command
to dynamically create the list of files to check in your client-local,
so when that file is missing, the ls command doesn't output it as a
filename to check, so the test drops off when that file dissappears,

Since the files are dynamic, I assume created every day, you are going
to have to figure out a way to tell if one of them goes away.  Maybe you
could have a cron job that runs every morning, and does an ls of the
files and saves the output somewhere like /var/tmp/todays_files.txt, and
then in your client-local you could do something like:

[hostname]
file:`head -1 /var/tmp/todays_files.txt|tail -1`
file:`head -2 /var/tmp/todays_files.txt|tail -1`
file:`head -3 /var/tmp/todays_files.txt|tail -1`
...

That would add a file entry for every line of todays_files.txt.  So if
one of the files got deleted, it would still be referenced in
todays_files.txt, and thus continue to be monitored (including
notification that it was no longer there).

That is a frightful way to do it, but I can't think of anything better
at the moment :)  Dealing with randomly generated filenames is a pain.

-Charles

Stuffle, David (Corporate) wrote: 

I found part of my problem of why the file existence isn't working.  I
wasn't specifying the full path in the hobbit-clients.cfg file.  I also
had to escape the forward slashes and underscores with backslashes.
Plus, the "red" parameter wasn't valid from what the log said.

 
But still, I want to know if a file doesn't exist.  The hobbitcleint.log
file on the client just keeps saying

 "ls: /usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*: No such
file or directory".  Therefore, it doesn't report anything about it.
But I want to be alerted that it doesn't exist.

 
Is anyone successfully monitoring file existence?

 
D. Stuffle

 
From: Stuffle, David (Corporate) [mailto:user-b750360cbb5f@xymon.invalid] 
Sent: Tuesday, November 27, 2007 5:15 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] File existence monitoring

 
Thanks Greg, 

The filenames do change, they have the date appended to them.  I'm
wanting to check that the files are there and that they're not 0 bytes.


I know that when I was first setting it up I messed up something and it
said "File missing" when it didn't find the file.  Now it doesn't seem
to care.  

 
D. Stuffle


From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] 
Sent: Tuesday, November 27, 2007 4:49 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] File existence monitoring

 
If the file names never change, then specify the file name in the
client-local.cfg instead of running the ls command.  If you delete the
file, then the ls command will return nothing.  That is what I would try
first, anyway.

 
Or, it could be your check -- you are only asking for an alarm if the
file size is bigger than 1K.  A missing file is not bigger than 1K is
it?  And it seems like you need to do some other things as well to get
this correct.  I am working from memory...

 
GLH

	 
	From: Stuffle, David (Corporate)
[mailto:user-b750360cbb5f@xymon.invalid] 
	Sent: Tuesday, November 27, 2007 2:59 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] File existence monitoring

	Hi,

	I'm wanting to check the existence of specific files in a
directory and that they are at leat 1K in size.  I have this in the
hobbit-clients.cfg file:

	 
	HOST=hostname1

	        PROC httpd

	        FILE %^sdc_.* MTIME<3600 TIME=W:0730:2200 red

	        FILE %^dcs1xaz9saotnw713cmtaut8c_6w3j.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsaplg0kbotnwvrj16x28msg_1i2n.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsdq1p60cotnw32xcywlbisg_9i5q.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsmnj8yecotnwbcevyym9t8c_4d7i.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsp6ro5kbotnwvjh6yh0dmsg_3j1y.* red size>1K
TIME=*:0730:1800

	        FILE %^dcsu5rokrbotnwb01tmd19mat_4w7s.* red size>1K
TIME=*:0730:1800

	 
	And this in client-local.cfg:

	 
	[hostname1]

	file:`find /usr/local/webtrends/sdc/weblog -type f | xargs ls
-1tr | tail -1`

	file:`ls -1
/usr/local/scripts/logs/dcs1xaz9saotnw713cmtaut8c_6w3j*`

	file:`ls -1
/usr/local/scripts/logs/dcsaplg0kbotnwvrj16x28msg_1i2n*`

	file:`ls -1
/usr/local/scripts/logs/dcsdq1p60cotnw32xcywlbisg_9i5q*`

	file:`ls -1
/usr/local/scripts/logs/dcsmnj8yecotnwbcevyym9t8c_4d7i*`

	file:`ls -1
/usr/local/scripts/logs/dcsp6ro5kbotnwvjh6yh0dmsg_3j1y*`

	file:`ls -1
/usr/local/scripts/logs/dcsu5rokrbotnwb01tmd19mat_4w7s*`

	 
	They all show up under the files column.  To test it, I deleted
the file specified in the last line from the directory, but all Hobbit
does is remove it from displaying.  I want it to go red saying that the
file does not exist.

	 
	The man pages says "By default, a warning is triggered for files
that have a FILE entry, but which do not exist."  But, I'm not seeing
this occur.

	 
	Any ideas?

	 
	D. Stuffle   

	DISCLAIMER:
	The information transmitted is intended only for the person or
entity to 
	which it is addressed and may contain confidential and/or
privileged material.
	Any review, retransmission, dissemination or other use of, or
taking of
	any action in reliance upon, this information by persons or
entities other
	than the intended recipient is prohibited. If you received this
in error,
	please contact the sender and destroy any copies of this
document and
	any attachments.

DISCLAIMER:
The information transmitted is intended only for the person or entity to

which it is addressed and may contain confidential and/or privileged
material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities
other
than the intended recipient is prohibited. If you received this in
error,
please contact the sender and destroy any copies of this document and
any attachments.
DISCLAIMER:
The information transmitted is intended only for the person or entity to

which it is addressed and may contain confidential and/or privileged
material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities
other
than the intended recipient is prohibited. If you received this in
error,
please contact the sender and destroy any copies of this document and
any attachments.
  

DISCLAIMER:
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of
any action in reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and destroy any copies of this document and
any attachments.