No luck using a simpler script. Any more suggestions? Is there any
other way to try and see if exec runs?
This is monit version 4.9
<my new simple test.sh script>
#!/bin/sh
touch /test/test.txt
</my new simple test.sh script>
Even changing exec to call touch directly does not work.
<modified monit.rc section>
check process apache with pidfile /var/run/httpd.pid
group www-data
start program = "/usr/sbin/apachectl -k start"
stop program = "/usr/sbin/apachectl -k stop"
if failed host 127.0.0.1 port 80 then exec "/bin/touch /test/test.txt"
</modified monit.rc section>
On Jan 3, 2008 2:37 PM, rory wrote:
stdin and stdout are closed by monit when it forks. So try a simple
script that just touches a file and see if you get the same problem.
CHRISTOPHER HOEY wrote:
I can not seem to get the exec command to run a shell script that I
want to run on failure. Alerts are sent out fine but no evidence of
any attempt to run the exec command are seen using the verbose flag or
in the logs. I can run the shell script without a problem outside of
monit. I am fairly certain all the permissions are correct. Should I
be seeing any indication that monit is even trying to exec something?
Any help is appreciated.
<my monit rc file>
set init
set daemon 60
set logfile syslog facility log_daemon
set alert address@hidden
set httpd port 1080
allow localhost
set mail-format {
subject: $HOST alert - $SERVICE $EVENT at $DATE
message: $EVENT. This caused monit to $ACTION for $SERVICE at
$DATE. Event description:
$DESCRIPTION
FROM $HOST (via monit)
}
check process apache with pidfile /var/run/httpd.pid
group www-data
mode passive
start program = "/usr/sbin/apachectl -k start"
stop program = "/usr/sbin/apachectl -k stop"
if failed host 127.0.0.1 <http://127.0.0.1> port 80 then exec
"/bin/sh -c /monit/etc/includes/test.sh"
</my monit rc file>
<my test.sh file>
#!/bin/sh
echo name of script is $0
echo first argument is $1
echo second argument is $2
echo third argument is $3
echo fourth argument is $4
echo number of arguments is $#
echo $1 >> /test/test.txt
</my test.sh file>
<my monit.log>
[EST Jan 3 13:02:46] debug : monit: pidfile '/var/run/monit.pid'
does not exist
[EST Jan 3 13:02:46] info : Starting monit daemon with http
interface at [*:1080]
[EST Jan 3 13:02:46] info : Starting monit HTTP server at [*:1080]
[EST Jan 3 13:02:46] info : monit HTTP server started
[EST Jan 3 13:02:46] info : Monit started
[EST Jan 3 13:02:46] debug : Monit instance changed notification
is sent to address@hidden
[EST Jan 3 13:02:46] debug : cannot open file /proc/23378/stat --
No such file or directory
[EST Jan 3 13:02:46] debug : system statistic error -- cannot read
/proc/23378/stat
[EST Jan 3 13:02:46] debug : 'apache' zombie check passed
[status_flag=0000]
[EST Jan 3 13:02:46] debug : 'apache' succeeded connecting to
INET[ 127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:02:46] debug : 'apache' succeeded testing protocol
[DEFAULT] at INET[127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:03:46] info : Monit has not changed
[EST Jan 3 13:03:46] debug : 'apache' zombie check passed
[status_flag=0000]
[EST Jan 3 13:03:46] debug : 'apache' PID has not changed since
last cycle
[EST Jan 3 13:03:46] debug : 'apache' PPID has not changed since
last cycle
[EST Jan 3 13:03:46] debug : 'apache' succeeded connecting to
INET[127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:03:46] debug : 'apache' succeeded testing protocol
[DEFAULT] at INET[ 127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:04:46] debug : 'apache' zombie check passed
[status_flag=0000]
[EST Jan 3 13:04:46] debug : 'apache' PID has not changed since
last cycle
[EST Jan 3 13:04:46] debug : 'apache' PPID has not changed since
last cycle
[EST Jan 3 13:04:46] debug : 'apache' succeeded connecting to
INET[127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:04:46] debug : 'apache' succeeded testing protocol
[DEFAULT] at INET[127.0.0.1:80 <http://127.0.0.1:80>] via TCP
[EST Jan 3 13:05:46] debug : monit: pidfile '/var/run/httpd.pid'
does not exist
[EST Jan 3 13:05:46] error : 'apache' process is not running
[EST Jan 3 13:05:46] debug : Does not exist notification is sent
to address@hidden
[EST Jan 3 13:06:46] debug : monit: pidfile '/var/run/httpd.pid'
does not exist
[EST Jan 3 13:06:46] error : 'apache' process is not running
[EST Jan 3 13:07:46] debug : monit: pidfile '/var/run/httpd.pid'
does not exist
[EST Jan 3 13:07:46] error : 'apache' process is not running
</my monit.log>
------------------------------------------------------------------------
--
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