You have to subscribe to sentinel messages on one of their pubsub channels. You can see at the link that you posted that the sentinel will publish out messages like
+odown <instance details> -- The specified instance is now in Objectively Down state.
-odown <instance details> -- The specified instance is no longer in Objectively Down state.
+failover-takedown <instance details> -- 25% of the configured failover timeout has elapsed, but this sentinel can't see any progress, and is the new leader. It starts to act as the new leader reconfiguring the remaining slaves to replicate with the new master.
+failover-triggered <instance details> -- We are starting a new failover as a the leader sentinel.
So when you see a sentinel publish on one of those channels, you need to parse the message and have your client respond accordingly. Redis is not smart - you have to handle these things using a client library.
Specifically, the most useful channels are
+odown
+failover-detected
+switch-master
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…