Skip to content

Instantly share code, notes, and snippets.

@fvanderbiest
Last active August 30, 2017 15:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fvanderbiest/af59a8431af5e3f751e0 to your computer and use it in GitHub Desktop.
Save fvanderbiest/af59a8431af5e3f751e0 to your computer and use it in GitHub Desktop.
monit georchestra
# /etc/default/monit
# You must set this variable to yes for monit to start
START=yes
# Options to pass to monit
#MONIT_OPTS=
#/etc/monit/monitrc
set daemon 60
set logfile /var/log/monit.log
set mailserver localhost port 25
set mail-format {
from: monit@$HOST
subject: monit alert -- $EVENT $SERVICE
message: $EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
Description: $DESCRIPTION
}
set alert user@email.com but not on { instance, pid, ppid }
set httpd port 2812 and
use address localhost
allow localhost
include /etc/monit/conf.enabled/*
# /etc/monit/conf.enabled/tomcat
# tomcat-01
check process tomcat-01 with pidfile /var/lib/georchestra/tomcat-01/logs/catalina.pid
group tomcat
start program = "/var/lib/georchestra/tomcat-01/init start"
with uid root gid root
stop program = "/var/lib/georchestra/tomcat-01/init hardkill"
with uid root gid root
if failed host 127.0.0.1 port 8180 for 3 cycles then restart
if memory is greater than 6 GB then restart
if cpu usage > 100% for 10 cycles then restart
# restart security proxy if header is wrong
if failed (url http://127.0.0.1:8180/cas/login
and content = "html")
for 3 cycles
then restart
# tomcat-02
check process tomcat-02 with pidfile /var/lib/georchestra/tomcat-02/logs/catalina.pid
group tomcat
start program = "/var/lib/georchestra/tomcat-02/init start"
with uid root gid root
stop program = "/var/lib/georchestra/tomcat-02/init hardkill"
with uid root gid root
if failed host 127.0.0.1 port 8280 for 3 cycles then restart
if memory is greater than 6 GB then restart
if cpu usage > 100% for 10 cycles then restart
# restart geonetwork if getrecords fails
if failed (url http://127.0.0.1:8280/geonetwork/srv/eng/csw?service=CSW&version=2.0.2&request=GetRecords&constraintlanguage=CQL_TEXT
and content = "SearchResults")
for 3 cycles
then restart
# tomcat-03 (geoserver)
check process tomcat-03 with pidfile /var/lib/georchestra/tomcat-03/logs/catalina.pid
group tomcat
start program = "/var/lib/georchestra/tomcat-03/init start"
with uid root gid root
stop program = "/var/lib/georchestra/tomcat-03/init hardkill"
with uid root gid root
if failed host 127.0.0.1 port 8380 for 3 cycles then restart
if memory is greater than 6 GB then restart
if cpu usage > 100% for 10 cycles then restart
# restart geoserver if capabilities are wrong
if failed (url http://127.0.0.1:8380/geoserver/geor/wms?SERVICE=WMS&REQUEST=GetCapabilities
and content = "WMS_Capabilities")
for 3 cycles
then restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment