#
# monitoring centralproxy
#

# Check service
check process centralproxy with pidfile /opt/bertin/centralproxy/var/run/centralproxy.pid
	start program = "/usr/sbin/service centralproxy start" with timeout 20 seconds
	stop program = "/usr/sbin/service centralproxy stop"
	if NOT EXIST for 2 times within 5 cycles
		then exec "/opt/bertin/mediacentric/bin/monit_alert.sh centralproxy KO"
	else if SUCCEEDED
		then exec "/opt/bertin/mediacentric/bin/monit_alert.sh centralproxy OK"

# Check pattern in logs
check file centralproxy_log with path /opt/bertin/centralproxy/logs/centralproxy.log
	if match "java.lang.OutOfMemoryError" then exec "/opt/bertin/mediacentric/bin/monit_alert_logs.sh centralproxy OutOfMemory" repeat every 1 cycle
	if match "Too many open files" then exec "/opt/bertin/mediacentric/bin/monit_alert_logs.sh centralproxy TooManyOpenFiles" repeat every 1 cycle
