Monitoring a remote connection

I would like to monitor a remote connection in order to provide a ‘flag’ to tel me when the connection has failed.

it could be a dynamic address or a VPN
it could be a specific item of equipment with mac address or just a port that is monitored

Can anybody give me any pointers as to how to get started.

TCP sensor maybe?