Thanks for data. The settings is OK, the problem is caused by the missing
interpreter on the beginning of the script ("#!/bin/bash" for example), it
should include look like this:
--8<--
#!/bin/bash
curl https://myfavoriteapp.com --location --silent --output /dev/null
--write-out "%{http_code}\n" | grep "[2].."
exit $?
--8<--
If the interpreter is missing, monit will log the following error in verbose
mode:
--8<--
'test' failed to execute '/tmp/test.sh' -- Exec format error
--8<--
I have updated the manual - added script example and described the
requirements:
http://www.mmonit.com/monit/documentation/monit.html#program_status_testing
Regards,
Martin
On May 7, 2012, at 4:41 AM, Grant Rettke wrote:
> Hi Martin,
>
> On Sun, May 6, 2012 at 12:42 PM, Martin Pala <[email protected]> wrote:
>> please can you run monit in verbose mode (-v option) and provide the output
>> and also output of "ls -l /usr/local/bin/appcheck.sh"?
>
> Glad to thanks!
>
> root@STAGING-mycomp-centos-5:/root>date
> Sun May 6 21:38:03 CDT 2012
> root@STAGING-mycomp-centos-5:/root>ls -l /usr/local/bin/appcheck.sh
> ls: invalid option --
> Try `ls --help' for more information.
> root@STAGING-mycomp-centos-5:/root>
> root@STAGING-mycomp-centos-5:/root>date
> Sun May 6 21:38:31 CDT 2012
> root@STAGING-mycomp-centos-5:/root>ls -l /usr/local/bin/appcheck.sh
> -rwxr-xr-x 1 root root 915 May 4 18:05 /usr/local/bin/appcheck.sh
> root@STAGING-mycomp-centos-5:/root>monit -v
> monit: Debug: Adding host allow 'localhost'
> monit: Debug: Skipping redundant host 'localhost'
> monit: Debug: Skipping redundant host 'localhost'
> monit: Debug: Adding credentials for user 'mycomp'.
> Runtime constants:
> Control file = /etc/monitrc
> Log file = /var/log/monit.log
> Pid file = /var/run/monit.pid
> Debug = True
> Log = True
> Use syslog = False
> Is Daemon = True
> Use process engine = True
> Poll time = 120 seconds with start delay 0 seconds
> Expect buffer = 256 bytes
> Event queue = base directory /var/monit/queue with 5000 slots
> Mail server(s) = smtp.gmail.com:465(ssl) with timeout 30 seconds
> Mail from = (not defined)
> Mail subject = (not defined)
> Mail message = (not defined)
> Start monit httpd = True
> httpd bind address = localhost
> httpd portnumber = 2812
> httpd signature = True
> Use ssl encryption = False
> httpd auth. style = Basic Authentication and Host/Net allow list
> Alert mail to = [email protected]
> Alert on = All events
> Alert mail to = [email protected]
> Alert on = All events
> Alert mail to = [email protected]
> Alert on = All events
>
> The service list contains the following entries:
>
> System Name = localhost
> Monitoring mode = active
> CPU system limit = if greater than 80.0% 3 times within 3
> cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then
> alert
> CPU user limit = if greater than 80.0% 3 times within 3
> cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then
> alert
> Memory usage limit = if greater than 85.0% 1 times within 1
> cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then
> alert
>
> Filesystem Name = rootfs
> Path = /
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Filesystem flags = if changed 1 times within 1 cycle(s) then alert
> Space usage limit = if greater than 80.0% 1 times within 1
> cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then
> alert
>
> Process Name = sshd
> Pid file = /var/run/sshd.pid
> Monitoring mode = active
> Start program = '/etc/init.d/sshd start' timeout 30 second(s)
> Stop program = '/etc/init.d/sshd stop' timeout 30 second(s)
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Pid = if changed 1 times within 1 cycle(s) then alert
> Ppid = if changed 1 times within 1 cycle(s) then alert
> Port = if failed [localhost:22 [SSH via TCP] with
> timeout 5 seconds and retry 0 time(s)] 1 times within 1 cycle(s) then
> restart else if succeeded 1 times within 1 cycle(s) then alert
> Timeout = If restarted 5 times within 5 cycle(s) then unmonitor
>
> Process Name = mysql
> Group = myapp
> Pid file = /var/run/mysqld/mysqld.pid
> Monitoring mode = active
> Start program = '/etc/init.d/mysqld start' timeout 30 second(s)
> Stop program = '/etc/init.d/mysqld stop' timeout 30 second(s)
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Pid = if changed 1 times within 1 cycle(s) then alert
> Ppid = if changed 1 times within 1 cycle(s) then alert
> Port = if failed [127.0.0.1:3306 [MYSQL via TCP] with
> timeout 5 seconds and retry 0 time(s)] 1 times within 1 cycle(s) then
> restart else if succeeded 1 times within 1 cycle(s) then alert
> Timeout = If restarted 5 times within 5 cycle(s) then unmonitor
>
> Process Name = tomcat
> Group = myapp
> Pid file = /var/run/tomcat.pid
> Monitoring mode = active
> Start program = '/etc/init.d/tomcat start' timeout 30 second(s)
> Stop program = '/etc/init.d/tomcat stop' timeout 30 second(s)
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Depends on Service = mysql
> Pid = if changed 1 times within 1 cycle(s) then alert
> Ppid = if changed 1 times within 1 cycle(s) then alert
> Port = if failed [localhost:8080 [DEFAULT via TCP]
> with timeout 5 seconds and retry 0 time(s)] 5 times within 5 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Port = if failed [localhost:8080 [DEFAULT via TCP]
> with timeout 5 seconds and retry 0 time(s)] 1 times within 1 cycle(s)
> then alert else if succeeded 1 times within 1 cycle(s) then alert
>
> File Name = mysqld.log
> Path = /var/log/mysqld.log
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Size = if greater than 5242900 byte(s) 1 times within
> 1 cycle(s) then exec '/usr/sbin/logrotate /etc/logrotate.conf' timeout
> 0 cycle(s) else if succeeded 1 times within 1 cycle(s) then alert
>
> File Name = catalina.out
> Path = /usr/share/apache-tomcat-6.0.32/logs/catalina.out
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Size = if greater than 5242900 byte(s) 1 times within
> 1 cycle(s) then exec '/usr/sbin/logrotate /etc/logrotate.conf' timeout
> 0 cycle(s) else if succeeded 1 times within 1 cycle(s) then alert
>
> File Name = monit.log
> Path = /var/log/monit.log
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Size = if greater than 5242900 byte(s) 1 times within
> 1 cycle(s) then exec '/usr/sbin/logrotate /etc/logrotate.conf' timeout
> 0 cycle(s) else if succeeded 1 times within 1 cycle(s) then alert
>
> Remote Host Name = MYPROD-PROD-ICMP-PING
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then unmonitor else if succeeded 1 times within 1 cycle(s) then alert
> ICMP = if failed [Echo Request count 5 with timeout
> 15 seconds] 1 times within 1 cycle(s) then alert else if succeeded 1
> times within 1 cycle(s) then alert
>
> Remote Host Name = MYPROD-STAGING-ICMP-PING
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then unmonitor else if succeeded 1 times within 1 cycle(s) then alert
> ICMP = if failed [Echo Request count 5 with timeout
> 15 seconds] 1 times within 1 cycle(s) then alert else if succeeded 1
> times within 1 cycle(s) then alert
>
> Remote Host Name = MYPROD-QA-ICMP-PING
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then unmonitor else if succeeded 1 times within 1 cycle(s) then alert
> ICMP = if failed [Echo Request count 5 with timeout
> 15 seconds] 1 times within 1 cycle(s) then alert else if succeeded 1
> times within 1 cycle(s) then alert
>
> Remote Host Name = MYPROD-DEMO-ICMP-PING
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then unmonitor else if succeeded 1 times within 1 cycle(s) then alert
> ICMP = if failed [Echo Request count 5 with timeout
> 15 seconds] 1 times within 1 cycle(s) then alert else if succeeded 1
> times within 1 cycle(s) then alert
>
> Remote Host Name = MYPROD-CONFERENCE-ICMP-PING
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then unmonitor else if succeeded 1 times within 1 cycle(s) then alert
> ICMP = if failed [Echo Request count 5 with timeout
> 15 seconds] 1 times within 1 cycle(s) then alert else if succeeded 1
> times within 1 cycle(s) then alert
>
> Program Name = MYPROD_PROD_Web_Application
> Path = /usr/local/bin/appcheck.sh
> Monitoring mode = active
> Existence = if does not exist 1 times within 1 cycle(s)
> then restart else if succeeded 1 times within 1 cycle(s) then alert
> Status = if 'MYPROD_PROD_Web_Application' exit value !=
> 0 within 600 seconds then alert else if succeeded 1 times within 1
> cycle(s) then alert
>
> -------------------------------------------------------------------------------
> monit daemon at 526 awakened
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general