Hi Martin,
I'm starting to think it may not be specific to monit but something
in my environment.
I do have
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
this may be overkill but it still doesn't work.
I added a logger command to log something to syslog in my script just
after the PATH statement which is effectively the first thing my
script does and nothing gets logged to syslog.
The command I run is => /usr/bin/logger -i -p local0.info $0 $1
To me this statement should always run no matter what parameter is
passed to the script but I get nothing when monit.d/jira has
/etc/init.d/jira start. It's almost like it's not even running the
command. All i get is the following:
Aug 14 09:59:49 revolt monit[4407]: 'Jira' process is not running
Aug 14 09:59:49 revolt monit[4407]: 'Jira' trying to restart
Aug 14 09:59:49 revolt monit[4407]: 'Jira' start: /etc/init.d/jira
Aug 14 09:59:50 revolt monit[4407]: 'Jira' failed to start
But ... when I use /etc/init.d/jira-start it works and syslog has the
following
Aug 14 10:00:05 revolt monit[4458]: 'Jira' process is not running
Aug 14 10:00:05 revolt monit[4458]: 'Jira' trying to restart
Aug 14 10:00:05 revolt monit[4458]: 'Jira' start: /etc/init.d/jira-start
Aug 14 10:00:05 revolt jira[4474]: /etc/init.d/jira start
Aug 14 10:00:05 revolt jira[4493]: Started Tomcat server...
Aug 14 10:02:05 revolt monit[4458]: Monit has not changed
Aug 14 10:02:05 revolt monit[4458]: 'Jira' process is running with
pid 4492
So I'm a bit confused here.
Cheers
Steve
Martin Pala wrote:
This is most probably caused by missing environment variable. Monit
sets spartan environment/sandbox when starting services.
Here is FAQ item regarding short description from FAQ
(http://www.tildeslash.com/monit/doc/faq.php):
--8<--
6. Q: I'm having trouble getting monit to execute any "start" or
"stop" program commands. The log file says that they're being
executed, and I can't find anything wrong when I run monit in
verbose mode.
A: Monit did start the program but for some reason the service dies
later. Before we go on and introduce you to the fine art of
system debugging, it's worth to note that:
For security reasons monit purges the environment and only set a
spartan PATH variable that contains /bin, /usr/bin, /sbin and
/usr/sbin. If your program or script dies, the reason could be
that it expects certain environment variables or to find certain
programs via the PATH. If this is the case you should set the
environment variables you need directly in the start or stop
script called by monit.
--8<--
It's possible that your scripts need some environment variable which
is missing ... simply add everything what is needed to your scripts.
Martin
Stephen Adams wrote:
Hi,
I'm trying to get an application called JIRA to be monitored by monit.
I've created a /etc/init.d/jira script and also created a
/etc/monit.d/jira file which I've shown below
check process jira with pidfile /var/run/jira/jira.pid
group tomcat
start program "/etc/init.d/jira-start"
#start program "/etc/init.d/jira start"
stop program "/etc/init.d/jira-stop"
#stop program "/etc/init.d/jira stop"
if failed host 127.0.0.1 port 8085 protocol http
and request "/jira/"
then restart
if 5 restarts within 5 cycles then timeout
The problem I have is I can't get monit to successfully restart
JIRA if I use the command "/etc/init.d/jira start"
but if I write a script called /etc/init.d/jira-start
#!/bin/bash
/etc/init.d/jira start
and use that inside monit it works?!?
It's almost as if monit is truncating my start program directive
when it hits the first space.
Does anyone have any ideas here?
Cheers
Steve
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general