[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [monit] File contents check
From: |
Martin Pala |
Subject: |
Re: [monit] File contents check |
Date: |
Sun, 09 Nov 2008 23:34:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.17) Gecko/20080829 Iceape/1.1.12 (Debian-1.1.12-1) |
Hi,
the content matching test saves the read position from last cycle. The
next cycle begins the match test on the last read position if the size
of the file is bigger then saved read position.
The read position can be reset and thus monit will start to check match
from the file beginning in following cases:
1.) either the inode changed (i.e. file was replaced)
2.) or the file size shrinked (i.e. the file was rewritten for example)
It was designed this way to allow to parse for example log files which
are being appended - in such case it's not possible to check everytime
from beginning because it will emit alarms for content which was handled
in previous cycles already and also the parsing will be slower as the
file will grow if restarted from the beginning each time.
Workaround for your situation:
##############################
Instead of rewriting the file for example by:
echo master > /var/run/cyso-ha/inetd
just apped the new state this way:
echo master >> /var/run/cyso-ha/inetd
Monit will in such case parse the file from last read position and grab
just the new state. The /var/run/cyso-ha/inetd will also contain history
of state changes this way as by-product.
Martin
Wijnand Wiersma wrote:
I think I don't really understand that feature, but I do need it for
what I have in mind.
I am trying to build a role based cluster and in my test setup I just
use inetd to test it.
check file inetd-group with path /var/run/cyso-ha/inetd
start program = "/opt/scripts/cyso-ha/start_role inetd"
stop program = "/opt/scripts/cyso-ha/stop_role inetd"
if match "master" then start
if match "slave" then start
if match "stopped" then stop
When I echo something into /var/run/cyso-ha/inetd I get following
message in my log:
Oct 28 20:16:02 cnode2 monit[2699]: 'inetd-group' file exist
and the start script really runs.
But when I echo "stopped" into that file nothing happens. I would expect
after reading the documentation my stop script should have run.
Is there something lacking in the documentation or is this a lack of brains?
Wijnand
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general