Community discussions

MikroTik App
 
nostromog
Member Candidate
Member Candidate
Topic Author
Posts: 226
Joined: Wed Jul 18, 2018 3:39 pm

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

Thu May 06, 2021 2:16 pm

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
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

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

Thu May 06, 2021 2:25 pm

/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
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

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

Thu May 06, 2021 3:00 pm

Regarding documentation, wiki has several examples, for example:
https://wiki.mikrotik.com/wiki/Manual:S ... imitations
 
nostromog
Member Candidate
Member Candidate
Topic Author
Posts: 226
Joined: Wed Jul 18, 2018 3:39 pm

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

Thu May 06, 2021 3:36 pm

/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>

Who is online

Users browsing this forum: rextended and 23 guests