Problem with script via API

Hi people,
I am using RB4xx router with 5.19 FW and I use the following script for connection status logging:

:log info "MONITOR493";
/interface ethernet monitor ether1 once do={:log info "ether1 state $status";}
/interface ethernet monitor ether2 once do={:log info "ether2 state $status";}
/interface ethernet monitor ether3 once do={:log info "ether3 state $status";}
/interface ethernet monitor ether4 once do={:log info "ether4 state $status";}
/interface ethernet monitor ether5 once do={:log info "ether5 state $status";}
/interface ethernet monitor ether6 once do={:log info "ether6 state $status";}
/interface ethernet monitor ether7 once do={:log info "ether7 state $status";}
/interface ethernet monitor ether8 once do={:log info "ether8 state $status";}
/interface ethernet monitor ether9 once do={:log info "ether9 state $status";}

/interface wireless monitor wlan1 once do={:log info "wlan1 state $"status" Signal $"signal-strength" SNR $"signal-to-noise" Noise $"noise-floor" Thruput $"p-throughput" Freq $"frequency"";}

:log info "routeWanDistance $[/ip route get [find comment="gatewayWAN"] distance]";
:log info "gwWanState $[/ip route get [find comment="gatewayWAN"] gateway-status]";
:log info "gwWLanState $[/ip route get [find comment="gw wlan1"] gateway-status]";};

The log script’s result running in winbox is the following:

script info MONITOR493
script info ether1 state link-ok
script info ether2 state link-ok
script info ether3 state link-ok
script info ether4 state link-ok
script info ether5 state link-ok
script info ether6 state link-ok
script info ether7 state link-ok
script info ether8 state link-ok
script info ether9 state link-ok
script info wlan1 state disabled Signal SNR Noise Thruput Freq
script info routeWanDistance 1
script info gwWanState 10.2.0.253 reachable via ether1
script info gwWLanState 192.168.3.254 unreachable

It works!

The log script’s result launched via API is the following:

script info MONITOR493
script info routeWanDistance 1
script info gwWanState 10.2.0.253 reachable via ether1
script info gwWLanState 192.168.3.254 unreachable

The monitor commands dosn’t work! Why?
There is somenthing wrong?

Dax.

The output’s API is

!re
!re
!re
!re
!re
!re
!re
!re
!re
!re
!trap
!trap=category=0
!trap=category=0=message=no such item
!done
!re
!re
!re
!re
!re
!re
!re
!re
!re
!re
!trap=category=0=message=no such item
!done

Another script test via API:
I have moved the “once” instruction to the end of the line.
Script’s code:

:log info "TEST MONITOR";
/interface ethernet monitor ether1 do={:log info "ether1 state $status";} once;

The output log is :

script info TEST MONITOR
script info ether1 state

It dosn’t print the value of the variable $status (link-ok etc..).

Very Strange.

to get script result using API, you have to follow these steps:

  1. create script in /system script
  2. make script save output into global variable
  3. run script via API /system/script/run…
  4. read variable information from global variable through /system/script/environment or /environment