I am trying to use monit on my postgres. My monit configuration file is
check process postgresql with pidfile /var/lib/postgresql/9.3/main/postmaster.pid
start program = "/etc/init.d/postgresql start"
stop program = "/etc/init.d/postgresql stop"
if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then restart
if failed host localhost port 5432 protocol pgsql then restart
if 5 restarts within 5 cycles then timeout`
When i run cat /var/lib/postgresql/9.3/main/postmaster.pid
. The result is
10271
/var/lib/postgresql/9.3/main
1418738148
5432
/var/run/postgresql
localhost
5432001 720899
But my monit would not restart the postgres. I am referring to http://mmonit.com/wiki/Monit/ConfigurationExamples#postgresql.
Can anyone tell me what i am doing wrong?