Page 1 of 1

Ping in script problem

Posted: Thu Jun 17, 2010 10:50 pm
by PietRetief
I recently loaded a script on a routerboard running ROS 5.0 beta3 and the output is not what I expected.

The following is an extract of the scrip to illustrate the problem:
:local otherside 172.18.254.134;
:local latency [ping $otherside interval=20ms count=100];
:log info ("Ping timeouts ".(100 - $latency));
On a rb running ros 3.30 it works perfectly, yet on the new rb running ros 5.0 b3 it does not. I double checked by running the ping in winbox, and it is correct. The log output should contain the amount of pings that timed out, yet it prints 100 (meaning the result of the ping command was 0). Please see attached images.

Did the syntax or usage of the ping command change?

Regards,
Pieter.

Re: Ping in script problem

Posted: Fri Jun 18, 2010 5:05 pm
by Chupaka
What's new in 5.0beta3 (2010-Jun-17 13:46):

*) console - output of '/ping' and '/tool traceroute' commands is more
    in line with the rest of the console commands;
try
ping $otherside interval=20ms count=100
in Terminal and see the result

Re: Ping in script problem

Posted: Fri Jun 18, 2010 7:07 pm
by PietRetief
Hi Chupaka, thanks for the reply. I see the two outputs differ. Now the question is, how do I get the original result as this new method breaks my current scripts :lol:

Re: Ping in script problem

Posted: Fri Jun 18, 2010 7:40 pm
by Chupaka
unfortunately, I have not installed beta3 yet, so I can't see actual output, and you don't want to post it =)

Re: Ping in script problem

Posted: Fri Jun 18, 2010 7:53 pm
by PietRetief
Hi, sorry, I did not realise you do not have beta3 available.

Here is the output from beta3:
[admin@rb433ah] > ping 172.18.254.134 interval=500ms  count=10      
HOST                                    SIZE  TTL TIME  STATUS                 
172.18.254.134                          56    64  241ms
172.18.254.134                          56    64  220ms
172.18.254.134                          56    64  280ms
172.18.254.134                          56    64  330ms
172.18.254.134                          56    64  228ms
172.18.254.134                          56    64  310ms
172.18.254.134                          56    64  276ms
172.18.254.134                          56    64  191ms
172.18.254.134                          56    64  243ms
172.18.254.134                          56    64  310ms
    sent=10 received=10 packet-loss=0% min-rtt=191ms avg-rtt=262ms 
   max-rtt=330ms 
HOST                                    SIZE  TTL TIME  STATUS                 

and this is from Ros3.30:
[admin@rb433] > ping 172.18.18.254 interval=20ms count=10         
172.18.18.254 64 byte ping: ttl=64 time=5 ms
172.18.18.254 ping timeout
172.18.18.254 ping timeout
172.18.18.254 64 byte ping: ttl=64 time=3 ms
172.18.18.254 64 byte ping: ttl=64 time=11 ms
172.18.18.254 64 byte ping: ttl=64 time=3 ms
172.18.18.254 64 byte ping: ttl=64 time=14 ms
172.18.18.254 64 byte ping: ttl=64 time=4 ms
172.18.18.254 64 byte ping: ttl=64 time=5 ms
172.18.18.254 64 byte ping: ttl=64 time=4 ms
10 packets transmitted, 8 packets received, 20% packet loss
round-trip min/avg/max = 3/6.1/14 ms

Here is the output for a :put command:
Ros5.0beta3
[admin@rb433ah] > :put [ping 172.18.254.134 interval=500ms  count=10
]
HOST                                    SIZE  TTL TIME  STATUS                 
172.18.254.134                          56    64  371ms
172.18.254.134                          56    64  411ms
172.18.254.134                          56    64  207ms
172.18.254.134                          56    64  127ms
172.18.254.134                          56    64  221ms
172.18.254.134                          56    64  220ms
172.18.254.134                          56    64  147ms
172.18.254.134                          56    64  401ms
172.18.254.134                          56    64  227ms
172.18.254.134                          56    64  267ms
    sent=10 received=10 packet-loss=0% min-rtt=127ms avg-rtt=259ms 
   max-rtt=411ms 
