berikut adalah contoh script agar per 5 menit sekali mikrotik melakukan ping ke proxy (dalam contoh ini proxy server menggunakan ip = 1.2.3.4) jika ip 1.2.3.4 tidak bisa diping maka script "check_proxy" akan mendisable semua redirect ke ip 1.2.3.4
# mar/01/2009 17:27:17 by RouterOS 3.13
# software id = 9CS2-87N
#
/system script
add name=check_proxy policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff source=":if ( [/pi\
ng 1.2.3.4 count=1]=1) do={\r\
\n:log info \"Proxy Up\";\r\
\n:foreach i in=[/ip firewall nat find action=\"dst-nat\" to-addresses=\"1\
.2.3.4\"] do={/ip firewall nat set \$i disable=no};\r\
\n} else={\r\
\n:log info \"Proxy Down\";\r\
\n:foreach i in=[/ip firewall nat find action=\"dst-nat\" to-addresses=\"1\
.2.3.4\"] do={/ip firewall nat set \$i disable=yes};\r\
\n/tool e-mail send to=\"support@domain.anda\" subject=([/system ide\
ntity get name] . \" Proxy Down \" . [/system clock get date]) body=\"Prox\
y Redirect Disable\";\
\n\
\n\
\n\
\n\
\n\
\n\
\n\
\n\r\
\n}"
# mar/01/2009 17:30:30 by RouterOS 3.13
# software id = 9CS2-87N
#
/system scheduler
add comment="" disabled=no interval=5m name=sched_check_proxy on-event=\
check_proxy start-date=jan/01/1970 start-time=00:00:00
1 komentar:
bos thx bngt, saya udah muter" ke forum" baru dpt nih scrip ini... akhirnya masalah terselesaikan
Posting Komentar