monit-general
[Top][All Lists]
Advanced

[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:1.8.1.17) 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: http://savannah.nongnu.org/cvs/?group=monit


Test case configuration:
--8<--
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"
--8<--


1.) On start monit detects the file doesn't exist and calls the start program:
--8<--
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
--8<--

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

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


Martin



Joe Shang wrote:
Sure?

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/nothing.sh"
        if changed checksum
                then exec "/usr/local/testconfig.sh"

Its erroring out with:

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

I want it to run nothing.sh 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?

Joe

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):
http://mmonit.com/monit/dist/beta/

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"


Martin


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:
http://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general



--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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