script: check and reconnect pppoe-session.

Check locked PPPOE, PPTP, L2TP, SSTP, OVPN* PPP* connections (on Server side)
http://forum.mikrotik.com/t/check-locked-pppoe-pptp-l2tp-sstp-ovpn-ppp-connections/75396/1

Hint: when you can, use simplicity and not use external service (8.8.8.8 for example) for check if YOUR network are working…

What’s happen if google change dns ip address or shut down the service for maintenance?
Think about that…
Some users use google dns also for check routes against multiple providers…

Adapted version of my script for multiple pppoe-client check:

:log info message="*** start the check off all pppoe-client connection ***";
:local pppTest value=[/interface pppoe-client find where running=yes];
:local pingNumber value=2;
:local pingMin value=1;
:local toAddress value="";
:foreach userTest in=$pppTest do={
 /interface pppoe-client monitor $userTest once do={ :set toAddress value=$"remote-address" };
 :local pingOk value=[:ping $toAddress count=$pingNumber];
 :if ($pingOk < $pingMin) do={
  :log warning message=([/interface pppoe-client get $userTest value-name=name]." unlocked: ".$pingOk." ping ok over ".$pingNumber." to ".$toAddress);
  /interface pppoe-client disable $userTest;
  /delay delay-time=5;
  /interface pppoe-client enable $userTest;
 }
};
:log info message="*** stop the check of all pppoe-client connection ***";