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. GetNodeInterfaces - parameters [SOLVED]

GetNodeInterfaces - parameters [SOLVED]

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 35.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.
  • S
    S
    sperlm
    wrote on last edited by
    #1

    In the GetNodeInterfaces example there are used two parameters - name and id.

    My question is - can other parameters from Interfaces be used the same way or it is not possible at all ?

    I'm trying to get a list of peers with "i->peerInterface", no results with GetNodeIntefaces or GetObectChildren too - script fails at this point with "invalid operation on object".

    Any help?

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

      Hi!

      Can you explaint in more detail what you are trying to achieve or maybe post whole script? There are also example of using peerNode and peerInterface attributes: http://wiki.netxms.org/wiki/Script_Example:_Additional_Information_About_Connected_Node.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • S
        S
        sperlm
        wrote on last edited by
        #3

        Hello,

          there is no description for GetInterfaceName/Object functions so I am constructing script with GetNodeInterfaces or GetObjectChildren (with the same results).

        The goal is to list peer nodes of subjected node.
        The following macro works fine, returning a list of all ports and then another list with ports which have any peer connection listed.

        ports = "PORTs:\n";
        peers = "PEERs:\n";
        interfaces = GetObjectChildren($node); (or GetNodeInterfaces function)
        foreach (i : interface)
        {
        	ports = ports."- name=".i->name.", id=".i->id."\n";
        	if (i->peerNode != null)
        	{
        		peers = peers."- name=".i->name.", IP=".i->ipAddr.", peer=".i->peerNode."\n";
        	}
        }
        return ports.peers;
        

        Whole macro works fine except the last statement which returns error message.
        After removing the "i->peerNode" part I get nice output in this form:

        PORTs:
        * name='Vl1 id=5699'
        * name='Vl91 id=5700'
        * name='Fa0/1 id=5701'
        * name='Fa0/2 id=5702'
        ...
        * name='Fa0/23 id=5723'
        * name='Fa0/24 id=5724'
        * name='Gi0/1 id=5725'
        * name='Gi0/2 id=5726'
        * name='Nu0 id=5727'
        PEERs:
        * name='Gi0/1' IP=0.0.0.0 peer='
        * name='Gi0/2' IP=0.0.0.0 peer='

        Tried to use structure with GetInterfaceObject in the foreach loop...
        iface = GetInterfaceObject(i,  $5];
        ... to get iface->peerNode, but I get immediately "Function not found" on the line with GetInterfaceObject function.

        With regards,
        Milan Sperl

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

          Your problem here is that i->peerNode is an object, not a string, so you should use something like i->peerNode->name.

          Best regards,
          Victor

          1 Reply Last reply
          0
          • S
            S
            sperlm
            wrote on last edited by
            #5

            Thanks! Work like a charm  ;D

            p.s. could I get my old topic Dependency script based on infrastructure unlocked to post what I came up with to share with others ?

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

              @sperlm said in GetNodeInterfaces - parameters [SOLVED]:

              p.s. could I get my old topic Dependency script based on infrastructure unlocked to post what I came up with to share with others ?

              unlocked.

              Best regards,
              Victor

              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