You cannot ping a database, you can ping a server. You can connect to a database.
There are many strategies used to determine when to failover and issue the HADR takeover command, and some people just do it manually. The included TSA software will perform this function, but is a a little complex.
My company uses Red Hat Cluster manager to detect server problems, along with some scripts to detect when a database is not available. We also use a virtual IP instead of automatic client re-route, which is a little safer in ensuring that a split-brain situation never occurs.
There is a DB2 High Availability manual you get in PDF format that discusses these issues.