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 seconds
transformation 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 String
but 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
Quote from: Percy on February 28, 2014, 09:44:43 AM
trafficIn = SNMPGetValue(transport, ".1.3.6.1.2.1.31.1.1.1.6.$1");
I am not shure, but try to change to:
trafficIn = SNMPGetValue(transport, ".1.3.6.1.2.1.31.1.1.1.6." . $1);
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 152548225
here {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 Name
Description 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 integer
difficult 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
I had not find way to make DCI Description field another than index. :(
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:
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.10
Script Library:
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 branch
But 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
hi..,
i tried the way you mention above but not working properly.
Still i am facing the same problem in getting the port name or interface name in DCI description.
percy
I have found interesting function:
http://wiki.netxms.org/wiki/NXSL:CreateDCI
May be it helps...