We have socket listener which listens on port 9000 so below is how we wrote the alert for monit. The listener runs via yajsw daemon tool. So currently when it fails on port 9000 we get an email. What we want to extend is that if it is not running to stop,uninstall, install and finally start programe. We have all the script to the processes stated but how to put in monit? All of it are in shell script files.
check process cs9000 with pidfile /var/run/wrappercs9000.pid # check your app pid
start program =
stop program =
if failed port 9000 # if you want to check your app that listen on port 9000
then
restart