[Top][All Lists]

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

Re: [monit] check file - if missing to do XX? possible?

From: Martin Pala
Subject: Re: [monit] check file - if missing to do XX? possible?
Date: Sat, 15 Nov 2008 21:13:49 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080829 Iceape/1.1.12 (Debian-1.1.12-1)

You are right ... the same situation was fixed for size test only.

I have fixed the same for the checksum test as well, you can get the fixed version from cvs:

Test case configuration:
set daemon  5
set logfile /var/log/monit
set httpd port 2812
    use address localhost
    allow  localhost

check file test with path "/tmp/test"
  start program = "/bin/touch /tmp/test"
  if changed checksum then exec "/bin/true"

1.) On start monit detects the file doesn't exist and calls the start program:
Starting monit daemon with http interface at [localhost:2812]
Starting monit HTTP server at [localhost:2812]
monit HTTP server started
'unicorn' Monit started
'test' file doesn't exist
'test' trying to restart
Monitoring disabled -- service test
'test' start: /bin/touch
Monitoring enabled -- service test
'unicorn' Monit has not changed
'test' file existence check succeeded
'test' file exist
'test' is a regular file

2.) when the checksum changes, the script is executed:

'test' checksum was changed for /tmp/test
'test' exec: /bin/true


Joe Shang wrote:

It isn't working for me.

I am using :

This is monit version 5.0_beta4

check file TEST
        with path /home/TEST/nginx/TESTFILE
        start program = "/usr/local/"
        if changed checksum
                then exec "/usr/local/"

Its erroring out with:

:5: Error: cannot compute a checksum for file  /home/TEST/nginx/TESTFILE 'TEST'

I want it to run if the file doesn't exist, but if it does
exist, to continue monitoring it with checksum changes.

But it isn't working here , should it, or am I missing something here?


On Fri, Nov 14, 2008 at 11:50 AM, Martin Pala <address@hidden> wrote:
The limitation where Monit required monitored file to exist on Monit start
was removed in upcoming Monit 5.0, you can get the last beta here (note that
the beta is production stable):

If the file doesn't exist, Monit executes automatically the start program =>
everything you need to do is define the start program like this:

 check file with path /home/thisfile.txt
   start program = "/path/to/my/script"


On Nov 14, 2008, at 1:37 AM, Joe Shang wrote:

I want to enable in monit, to check for a file, like

check file with path /home/thisfile.txt

And I want if the file does not exist to execute a script for me... etc.

Though what happens is monit doesn't even start cause that file does
not exist, how can get over this? are there different parameters?

Because I have other arguments that if file does exist, to check for
changed checksum, and if changed to run a certain script.

But what is most important to me, is to check if the file exist, and
if not.. well execute something.

To unsubscribe:

To unsubscribe:

To unsubscribe:

reply via email to

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