[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[monit] Re: File check with execution of a script
From: |
Julian Thomé |
Subject: |
[monit] Re: File check with execution of a script |
Date: |
Thu, 25 Sep 2008 12:09:58 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080724) |
Hi,
thank you for the fast answer.
I have written a little script, which examines the existence of 3 files
but i don't understand the output.
Szenario:
I have 3 checks MNT, MNTDEP, MNTDEPDEP
and MNT depends on MNTDEP and MNTDEP depends on MNTDEPDEP.
my monitrc- file
----------------------
# alle n Sekunden sollen die Dienste überprüft werden
set daemon 300
#Mailserver für Benachrichtigungen
set mailserver localhost
# Absenderadresse der benachrichtigungen
set mail-format { from: address@hidden }
# Empfänger für die Benachrichtigungen
set alert address@hidden
set httpd port 28212 and
allow localhost
set logfile /etc/monit/monit.log
check file MNT with path /etc/monit/monit.txt
start program = "/etc/monit/monit.sh start"
stop program = "/etc/monit/monit.sh stop"
depends on MNTDEP
check file MNTDEP with path /etc/monit/monit_dep.txt
start program = "/etc/monit/monit_dep.sh start"
stop program = "/etc/monit/monit_dep.sh stop"
depends on MNTDEPDEP
check file MNTDEPDEP with path /etc/monit/monit_dep_dep.txt
start program = "/etc/monit/monit_dep_dep.sh start"
stop program = "/etc/monit/monit_dep_dep.sh stop"
here are the 3 shellscripts which should be executed if a file doesn' exist.
monit.sh
#!/bin/bash
case $1 in
start)
touch monit.txt
echo "asdfasdfasdfasdf" > /etc/monit/monit.txt
echo "monit start" >> /etc/monit/hier.txt
;;
stop)
echo "monit stop" >> /etc/monit/hier.txt
;;
esac
monit_dep.sh
----------------------
#!/bin/bash
case $1 in
start)
echo "asdfasdfasdfasdf" > /etc/monit/monit_dep.txt
echo "monit_dep start" >> /etc/monit/hier.txt
;;
stop)
echo "monit_dep stop" >> /etc/monit/hier.txt
;;
esac
monit_dep_dep.sh
----------------------
#!/bin/bash
case $1 in
start)
echo "asdfasdfasdfasdf" > /etc/monit/monit_dep_dep.txt
echo "monit_dep_dep start" >> /etc/monit/hier.txt
;;
stop)
echo "monit_dep_dep stop" >> /etc/monit/hier.txt
;;
esac
If for example the files monit_dep_dep.txt and monit_dep.txt doesnt
exist in the monit.log (and here.txt) you can
see the following sequence:
monit stop
monit_dep_dep start
monit_dep start
monit start.
Could someone explain me why the start-file from MNTDEPDEP is executed.
I really don't understand that, because the file monit_deb_deb.txt exists ?
Thank you very much
Julian Thomé
___________________________________________________________
Der fr�he Vogel f�ngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
http://mail.yahoo.de
- [monit] Re: File check with execution of a script,
Julian Thomé <=