You should probably look at check_postgres and check_pgactivity. Their source code contain numerous SQL queries, that could help you write your own.
Regards.
Thank you very much. I am a bit new to postgres here. Can you please guide me , where exactly I can get the source code for check_postgres and check_pgactivity?