Got a problem with my ISP and my connection (optical fiber, 1000/100 Mbit).
My internet access breaks down almost every evening.. The connection can be lost for some minutes up to an hour..
The big problem is that the ISP is a lazy a-hole..

They blame my equipment, although all of my neighbors have the same problem.
So I want to write a script to generate an automatic fault complain to my ISP:s email. (Will mail myself and do a manual forward to ISP later.)
This is what I have in mind..
2 Scripts, one when the connection breaks down (identifyed by pinging 8.8.8.8 by netwatch) that collects some information, and the other one when the line is restored..
Script_DOWN!
Check WAN_IP
Check WAN_DEFGATEWAY
Check TIME_DOWN
PING WAN_DEFGATEWAY
Script_UP!
Check Router_up_time
If Router_up_time <60 min (To prevent false mail if router restarted recently)
Check TIME_UP
Calculate TOTAL_TIME=TIME_UP - TIME_DOWN
IF TOTAL_TIME <10 min (To prevent mail in case of short disruptions)
Create Email to "support@isp.org" (or my own mail for manual forward);
Print "Fault complaint to ISP"
Print "My IP adress; WAN_IP
Print "My MAC address"; XX:XX:XX:XX:XX:XX (They always want to know it, I don´t know why..)
Print "My def gateway; WAN_DEFGATEWAY
Print "Def gateway answer on ping" ; Yes/No (Good to know!, sorts out local problems.)
Print "Down Time"; TIME_DOWN
Print "Up Time"; TIME_UP
Print "Total downtime"; TOTAL_TIME
Send Mail;
EndIf
EndIf
END
Is this even possible?