Page 1 of 1

Concatenate OID with Interface.Index

Posted: Sun May 16, 2010 10:26 pm
by frogale
Hi to all Dude masters.. I am trying to print frequency of specific link (Appereance Label menu) with concatenating OID and [Interface.Index] value:

[oid(concatenate("1.3.6.1.4.1.14988.1.1.1.1.1.7.","[Interface.Index]"))]

I've tried many combinations from manual at http://wiki.mikrotik.com/wiki/Manual:Scripting and other forum posts but I am getting only text output like this:

[oid(concatenate("1.3.6.1.4.1.14988.1.1.1.1.1.7.","4"))]
([Interface.Index] is replaced with right iface number and nothing else)

What is wrong? :?

Re: Concatenate OID with Interface.Index

Posted: Mon May 17, 2010 8:24 am
by gsandul
What is wrong? :?
The Dude does not know IP addres of device you are trying to get oid, because you are working with link(in a link context), not with device.

You must provide device IP to function "oid"

Your function should look like
oid(concatenate("1.3.6.1.4.1.14988.1.1.1.1.1.7.","[Interface.Index]"),"5","300","DEV.IP.ADD.RES","Community_Group")

for more info you look at oid function description.

Re: Concatenate OID with Interface.Index

Posted: Mon May 17, 2010 10:30 am
by frogale
This command:
[oid(concatenate("1.3.6.1.4.1.14988.1.1.1.1.1.7.","4"))]
works fine..

And [Interface.Index] alone returns correct value (4)..

I have problem with using OID and variable together..

Btw
[oid(concatenate("1.3.6.1.4.1.14988.1.1.1.1.1.7.","[Interface.Index]"),"5","300","10.38.0.43","public")]
doesn't work either (same textual output)..

Re: Concatenate OID with Interface.Index

Posted: Thu Jul 01, 2010 1:52 pm
by blackpaw
I was breaking my head over this one, too...

Anyone can confirm this is not possible? According to me there are too many [[[]]] in the function...confusing functions/variables

Edit: Dude 4 beta has a new function "link_index" which works!
I did: [oid(concatenate("1.3.6.1.4.1.9.2.2.1.1.28.",link_index()))] and it returned my interface description.

try that?



Andreas

Re: Concatenate OID with Interface.Index

Posted: Thu Jul 01, 2010 5:45 pm
by gsandul
TNX, blackpaw
Now we can easy determine the direction of traffic flow.
links.JPG
The code for link apeareance is
Gi 1/0/21 -- Gi 1/0/2
Rx: [Interface.InBitRate]
Tx: [Interface.OutBitRate]
RxPPS:[Interface.InUnicastPacketsRate]
TxPPS:[Interface.OutUnicastPacketsRate]
Stats on: [oid(concatenate("1.3.6.1.2.1.2.2.1.2.",link_index()))]
I can see the link monitored and I know traffic direction(rx and tx may differ). In the sample traffic is measured from switch Gi1/0/23, not from main router Gi1/0/2.