Difference between revisions of "SUNScholar/Optimisations/Monit service"

From Libopedia
Jump to navigation Jump to search
(Created page with "<center> '''Back to Optimisations''' </center> In case the Tomcat service halts or hangs due to whatever... , I installed monit to restart the s...")
 
m
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
  '''[[SUNScholar/Optimisations|Back to Optimisations]]'''
 
  '''[[SUNScholar/Optimisations|Back to Optimisations]]'''
 
</center>
 
</center>
 +
''This is optional''
  
 
In case the Tomcat service halts or hangs due to whatever... , I installed monit to restart the service and then alert me. See an example of my config below, added to the bottom of the '''/etc/monit/monitrc''' file.
 
In case the Tomcat service halts or hangs due to whatever... , I installed monit to restart the service and then alert me. See an example of my config below, added to the bottom of the '''/etc/monit/monitrc''' file.
Line 9: Line 10:
 
set logfile syslog facility log_daemon
 
set logfile syslog facility log_daemon
 
set mailserver localhost
 
set mailserver localhost
set mail-format { from: monit@ez.sun.ac.za }
+
set mail-format { from: monit@scholar.sun.ac.za }
 
set alert root@localhost
 
set alert root@localhost
 
set httpd port 2812
 
set httpd port 2812
Line 28: Line 29:
 
</pre>
 
</pre>
 
All confidential information has been replaced with % signs or captial X's.
 
All confidential information has been replaced with % signs or captial X's.
 +
[[Category:System Administration]]
 +
[[Category:Optimisations]]

Latest revision as of 11:57, 28 May 2016

Back to Optimisations

This is optional

In case the Tomcat service halts or hangs due to whatever... , I installed monit to restart the service and then alert me. See an example of my config below, added to the bottom of the /etc/monit/monitrc file.

dspace@ir1:/etc/monit$ sudo cat /etc/monit/monitrc
set daemon  60
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: monit@scholar.sun.ac.za }
set alert root@localhost
set httpd port 2812
     allow %username%:%password%

check process sshd with pidfile /var/run/sshd.pid
   start = "/usr/sbin/service ssh start"
   stop  = "/usr/sbin/service ssh stop"
   if failed port 22 protocol ssh with timeout 5 seconds then restart
   alert hgibson@sun.ac.za

check process tomcat6 with pidfile /var/run/tomcat6.pid
   start = "/usr/sbin/service tomcat6 restart"
   stop  = "/usr/sbin/service tomcat6 stop"
   if failed port 80 protocol http with timeout 300 seconds then restart
   alert hgibson@sun.ac.za
   alert wklap@sun.ac.za

All confidential information has been replaced with % signs or captial X's.