API command notes

From MikroTik Wiki
Revision as of 10:59, 3 March 2010 by Janisk (talk | contribs) (ping)
Jump to navigation Jump to search

Summary

This page contains information about details of API commands, examples

Commands

Monitor-traffic

Details
  • Basic command syntax:
/interface/monitor-traffic
=interface=<id1>,<id2>,<id3>


  • Output: replies will be sent in succession with in statistics about interface in order of IDs given in command. So, first re! will be for <id1>, second for <id2>
  • Duration: command runs until interrupted with /cancel
  • planned changes: it is planned to add item identification to replies.
  • since interfaces have name field, value from that field can be used to address interface instead of .id
Example
  • Command
/interface/monitor-traffic
=interface=ether1-Local,ether3-Out
  • Return
!re
=rx-packets-per-second=4
=rx-drops-per-second=0
=rx-errors-per-second=0
=rx-bits-per-second=8531
=tx-packets-per-second=3
=tx-drops-per-second=0
=tx-errors-per-second=0
=tx-bits-per-second=11266

!re
=rx-packets-per-second=8
=rx-drops-per-second=0
=rx-errors-per-second=0
=rx-bits-per-second=14179
=tx-packets-per-second=4
=tx-drops-per-second=0
=tx-errors-per-second=0
=tx-bits-per-second=8591

!re
=rx-packets-per-second=4
=rx-drops-per-second=0
=rx-errors-per-second=0
=rx-bits-per-second=2312
=tx-packets-per-second=2
=tx-drops-per-second=0
=tx-errors-per-second=0
=tx-bits-per-second=3039

!re
=rx-packets-per-second=5
=rx-drops-per-second=0
=rx-errors-per-second=0
=rx-bits-per-second=4217
=tx-packets-per-second=1
=tx-drops-per-second=0 
=tx-errors-per-second=0
=tx-bits-per-second=635

Ping

Details
  • ping in API reports how many successful replies it has received. And can only be used to determine if target host is capable of replying to ICMP requests
  • for ease of use it us suggested that it is used with count argument set to some value
  • Ping returns only when it is interrupted or reached count limit.
Example
/ping
=address=192.168.88.1
=count=3

In this case ping returned after duration*count seconds, where duration was default 1 second.

!done
=ret=3

See also

API