HOST                                    SIZE  TTL TIME  STATUS                 


Ros3.30
[admin@rb433] > :put [ping 172.18.18.254 interval=20ms count=10]
172.18.18.254 64 byte ping: ttl=64 time=3 ms
172.18.18.254 64 byte ping: ttl=64 time=6 ms
172.18.18.254 64 byte ping: ttl=64 time=12 ms
172.18.18.254 64 byte ping: ttl=64 time=6 ms
172.18.18.254 64 byte ping: ttl=64 time=4 ms
172.18.18.254 64 byte ping: ttl=64 time=4 ms
172.18.18.254 64 byte ping: ttl=64 time=2 ms
172.18.18.254 64 byte ping: ttl=64 time=12 ms
172.18.18.254 ping timeout
172.18.18.254 64 byte ping: ttl=64 time=5 ms
10 packets transmitted, 9 packets received, 10% packet loss
round-trip min/avg/max = 2/6.0/12 ms
9
Looks like the last line on ros3.30 contains the variable number I am looking for, but for beta3 it is a blank line. Any ideas? My Mikrotik scripting is very... basic :D

Re: Ping in script problem

Posted: Fri Jun 18, 2010 9:10 pm
by Chupaka
hmmm... I can't find a way to get the result of ping command in beta3... sounds like a lack of feature =) because "sent=10 received=10 packet-loss=0% <...>" seems like API output, but you cannot get it via CLI :( will wait for beta4 =)

Re: Ping in script problem

Posted: Fri Jun 18, 2010 9:18 pm
by PietRetief
Thanks for the help Chupaka.

Re: Ping in script problem

Posted: Fri Jun 25, 2010 10:10 pm
by PietRetief
Can anyone from the Mikrotik staff please confirm if this problem will be addressed in beta4?

Or if there is a way to get this script to work on beta3?

Thanks :D

Re: Ping in script problem

Posted: Fri Jun 25, 2010 10:24 pm
by Chupaka
please write to support@ to be sure =)

Re: Ping in script problem

Posted: Fri Jun 25, 2010 10:28 pm
by PietRetief
I did :)

Sadly no reply yet, but I am sure they are busy with it. Just wanted to get some confirmation.

Re: Ping in script problem

Posted: Sat Jul 24, 2010 1:42 am
by roadracer96
Im tyring something similar.

This works from the CLI:

:foreach i in=[/ppp active find where radius=no] do={ :if ([/ping count=1 [/ppp active get $i address]]!=1) do={ /ppp active remove $i } }

But not in a script. The ping command returns the number of successful pings as a result on the CLI, but not in a script. Is that intended?

Re: Ping in script problem

Posted: Sat Jul 24, 2010 2:32 am
by Chupaka
beta5 is here, you may check it =)

Re: Ping in script problem

Posted: Sat Jul 24, 2010 4:42 am
by roadracer96
Been running beta5 since 9am EST on 4 routers... :D

Re: Ping in script problem

Posted: Sat Jul 24, 2010 12:34 pm
by Chupaka
and the problem you described is still here? then write to support@ =)

Re: Ping in script problem

Posted: Sat Jul 24, 2010 11:33 pm
by roadracer96
and the problem you described is still here? then write to support@ =)

I will. I never tried doing that particular function until yesterday. Im assuming it did work because I saw failover scripts that used it in that way... :D

Re: Ping in script problem

Posted: Tue Aug 17, 2010 7:20 pm
by PietRetief
Good day. I have been busy on a different project for a while now, and have only recently had time to look at this ping script again.

I loaded Ros5 beta 6 and the ping script is still not working.

I will send a mail to support as well, I just wanted to keep this thread updated too.

Please see attached image for the results.

Best regards :)

Re: Ping in script problem

