Community discussions

MikroTik App
 
ormwish
just joined
Topic Author
Posts: 16
Joined: Tue Jul 06, 2010 11:27 pm
Location: Russia, Saint-Petersburg

How to concatenate context var with function?

Wed Aug 04, 2010 4:08 pm

Я пробовал конкатенировать значение ifAlias оид со значением контекстной переменной Interface.Index, для получения описания порта, не прибегая к ручному прописыванию индекса порта в скрипте, что дало бы возможность прописать этот скрипт в дефолтный скрипт лейбла.
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.",[Interface.Index]))
возвращает
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.",17))
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.","[Interface.Index]"))
возвращает
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.","17"))
тогда как
oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.","17"))
возвращает нужное значение
Interface's_description
Как объявить эту переменную в функции, для получения значения - вообще не представляю



I tried to concatenate the value ifAlias oid with a value of context variable Interface.Index, for descriptions of the port without the need for manual prescribing index port in the script that would make it possible to register this script in a default value of the label.
oid (concatenate ("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.", [Interface.Index])) 
returns
oid (concatenate ("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.", 17)) 
oid (concatenate ("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias .","[ Interface.Index]"))
returns
oid (concatenate ("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.", "17")) 
whereas oid
(concatenate ("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.", "17"))
returns a value
Interface's_description
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: How to concatenate context var with function?

Wed Aug 04, 2010 5:31 pm

If you would like to have such a picture
pic1.png
you should use not [Interface.Index], but link_index()
pic2.png
the code should be
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()))]
You do not have the required permissions to view the files attached to this post.
 
ormwish
just joined
Topic Author
Posts: 16
Joined: Tue Jul 06, 2010 11:27 pm
Location: Russia, Saint-Petersburg

Re: How to concatenate context var with function?

Wed Aug 04, 2010 9:53 pm

Thanks a lot, Gsandul.
Overlooked this function.
 
ormwish
just joined
Topic Author
Posts: 16
Joined: Tue Jul 06, 2010 11:27 pm
Location: Russia, Saint-Petersburg

Re: How to concatenate context var with function?

Wed Aug 04, 2010 10:06 pm

Descr:[oid(concatenate("iso.org.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.",link_index()))]
Description of interface like output of JunOS
show interfaces description

Who is online

Users browsing this forum: No registered users and 7 guests