mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-07-01 05:34:29 +02:00
initial commit
This commit is contained in:
commit
c782dde326
61 changed files with 1457 additions and 0 deletions
29
scripts/ch10-02-bad-script.rsc
Normal file
29
scripts/ch10-02-bad-script.rsc
Normal file
|
@ -0,0 +1,29 @@
|
|||
# filename: ch10-02-bad-script.rsc
|
||||
#
|
||||
# A simple script to perform a series of tests on a
|
||||
# list of web sites.
|
||||
|
||||
# define list of websites to test
|
||||
:local w {"mikrotik.com"; "www.google.com"; "twitter.com"};
|
||||
|
||||
# step through each website and perform various tests
|
||||
:foreach s in=$w do={
|
||||
|
||||
# try a DNS resolution of this site
|
||||
:local i [/resolve $s];
|
||||
|
||||
# try pinging the IP address of this site
|
||||
:local p [/ping $i count=3 ];
|
||||
|
||||
# try fetching the web page of this site
|
||||
:local u [/tool fetch url=("https://$s") mode=https http-method=get \
|
||||
as-value keep-result=no];
|
||||
|
||||
# print out a summary report for this site
|
||||
:put "==========================================";
|
||||
:put ("Site: $s");
|
||||
:put ("IP Address = $i");
|
||||
:put ("Ping success = $p/3");
|
||||
:put ("Page d/load duration: " . $u->"duration");
|
||||
:put "===========================================";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue