Community discussions

MikroTik App
 
alisc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Thu Dec 01, 2011 10:51 am

Counter Request time oute

Tue Apr 05, 2016 9:33 pm

hi everybody ,
I'm not English
my english not so good , excuse me


i have a question :

i found this script in Web
i want customized this

plaese help me

goal : IF ping 4.2.2.4 and time out count is 10 then , SMS Send ! ( Down )

the when 4.2.2.4 is Replay , then SMS Send ( UP )


is now , the when 4.2.2.4 is 2-3 count time out , SMS sending !


my script is :
:local result [/ping 4.2.2.4 src-address=192.168.1.1 count=9]
:global status
:if ($result = 10 && $status != true) do={
/tool sms send "usb4" "+100000000" message="Internet - UP"
/tool sms send "usb4" "+100000000" message="Internet - UP"
  :set status true
} else={
  :if ($result = 0 && $status != false) do={
/tool sms send "usb4" "+100000000" message="Internet - Down"
/tool sms send "usb4" "+100000000" message="Internet - Down"
    :set status false
  }
}
help me :)
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12004
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Counter Request time oute

Wed Apr 06, 2016 3:14 am

hi everybody ,
I'm not English
my english not so good , excuse me


i have a question :

i found this script in Web
i want customized this

plaese help me

goal : IF ping 4.2.2.4 and time out count is 10 then , SMS Send ! ( Down )

the when 4.2.2.4 is Replay , then SMS Send ( UP )


is now , the when 4.2.2.4 is 2-3 count time out , SMS sending !


my script is :
:local result [/ping 4.2.2.4 src-address=192.168.1.1 count=9]
:global status
:if ($result = 10 && $status != true) do={
/tool sms send "usb4" "+100000000" message="Internet - UP"
/tool sms send "usb4" "+100000000" message="Internet - UP"
  :set status true
} else={
  :if ($result = 0 && $status != false) do={
/tool sms send "usb4" "+100000000" message="Internet - Down"
/tool sms send "usb4" "+100000000" message="Internet - Down"
    :set status false
  }
}
help me :)
If I understand correctly:

First of all, on RouterBoard set this schedule to start 1 minute after Startup:
:global try value=10;
:global lastsms value="DOWN";
Then schedule this:
:local result value=[/ping interval=1s address=4.2.2.4 src-address=192.168.1.1 count=$try];

:if ($result>=$try and $lastsms!="UP") do={
 /tool sms send port=usb4 phone-number="+100000000" message="Internet - UP";
 :set lastsms value="UP";
 :set try value=4;
};

:if ($result<$try and $lastsms!="DOWN") do={
 /tool sms send port=usb4 phone-number="+100000000" message="Internet - DOWN";
 :set lastsms value="DOWN";
};

Who is online

Users browsing this forum: No registered users and 32 guests