Posted: Sun Oct 10, 2010 12:36 pm
by PietRetief
Hi, I checked RC2, the problem is still there. :(

Re: Ping in script problem

Posted: Sun Oct 10, 2010 5:30 pm
by dssmiktik
In v5.0rc1 it seems to work fine for me, both in terminal and scripts.

It may be that it accepts properties more like other commands (ex. /ping address=x.x.x.x ....)

This worked for me:
# Should output 5
:local p [/ping address=127.0.0.1 count=5 interval 1s]
:put $p
Output: 5
# Should output 0
:local p [/ping address=255.254.254.254 count=5 interval 1s]
:put $p
Output: 0

Re: Ping in script problem

Posted: Sun Oct 10, 2010 5:45 pm
by PietRetief
Hi dssmiktik, thanks for the reply.

I checked and yes, it looks like the ping works when you run the script via the terminal. But if you run that script by running clicking the icon on winbox or via the scheduler it does not work.

Please see attached screenshot:

1 - ran via terminal, output is correct.
2 - ran via winbox, output is wrong.
3 - i use Log to output the variable because I do not intend to run the script via console every 5 minutes on 100 routers.

P.S. This ping script is a small part of a much larger script.

Re: Ping in script problem

Posted: Sun Oct 10, 2010 9:01 pm
by dssmiktik
Sorry, I missed the part about only running it via winbox (not terminal).

I'm getting very weird results as well. When I run via terminal, the terminal output and log both show correct values. When I run via winbox, the log shows an empty entry, completely blank. Also, when I run :execute "/system script run <scriptname>", completely blank log entries are created.

Re: Ping in script problem

Posted: Mon Oct 11, 2010 9:57 am
by dssmiktik
I emailed support and this was their response:
Right now we are working on more serious bugfixes. We will fix ping as soon as possible.
v5.0RC1 = v5.0beta7 IMO

Re: Ping in script problem

Posted: Tue Oct 12, 2010 2:33 pm
by PietRetief
I emailed support and this was their response:
Right now we are working on more serious bugfixes. We will fix ping as soon as possible.
v5.0RC1 = v5.0beta7 IMO
Yup, exactly the same response I got.

I can understand that they have more important problems, it is just a pity that this one part happens to be broken :(

Lets hope for a fix in RC3 :D

Re: Ping in script problem

Posted: Tue Oct 26, 2010 2:36 pm
by dominicbatty
I cannot believe this is still broken in RC2, I logged this originally in Beta4. My entire fail over scripting is based on the use of this /ping command which only works under the schedule once on the very first call to it, after which fails to work.

I appreciate that they are working on "more serious issues" but are they trying to fix topics utilised by 2% of the user base because they are complex but are simple functions like ping considered unimportant.

You would think if the fix the ping were simple they would just put it right to get all these people off their backs moaning about it not working.

Re: Ping in script problem

Posted: Wed Oct 27, 2010 4:55 am
by roadracer96
Where is RC2? Id love to see if SSTP is fixed...

Re: Ping in script problem

Posted: Wed Oct 27, 2010 5:27 am
by roadracer96
Found it. :D

Re: Ping in script problem

Posted: Wed Oct 27, 2010 5:26 pm
by mangust
Found it. :D
Found what?
There is no "offical" RC2. Is'n it?

Re: Ping in script problem

Posted: Wed Oct 27, 2010 6:48 pm
by roadracer96
Its in the same place they put stuff before official release.

Didnt fix SSTP memory leak. Blew threw 200+mb ram in 9 hours on my RB1000 and clients were unable to connect.
Didnt fix 100% cpu usage either.

Re: Ping in script problem

Posted: Wed Oct 27, 2010 11:39 pm
by NetworkPro
OMFG this problem is still annoying @ pre-RC2 @ 22nd Oct.

the ping in script does not return the value :(

My beautiful script from v3 is ruined now, its not working. I coded that for a whole week !!! GRRRR!!!

Re: Ping in script problem

Posted: Thu Oct 28, 2010 9:14 am
by NetworkPro
This should be fixed in final v5 as per an e-mail from support.

Re: Ping in script problem

Posted: Thu Oct 28, 2010 9:49 pm
by dssmiktik
I emailed support about this as well. It is not a new feature, it is an existing feature that got broke.

Broken features are more urgent then anything else in my opinion. If a feature breaks, wait to release until all existing features still work as intended.

Re: Ping in script problem

Posted: Thu Oct 28, 2010 10:33 pm
by NetworkPro
NV2 is more important tan scripting. Wireless PtP links rarely use scripts.

Re: Ping in script problem

Posted: Thu Oct 28, 2010 10:35 pm
by PietRetief
I am sad to say, the problem is still present in RC2 (2010-Oct-27 16:20)

Lets hope they fix it before 5.0 final.

Re: Ping in script problem

Posted: Thu Oct 28, 2010 10:35 pm
by PietRetief
NV2 is more important tan scripting. Wireless PtP links rarely use scripts.
Does NV2 give you dynamic QoS limits on fluctuating links due to change in ccq, noise, etc?

Re: Ping in script problem

Posted: Fri Oct 29, 2010 1:02 am
by NetworkPro
I hope so :)

Re: Ping in script problem

Posted: Mon Nov 01, 2010 6:08 pm
by roadracer96
NV2 is more important tan scripting. Wireless PtP links rarely use scripts.
New features should always be secondary to fixing broken features. ALWAYS.

Re: Ping in script problem

Posted: Mon Nov 01, 2010 6:28 pm
by NetworkPro
Hey MikroTik guys, how do you make these decisions?

Re: Ping in script problem

Posted: Mon Nov 01, 2010 7:50 pm
by Chupaka
simply: higher priority for bigger customers

Re: Ping in script problem

Posted: Tue Nov 02, 2010 8:44 am
by mrz
Fixed, wait for next version.

Re: Ping in script problem

Posted: Tue Nov 02, 2010 4:55 pm
by PietRetief
Fixed, wait for next version.
Thanks mrz, I cannot wait to get my claws on RC4 then :D

Re: Ping in script problem

Posted: Tue Nov 02, 2010 7:09 pm
by NetworkPro
Me too!!

Re: Ping in script problem

Posted: Tue Nov 02, 2010 8:59 pm
by dssmiktik
Me three!

Re: Ping in script problem

Posted: Wed Nov 03, 2010 12:08 am
by Chupaka
me - zero, I use v5 in production =)

Re: Ping in script problem

Posted: Mon Nov 08, 2010 6:30 pm
by mazari
I got a RB493 that originally came with the RouterOS 3 and then I decided to upgrade it to 4.11. I am working on a script where I also need to ping a public IP (e.g. google) but the command won't work from the script (Winbox), however, it does when I execute the command from the terminal. A couple of days ago I read this post and PietRetief mentioned that his script worked on RouterOS 3.30 but not in RouterOS 5 and today I downgraded from RouterOS 4.11 to RouterOS 3.30 and I still got the same problem. I even tried to run PietRetief's script and it works from the terminal but no from the Winbox. Any idea why I am not able to run PietRetief's script from Winbox using RouterOS 3.30? Any idea on when is RC4 coming out?

Re: Ping in script problem

Posted: Mon Nov 08, 2010 6:42 pm
by NetworkPro
My ping is working with pre-RC4 for mipsbe from 05 Nov. I upgraded a lot of routers with this version.

Re: Ping in script problem

Posted: Mon Nov 08, 2010 8:30 pm
by mazari
I will upgrade my RB493 to RouterOS5rc3 and see what happens ...
My ping is working with pre-RC4 for mipsbe from 05 Nov. I upgraded a lot of routers with this version.

Re: Ping in script problem

Posted: Mon Nov 08, 2010 9:09 pm
by mazari
What do you mean by pre RC4? I tried RC3 and it didn't work

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:05 am
by NetworkPro
It's the RC4 test version that is shared under /share/ .. .npk as per usual. NPK Package time (seen from WinBox) is 5th Nov.

I can't recommend anyone trying this version since its very unofficial. If the router broke, who would be to blame?

Re: Ping in script problem

Posted: Tue Nov 09, 2010 2:59 pm
by Chupaka
I downgraded from RouterOS 4.11 to RouterOS 3.30 and I still got the same problem. I even tried to run PietRetief's script and it works from the terminal but no from the Winbox. Any idea why I am not able to run PietRetief's script from Winbox using RouterOS 3.30?
maybe, script doesn't have necessary permissions?..

Re: Ping in script problem

Posted: Tue Nov 09, 2010 3:56 pm
by mazari
It's the RC4 test version that is shared under /share/ .. .npk as per usual. NPK Package time (seen from WinBox) is 5th Nov.

I can't recommend anyone trying this version since its very unofficial. If the router broke, who would be to blame?

NetwokPro, I am sorry for being such a noob but I can't find where this unofficial version is (/share/). Can you be more specific where I can find it?. I don't mind trying it on my router because I am using this router to learn more about Mikrotik and I am not using it on a real application. However, if the router breaks you know who I'll blame :lol:

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:00 pm
by mazari
I downgraded from RouterOS 4.11 to RouterOS 3.30 and I still got the same problem. I even tried to run PietRetief's script and it works from the terminal but no from the Winbox. Any idea why I am not able to run PietRetief's script from Winbox using RouterOS 3.30?
maybe, script doesn't have necessary permissions?..
I am the administrator, however, how can I check this?

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:01 pm
by mrz
It's the RC4 test version that is shared under /share/ .. .npk as per usual. NPK Package time (seen from WinBox) is 5th Nov.

I can't recommend anyone trying this version since its very unofficial. If the router broke, who would be to blame?

NetwokPro, I am sorry for being such a noob but I can't find where this unofficial version is (/share/). Can you be more specific where I can find it?. I don't mind trying it on my router because I am using this router to learn more about Mikrotik and I am not using it on a real application. However, if the router breaks you know who I'll blame :lol:
RC4 is not available for public, and even if you get RC4 it will not solve your ping problem because v4 and v3 did not have problem that was solved in RC4. As Chupaka mentioned it might be script permission problem (check if you have all necessary policies selected), or some error in script itself.

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:03 pm
by Copper
I am sorry for being such a noob but I can't find where this unofficial version is (/share/)
Link to pre- versions you may get by sending request to support@ if you explain why you want this.
Here on the forum, you will not get the link to testing build.

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:21 pm
by NetworkPro
Hey guys, been testin a bit here, this script

under ver. pre-RC4 of 05th Nov.
:log info ([/ping 127.0.0.1 count=4])
seems to be able to persistently (~10+ times in a row) write the result in log with the permissions of Read and Test :)

Under v5 when you doubleclick the script, it opens for editing + you can select the permissions above the script itself.

P.S. I also just tested the same script again, with full permission set, in the official RC3 and it writes the number in log only the first time. Every consecutive attempt writes an empty log entry.

I hope this helps clarify the issue.

Re: Ping in script problem

Posted: Tue Nov 09, 2010 4:29 pm
by mazari
HI NetworkPro

Thanks for your help. I will try 3.30 again with the permissions to see if I am able to ping because I don't have access to pre RC4

Re: Ping in script problem

Posted: Tue Nov 09, 2010 5:34 pm
by mazari
I downgraded from RouterOS 4.11 to RouterOS 3.30 and I still got the same problem. I even tried to run PietRetief's script and it works from the terminal but no from the Winbox. Any idea why I am not able to run PietRetief's script from Winbox using RouterOS 3.30?
maybe, script doesn't have necessary permissions?..
You are right Chupaka, I tried 3.30 again with the right permissions and it worked...Thanks!!!!

Re: Ping in script problem

Posted: Thu Dec 09, 2010 7:27 pm
by PietRetief
Hi guys, I tested on Ros5rc5 and the ping command works when used in a script again!

Thank you very very much! :D :D :D