record traffic script not working

cannot seem to get this script to work wont run . what is wrong with it ( what did i do incorrectly)

:global tmp :global tx :global rx :foreach i in [/interface find] do={/interface monitor-traffic $i once do={:set tx ($sent-bits-per-second/1048576):set rx ($received-bits-per-second/1048576):if ([/system scheduler get record run-count]=1) do={:global ttx :set ttx $tx :global trx :set trx $rx}:if ($tx>$ttx) do={/tool e-mail send to=example@example.com subject=“Script message” body=("The transmission traffic on " .[/interface get $i name] . " got up to " . $tx . “Mbps”):set ttx $tx}:if ($rx>$trx) do={/tool e-mail send to=example@example.com subject=“Script message” body=("The receiving traffic on " . [/interface get $i name] . " got up to " . $rx . “Mbps”):set trx $rx}}}

Randy

body=("The transmission traffic on " .[/interface get $i

missed space before [/interface get $i…]

thanks fixed the script

is there a way to watch the script to see each step works or doesnt?

you can use ‘:log’ command after each step. In the ‘/log’ then see whether every :log is executed correctly.

Edgars

do i put the :log after each command?

Randy

do i put the :log after each command?

Randy

The best way would be regression testing :slight_smile:

Start with the general statement like:

:foreach i in [/interface find] do={:put $i}

Then add some more complexity:

:foreach i in [/interface find] do={/interface monitor-traffic $i once do={:put $i; :environment print;}}

Fix the code before doing something else:

:foreach i in [/interface find running=yes] do={/interface monitor-traffic $i once do={:put $i; :environment print;}}

Hint: you can run the script direcly from the console, without creating /system script entry. Just copy-paste the code to the console

Test individual pieces of code separately.

thanks for the info . will play with this in the morning

Randy

This script send to log source address and destination address?
For each lan port or wireless?

10x.
OrCAD