Page 1 of 1

Documentation about do={<script>} in monitoring commands

Posted: Thu May 06, 2021 2:16 pm
by nostromog
There are a number of commands, such as
/interface monitor-traffic
/interface <whatever-tunnel> monitor 
/system resource monitor
...
That take a do={<script>} attribute that will get executed in every iteration of the monitoring...

The things one can do inside the "do" block don't look very useful unless the object of the monitoring is passed to the block...

I wonder if there is some documentation on how to achieve it. I have tried google, but "do" si too common a keyword to search by it...

Thanks in advance

Re: Documentation about do={<script>} in monitoring commands

Posted: Thu May 06, 2021 2:25 pm
by rextended
/interface ethernet monitor ether1 do={ ... $name ... $status ... $"link-partner-advertising" .... }

/interface monitor ether1 do={ ... $name ... $"tx-bits-per-second" ... $"rx-bits-per-second" .... }

for example, $"" on link-partner-advertising because "-" are present

Re: Documentation about do={<script>} in monitoring commands

Posted: Thu May 06, 2021 3:00 pm
by mrz
Regarding documentation, wiki has several examples, for example:
https://wiki.mikrotik.com/wiki/Manual:S ... imitations

Re: Documentation about do={<script>} in monitoring commands

Posted: Thu May 06, 2021 3:36 pm
by nostromog
/interface ethernet monitor ether1 do={ ... $name ... $status ... $"link-partner-advertising" .... }

/interface monitor ether1 do={ ... $name ... $"tx-bits-per-second" ... $"rx-bits-per-second" .... }

for example, $"" on link-partner-advertising because "-" are present
DOH! Now that you posted the example I see that
  • If there are several items monitored, the script is called once per item (I thought it was once per iteration)
  • $<TAB> completes the available variables, which are the attributes that would be returned by the command
Sorry for not having tried $<TAB>