Load balancing with HAProxy


we have two physical devices which has to be working active and standbye mode.
I am able to check both of the devices the through below links: - active - standby
And there is a third machine (linux), it should handle the traffic with HAProxy
If the first link is not available, then HAProxy needs to route the traffic to the second one.

Is there any solution to solve it?