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: Callum Macdonald
Subject: Re: Alert if file contents are greater than 40
Date: Fri, 11 Jan 2013 10:54:07 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Hi Jenny,

Have you considered having monit measure the program's memory usage?

I think this line of the manual may be relevant to your situation:

On startup the read position is set to the end of the file and monit continue to scan to the end of file on each cycle. But if the file size should decrease or inode change the read position is set to the start of the file.

As I understand it, monit will probably read the file once, then wait for new lines to be written. In your case, if the filesize remains the same or increases, monit will never again read the first (and only) line of the file.

I think this feature is aimed at log file monitoring, when data is constantly being written to a continuous log file. If you were to write a new line to the file every 10 minutes and then truncate it every so often, that might work. But honestly, it all sounds far more complicated than letting monit measure your memory usage.

Love & joy - Callum.

On 11/01/13 05:26, Dimitri Yioulos wrote:
On Thursday 10 January 2013 4:24:27 pm Jenny Hopkins wrote:
Hullo,

I've been having an issue with memory hungry programs so
have written a script that takes a user and program
params and stuffs the memory usage into a file as an
integer. This is run by cron every ten minutes.
I want monit to keep an eye on the file contents and
alert if it exceeds a certain figure.
So far, I can only find evidence that monit supports text
file matches. I've tried

"check file memfile.irssi with path /tmp/memfile.irssi
if  match "[4-9][0-9]" then alert"

but this doesn't seem to work. I'm adding a \n to the end
of the file.

Sorry if this has been asked before.

Thanks,

Jenny



Er, Jenny. not to diss the capabilities of Monit, but why
don't you simply extend your script to send out an email
alert based on a memory usage threshhold?





reply via email to

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