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. NxShell Interaction Help - Strange error in script

NxShell Interaction Help - Strange error in script

Scheduled Pinned Locked Moved Support
6 Posts 3 Posters 16.2k 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.
  • B
    B
    bikeprata
    wrote on last edited by
    #1

    Hello everyone!

    I'm creating a script to populate nodes from my network, getting them from a ".csv" file. It's working pretty fine, but I can't use the method "setIpAdress()" from NXCObjectCreationData. In the method call bellow "cd" is a NXCObjectCreationData object and "objectIp" is a string with the IP formated such as in "192.168.2.1".

    cd.setIpAddress(InetAddress.getByName(objectIp))
    

    When I execute the script I get the following error:

    TypeError: setIpAddress(): 1st arg can't be coerced to org.netxms.base.InetAddressEx

    I couldn't find the class org.netxms.base.InetAddressEx on the API and it's stated on the NCXObjectCreationData reference that "setIpAdress()" should receive an InetAdress instance.

    Could you guys help me on this?

    Thanks in advance!

    Edit: I'm using the 2.0.M4 version.

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

      Hi,

      i am getting the same error in my script. Are there any solutions?

      Also using 2.0-M4

      Regards,
      Christoph

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

        Hi,

        problem is that javadoc is outdated. In version 2.0-M4 NXCObjectCreationData.setIpAddress expects object of type InetAddressEx. You can create it as follows:

        InetAddressEx(InetAddress.getByName(objectIp), 0)

        but preferred way for creating node objects is to use setPrimaryName instead:

        cd.setPrimaryName(objectIp)

        Best regards,
        Victor

        1 Reply Last reply
        0
        • T
          T
          technikcst
          wrote on last edited by
          #4

          Hi Victor,

          thank you  for your answer 😃
          I was trying to set the ip and netmask manually for an object because if i create a node in GUI, the netmask of the generated node is wrong. But as i see now, the API seems to be really outdated ('org.netxms.client.NXCObjectCreationData' object has no attribute 'setIpNetMask') is there a new documentation somewhere?

          Thanks for your help,
          Christoph

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

            We re-generate javadoc: https://www.netxms.org/documentation/javadoc/latest/. Now it is for actual development branch (you can consider it 2.0-M4 as there was no changes in API since last release).

            Best regards,
            Victor

            1 Reply Last reply
            0
            • T
              T
              technikcst
              wrote on last edited by
              #6

              Thank you very much  🙂

              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