Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Interface names in instance discovery

Interface names in instance discovery

Scheduled Pinned Locked Moved Support
8 Posts 6 Posters 49.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    R
    rgkordia
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T
      T
      tomaskir
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • R
        R
        rgkordia
        wrote on last edited by
        #3

        Perfect.  Thanks Tomaskir.  Now that you pointed this out, I found it in the docs 🙂  Works like a charm.

        Regards,
        Richard

        1 Reply Last reply
        0
        • G
          G
          glebofff
          wrote on last edited by
          #4

          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;
          
          1 Reply Last reply
          0
          • L
            L
            LBKRE
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • V
              V
              Victor Kirhenshtein
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • T
                T
                tomaskir
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • S
                  S
                  sarangtc
                  wrote on last edited by
                  #8

                  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}

                  1 Reply Last reply
                  0

                  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
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  Powered by NodeBB Contributors
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups