Hi guys,
I've seen a number of posts around this topic, but I'm having trouble getting this to work.
Problem: when I create a DCI that uses instance discovery (eg: ifInOctets) I can't seem to get the interface description into the name of the DCI.
I've tried using the %{script:xxxxx} approach in the DCI name, but I can't find out how to pass {instance} as a parameter to the script and $dci appears to not be set in the script.
I've tried using the return %(true,"<interface_name>") method in the instance filter, but this breaks the {instance} value for the OID.
Any help on a working solution?
Here's an example of my current DCI config:
Description: Input Bandwidth (bps) on {instance}
SNMP OID: .1.3.6.1.2.1.2.2.1.10.{instance}
Transformation: Delta/sec, and $1 * 8 in the script
Instance discovery: SNMP walk of OID .1.3.6.1.2.1.2.2.1.10
Thanks,
Richard
UPDATE: Please see this post:
https://www.netxms.org/forum/configuration/interface-names-in-instance-discovery/msg18102/#msg18102
Description: Traffic on {instance-name} - bits/s IN
Parameter: .1.3.6.1.2.1.31.1.1.1.6.{instance}
Origin: SNMP - Unsigned Int 64bit
Transformation: Average delta per sec
Transform script: return $1 * 8;
Instance discovery: SNMP Walk - OIDs
Base SNMP OID: .1.3.6.1.2.1.2.2.1.1
Instance discovery script:
transport = CreateSNMPTransport($node);
if (transport == null)
return false;
// get the interface name to return as instance-name
vb = SNMPGet(transport, ".1.3.6.1.2.1.31.1.1.1.1." . $1);
if (vb == null)
return false;
// filter out loopback
if (vb->value == "lo")
return false;
return %(true, $1, vb->value);
Please note the node has to support the IfXTable for this script to work.
Perfect. Thanks Tomaskir. Now that you pointed this out, I found it in the docs :) Works like a charm.
Regards,
Richard
I wonder is there any reasons left to use snmp transport in such cases. We can get all interesting information from $node object and its child interfaces:
i = GetInterfaceObject($node, $1);
if (i != null && i->adminState == 1)
{
return %(true, $1, i->name);
}
return false;
Very nice......
but.....
how do i get the "instance name when" i use this DCIs as title in the Performance tab?
"%{node-name} {node-name}" doesn't work.
Greeting from Germany
Ludger
Hi,
try to use {instance} in graph title - it should be replaced with the value seen in Thresholds -> Instance in DCI properties.
Best regards,
Victor
Also as a side note to discussion about returning interface names.
"SNMPWalk - OIDs" now actually returns value of the OID as $2.
So now, script can look like this:
Instance discovery: SNMP Walk - OIDs
Base SNMP OID: .1.3.6.1.2.1.31.1.1.1.1
Instance discovery script:
return %(true, $1, $2);
So NetXMS will push to the script $1 as discovered instance (same as before), but now $2 is pushed to the script as the value of that OID automatically.
This makes the above script possible, and you dont have to use CreateSNMPTransport or GetInterfaceObject anymore.
Let me summarize to make it easy for other beginners like me:
for inward traffic (using the 64bit snmp oid)
In "Data Collection Confiugration:"
Description: Traffic on {instance-name} - bits/s IN
Parameter: .1.3.6.1.2.1.31.1.1.1.6.{instance}
Origin: SNMP - Unsigned Int 64bit
Transformation: Average delta per sec
Transform script: $1 * 8
Instance discovery: SNMP Walk - OIDs
Base SNMP OID: .1.3.6.1.2.1.31.1.1.1.1
Instance discovery script: return %(true, $1, $2);
For OUT traffic just change:
Description: Traffic on {instance-name} - bits/s OUT
Parameter: .1.3.6.1.2.1.31.1.1.1.10.{instance}