Hi,

 

I have setup monit with check_program. I am running monit on local server
and monit check the program at regular intervel. it is stopping the tomcat
server if  thread count is more than my threshold but not starting the
tomcat server back.  Getting below log in monit.log. Please suggest what I
am missing here.

 

[UTC Jul 31 08:14:59] error    : 'ThreadCount' '/data/scripts/jmx.sh' failed
with exit status (35) -- no output from program

[UTC Jul 31 08:14:59] info     : 'ThreadCount' trying to restart

[UTC Jul 31 08:14:59] info     : 'ThreadCount' stop:
/opt/tomcat-9620/bin/shutdown.sh

[UTC Jul 31 08:14:59] info     : 'ThreadCount' start:
/opt/tomcat-9620/bin/startup.sh

 

Monit configuration:

 

check program ThreadCount with path "/data/scripts/jmx.sh"

start program = "/opt/tomcat/bin/startup.sh"

stop program = "/opt/tomcat/bin/shutdown.sh"

if status > 35 then restart

 

 

jmx.sh

 

#!/bin/bash

TC=`/usr/local/nagios/libexec/check_jmx -U
service:jmx:rmi:///jndi/rmi://localhost:9652/jmxrmi -O
java.lang:type=Threading -A ThreadCount | cut -d '=' -f2 | cut -d '|' -f1`

if [ $TC -gt 35 ]

then

exit $TC

else

exit $TC

fi

 

Thanks

Gokul

 

 

From: [email protected]
[mailto:[email protected]] On Behalf
Of Hearns, John
Sent: Friday, May 23, 2014 7:25 PM
To: This is the general mailing list for monit
Subject: RE: Monit remote servers custom process

 



Hi,

I am planning to use monit for below purpose. Can I achieve below cases by
using monit? I installed monit and trying to find the right configuration.
But I am unable to get the configuration for remote server monitor.  

Monitor remote server custom process without pid file from monit server.
Restart remote server custom process from monit server based on
error/exception. 
Alert remote server custom process if it is down.


Yes, you can do this.

Use a 'check program'


check program remote-service with path "/usr/local/bin/remote-service"


The script in /usr/local/bin will ssh into the remote system and perform the
checks you want,
Perhaps by running the 'pgrep' command.
If the script sees that the remote service is OK 
exit0

If the remote service is down
exit 1


The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you are not the intended recipient you should not
read, copy, retransmit or disclose its contents. If you have received this
email in error please delete it from your system immediately and notify us
either by email or telephone. The views expressed in this communication may
not necessarily be the views held by McLaren Racing Limited. 
McLaren Racing Limited | McLaren Technology Centre | Chertsey Road | Woking
| Surrey | GU21 4YH | UK | Company Number: 01517478 

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

Reply via email to