pg_isready is utility to check whether postgres is running or not
-bash-4.2$ ./pg_isready /tmp:5432 - accepting connections
can write shell which will check and give alert if database down
vi alert.sh
while true; do if ! /opt/PostgreSQL/9.4/bin/pg_isready &>/dev/null; then echo 'database down'; fi; sleep 3; done;