monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alert if file contents are greater than 40


From: Jenny Hopkins
Subject: Re: Alert if file contents are greater than 40
Date: Fri, 11 Jan 2013 16:32:23 +0000

On 11 January 2013 12:35, Michael Johnson - MJ <address@hidden> wrote:
> I think you are trying to accomplish something that monit simply was not
> intended to do, that being said, here is a work around that will absolutely
> work given the documentation
>
> * Modify your script slightly to to initially write out the new data into
> /path/to/file.new
>
> * Once the file is written, have your script move the file to /path/to/file
> (the intended location.
>
> This will have the side effect of ensuring the inode is updated each time
> new data is available and thus monit will reread the file.  Additionally,
> this also will ensure that the full contents of the file are in place before
> monit reads the file because a move is an atomic operation.  This may not be
> of concern to you nor terribly important for this particular task, but it is
> worth noting as it can be very important.
>
> Long term I would suggest you look at handlng this differently.  For short
> term, this will get you going and if you decide to keep it around, you may
> want to revisit the methodology in the future.
>


Hooray! Creating a new inode each time has worked.
As Dimitri said in the first place, it would have been a lot simpler
to write it in to the bash script.  The benefits of having it done by
monit, however, are 1) I have a tendency to ignore sysadmin emails and
not notice the alert, but I do usually have the monit web page open,
and 2) the script can be called for different
users/programs/max-mem-usage from monit just by editing monitrc.

Sorry to bother you all trying to get monit to do un-monity things,
and thanks for the help!

Jenny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]