How to monitor WAN link

how to monitor WAN link down time and log per month?