Monitoring script for postgresql