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. Difficulty using the CSV Importer

Difficulty using the CSV Importer

Scheduled Pinned Locked Moved Support
10 Posts 3 Posters 18.6k 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.
  • T
    T
    twparker
    wrote on last edited by
    #1

    Hello all,

    I am very new to netXMS (using ver 4.3.5) so please be patient.  Currently working on migrating network monitoring for a WISP off of the Dude to netXMS. I figured the best way to go about this would be to import a csv from the Dude device list. I got the list to pass all the checks, but I am getting the following error -

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Error: NXCException - Access denied.

    I verified that my credentials and IP address for the netxms server are correct. I appreciate any suggestions.

    1 Reply Last reply
    0
    • G
      G
      gmonk63
      wrote on last edited by
      #2

      What are you using to import  is it  https://github.com/tomaskir/NetXMS-csv-importer  if so im not sure it works with newer versions of Netxms

      1 Reply Last reply
      0
      • T
        T
        twparker
        wrote on last edited by
        #3

        Yes, that is exactly what I am using. If that is the case, are there other options for mass device imports for newer versions of NetXMS? I have about 1500 devices that I am currently tracking with the Dude that I need to migrate.

        1 Reply Last reply
        0
        • F
          F
          Filipp Sudanov
          wrote on last edited by
          #4

          Here's nxshell script that does the same job. nxshell is Jython implementation of Java API. You need to install nxshell to use this, on Linux this is included in netxms-client package

          To execute the script:
          nxshell -u admin -P password create_nodes.py

          import csv
          
          print("=========================================================================================================")
          
          with open('nodes.csv') as csv_file:
              reader = csv.reader(csv_file, delimiter=',')
              data = [row for row in reader]
          
          Infrastructure = session.findObjectByName("Infrastructure services")
          if Infrastructure is None:
              print("Infrastructure services not found")
              quit()
          
          flags = NXCObjectCreationData.CF_DISABLE_ETHERNET_IP
          
          for i in range(0, len(data)):
              node_name = data[i][0].strip()
              node_address = data[i][1].strip()
              node_container = data[i][2].strip()
              Container = session.findObjectByName(node_container)
              if Container is None:
                  cd = NXCObjectCreationData(objects.GenericObject.OBJECT_CONTAINER, node_container, Infrastructure.objectId);
                  node_container_id = session.createObject(cd)
                  print('Container "{}" created, id={}'.format(node_container, node_container_id))
              else:
                  print('Container "{}" already exists'.format(node_container))
                  node_container_id = Container.objectId
              Node = session.findObjectByName(node_name)
              if Node is None:
                  cd = NXCObjectCreationData(objects.GenericObject.OBJECT_NODE, node_name, node_container_id);
                  cd.setCreationFlags(flags);
                  cd.setPrimaryName(node_address)
                  nodeId = session.createObject(cd)
                  print('Node "%s" created, id=%d' % (node_name, nodeId))
              else:
                  print('Node "%s" already exists' % (node_name))
          
          1 Reply Last reply
          0
          • F
            F
            Filipp Sudanov
            wrote on last edited by
            #5

            Actually, can you attach an example of how export from the Dude looks like? We might be interested in adding some out-of-the box scripts for import as this might be useful for many people.

            Is it only the list of nodes, or there is some other useful data from the Dude that can be exported (e.g. templates with OIDs for SNMP polling, etc...)

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

                Hey Filipp,

              I didn't notice your response to this nearly 2 years ago. I don't know if this table structure is still useful, but it is what is exported from the Dude device list.

              Flag Name Addresses MAC Type Maps Services Down Notes

              I was revisiting this thread as I was trying to bulk import older devices we weren't previously monitoring into our NetXMS deployment. I figured that I could re-use this script, but I am running into errors now when I try to use it.

              SyntaxError: no viable alternative at input 'admin'

              1 Reply Last reply
              0
              • F
                F
                Filipp Sudanov
                wrote on last edited by
                #7

                Looks that some text was accidentally pasted in the middle of the script. I've fixed the source in the above message.

                1 Reply Last reply
                0
                • T
                  T
                  twparker
                  wrote on last edited by
                  #8

                  Thanks, Filipp. That got me farther.

                  Traceback (most recent call last):
                    File "create_nodes.py", line 17, in <module>
                      node_name = data[i].strip()
                  AttributeError: 'list' object has no attribute 'strip'

                  1 Reply Last reply
                  0
                  • F
                    F
                    Filipp Sudanov
                    wrote on last edited by
                    #9

                    I've modified the script above, pls try again

                    1 Reply Last reply
                    0
                    • T
                      T
                      twparker
                      wrote on last edited by
                      #10

                      It works beautifully now. Thank you so much, Filipp!

                      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