[hobbit] File existence monitoring
Charles Jones
jonescr at cisco.com
Thu Nov 29 01:22:33 CET 2007
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:David.Stuffle at adesa.com]
> *Sent:* Tuesday, November 27, 2007 5:15 PM
> *To:* hobbit at hswn.dk
> *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:greg.hubbard at eds.com]
> *Sent:* Tuesday, November 27, 2007 4:49 PM
> *To:* hobbit at hswn.dk
> *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:David.Stuffle at adesa.com]
> *Sent:* Tuesday, November 27, 2007 2:59 PM
> *To:* hobbit at hswn.dk
> *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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20071128/432254bc/attachment.html>
More information about the Xymon
mailing list