Community discussions

 
mxmxmxmxmx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Aug 25, 2008 1:27 am

functin to sum traffic of 2 interfaces

Tue Jan 25, 2011 9:24 pm

is it possible to make chart(i need function first), with sum of traffic of 2 interfaces
a. when both interfaces are on the same RB
b. when interfaces are one different RB?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6615
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: functin to sum traffic of 2 interfaces

Wed Jan 26, 2011 10:22 am

You can have chart with two different sources, that will be displayed on the same graph. But there will not be sum for these graphs.
 
mxmxmxmxmx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Aug 25, 2008 1:27 am

Re: functin to sum traffic of 2 interfaces

Wed Jan 26, 2011 11:10 am

I've made it this way, i have 2 WAN, and i want to see summary traffic.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: functin to sum traffic of 2 interfaces

Wed Jan 26, 2011 11:58 am

1) Create new datasource
datasource.png
The code should be
round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.10.1","5","300","192.168.0.250","Cisco"))*8) +
rate(diff32(oid("1.3.6.1.2.1.2.2.1.10.2","5","300","192.168.0.244","Cisco"))*8))
This code will return sum of bitrate for inbound interface rate on 2 devices with IP 192.168.0.250 (interface index 1) and IP 192.168.0.244 (interface index 2). For more information check functions description in The Dude function tab.
2) Create new datasource for outbound traffic. The code will change to
round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.16.1","5","300","192.168.0.250","Cisco"))*8) +
rate(diff32(oid("1.3.6.1.2.1.2.2.1.16.2","5","300","192.168.0.244","Cisco"))*8))
3) Put new created datasources on chart.
4) Enjoy. :D
You do not have the required permissions to view the files attached to this post.
 
mxmxmxmxmx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Aug 25, 2008 1:27 am

Re: functin to sum traffic of 2 interfaces

Wed Jan 26, 2011 9:43 pm

well, thanks, almost ok, i've got question about units, where i'm wrong:
oid("1.3.6.1.2.1.2.2.1.16.1") - Bytes
diff32(oid("1.3.6.1.2.1.2.2.1.16.1")) - difference in Bytes
diff32(oid("1.3.6.1.2.1.2.2.1.16.1"))*8 - difference in bits
rate(diff32(oid("1.3.6.1.2.1.2.2.1.16.1"))*8) - rate in bit/s
I thought, that last line should be equal to built in function: bitrate of this intercafe(bit/s), but my result is still 8 or 10 times smaller, where's mistake?
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: functin to sum traffic of 2 interfaces

Thu Jan 27, 2011 12:17 pm

where's mistake?
Not any mistake.
Take a look at this
rate_bitrate.png
concatenate("Rate is: ",round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.10.1"))*8))," ;Bitrate is: ",bitrate(round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.10.1"))*8))))
Bitrate is doing exatly what it should "formats number as bitrate". But on a chart you should put "raw" values.
You do not have the required permissions to view the files attached to this post.
 
mxmxmxmxmx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Mon Aug 25, 2008 1:27 am

Re: functin to sum traffic of 2 interfaces

Thu Jan 27, 2011 3:59 pm

You were very helpfull again, thanks, it was my mistake i was looking on upload:
"1.3.6.1.2.1.2.2.1.16.1"
when i need download:
"1.3.6.1.2.1.2.2.1.10.1"
Now it's OK thx.
 
User avatar
pnajm
Frequent Visitor
Frequent Visitor
Posts: 90
Joined: Thu Nov 21, 2013 6:54 pm

Re: functin to sum traffic of 2 interfaces

Sat Apr 27, 2019 1:23 pm

Hello, can you please provide code for the sum of 2 interfaces on the same router?

Who is online

Users browsing this forum: No registered users and 6 guests