Network connectivity Pre checks

Hello All,
We are running multiple codes in prod all having different sources of databases in other servers. Many times due to network issue connectivity and DB issue the jobs got failed and to recover them become very brainstorming . I planning to create one script that can pre check if all the networks are up and running also if DB is good to connect with existing user name and password only then the dependent jobs should run.
I don't have any knowledge on network side. Please suggest me if anyone have done the same thing ever. What are the details i need.

For eg is it good to check network by ping command.I will introduce all such steps in script.