Hi @venkata_reddy,
This seems like a possible duplicate of your other question: Health script from Ops manager - #2 by Stennie_X.
You could certainly write a script to connect to your deployment, although it would be more typical to configure alerts based on conditions of interest or concern using MongoDB Cloud/Ops Manager or a similar management platform.
What status are you looking to check, and what type of deployment do you have (standalone, replica set, or sharded cluster)?
Regards,
Stennie