Interface Name in DCI through template
-
hi Victor,
i have created Templates
Description- Traffic In {instance} (Byte/sec)
Parameter-.1.3.6.1.2.1.31.1.1.1.1.{instance} //ifName Oid
Origin- SNMP
Datatype- String
Instance Discovery-Snmp walk-oid
Base Oid-.1.3.6.1.2.1.31.1.1.1.1
Polling Interval = 60 secondstransformation Script-
transport = CreateSNMPTransport($node); // Create SNMP transport for node
if (transport == null)
{
println "Failed to create SNMP transport, exit";
return 1;
}
trafficIn = SNMPGetValue(transport, ".1.3.6.1.2.1.31.1.1.1.6.$1");
return = trafficIn;this template create DCI for the Routers in this way
Description Parameter data Type
Traffic In {instance} (Byte/sec) .1.3.6.1.2.1.31.1.1.1.1.{instance} String
Traffic In fa0/0 (Byte/sec) .1.3.6.1.2.1.31.1.1.1.1.fa0/0 String
Traffic In fa0/1 (Byte/sec) .1.3.6.1.2.1.31.1.1.1.1.fa0/1 String
Traffic In fa0/2 (Byte/sec) .1.3.6.1.2.1.31.1.1.1.1.fa0/2 Stringbut when i check the DCI values. it does not collect the data shows zero for all interfaces DCI, why transformation script is not working. please correct me where i am doing wrong. please let me know if there are other way to do the same.
thanks in advance,
Percy -
-
hi,
thanks for the Reply... i have tried this still not working...
i think problem is here
in this $1 = fa0/0, fa0/1 and so on
trafficIn = SNMPGetValue(transport, ".1.3.6.1.2.1.31.1.1.1.6.fa0/0); but when we select walk with this OId it give result like this
.1.3.6.1.2.1.31.1.1.1.6.1 125824582
.1.3.6.1.2.1.31.1.1.1.6.2 112124548
.1.3.6.1.2.1.31.1.1.1.6.3 152548225here {instance} is an Index i.e integer value but we are passing string fa0/0
when i change the Parameter Oid IfName to ifIndex than DCI doesnot show the Interface Name...but give the Values for the DCI.
in this case DCI doesnot shows the interface NameDescription Parameter data Type
Traffic In {instance} (Byte/sec) .1.3.6.1.2.1.2.2.1.1.{instance} integer
Traffic In 1 (Byte/sec) .1.3.6.1.2.1.2.2.1.1.1 integer
Traffic In 2 (Byte/sec) .1.3.6.1.2.1.2.2.1.1.2 integer
Traffic In 3 (Byte/sec) .1.3.6.1.2.1.2.2.1.1.3 integerdifficult to find the DCI for the Interface Inteface fa0/1 or if there are many Interfaces difficult to find the DCI for the particular inteface.
Regards.
Percy -
Hi, the OID range you are trying to look into is .1.3.6.1.2.1.31.1.1.1.6.x (as seen in the transformation script) but in the DCI template you have just .1.3.6.1.2.1.31.1.1.1.1.x ?
And the Datatype in the DCI template configuration should be Integer, not String (not sure if it is the main problem though).
M.Sperl
-
-
Sorry I did not understand the problem.
I tried to solve this with macro but not sure if instance parameter can be passed to the script...
For that reason every other part of the DCI is normal:
DCI:
Description: ifDescr: %{script:ReturnIfDescr} Parameter: .1.3.6.1.2.1.2.2.1.10.{instance} // <= value InOctets for ports, taken from the .10 branch Origin: SNMP Datatype: Integer Instance discovery metod: SNMP Walk - OIDs Base SNMP OID: .1.3.6.1.2.1.2.2.1.10Script Library:
ReturnIfDescr:transport = CreateSNMPTransport($node); if (transport == null) return "n/a"; return SNMPGetValue(transport, ".1.3.6.1.2.1.2.2.1.2.1"); // <= ifDescription of 1st port, taken from the .2 branchBut this script returns only description of the first port to the macro.
There should be something like this, but it does not work this way ofcourse ..
return SNMPGetValue(transport, ".1.3.6.1.2.1.2.2.1.2.".$instance);p.s. this solution will not reflect any changes in the ifDescription though as the macro is run only when the DCI is created
M.Sperl
-
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login