NetXMS Support Forum

Please login or register.

Login with username, password and session length
Pages: [1] 2

Author Topic: Import list of servers  (Read 4003 times)

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Import list of servers
« on: May 27, 2016, 05:19:04 pm »

Hello all,

I'm currently in the process of migrating from another monitoring solution and wanted to know if there was an easy way to import a list of names/ip addresses into netxms.  Two caveats here: 1. The servers will not have the agent installed initially (network only monitoring for now) and 2. I'd like to be able to associate an ipv4 and ipv6 ip address to the node when it's imported.   

Thanks for the assistance. 
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #1 on: May 27, 2016, 06:06:44 pm »

You will have to do this using a NXShell script, or using the API (I recommend the Java API, its really easy to work with).

Actually, if you want to, you can provide me with a sample csv file of you nodes, and I can write the Java importer into NetXMS for you.
(its that easy, about 200 lines of Java code)

Example csv:
Code: [Select]
Node name, IPv4 address, IPv6 address, Container to bind to
Example server 1, 1.1.1.1, 1::1, Servers
Example server 2, 2.2.2.2, , Other container
« Last Edit: May 27, 2016, 06:08:22 pm by tomaskir »
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #2 on: May 27, 2016, 06:32:56 pm »

Yep, gimme a bit.  I'll make sure it's formatted like you have below.  It's like 400 plus servers, so it can take a bit to go though

Thanks a ton. 
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #3 on: May 27, 2016, 07:02:16 pm »

Hey, I actually realized something.  I probably can't send out this list. Server names/IP addresses might be considered a bit touchy.  Would you be able to take an input using a file formatted like your example?
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #4 on: May 28, 2016, 02:12:01 am »

Here is a functional NetXMS .csv importer:
https://github.com/tomaskir/NetXMS-csv-importer

It will take any address for a node (ipv4, ipv6 or a hostname), but will not add multiple addresses to a single node.
The reason for this is that NetXMS uses one primary address to communicate with the node, and then discovers all of the node's IP addresses over an Agent (be that NetXMS or SNMP Agent).

Adding multiple IP addresses to a dynamic interface in NetXMS is not possible manually.
I dont want to create multiple interfaces to assign multiple addresses to a node, because you would have to delete them manually later on.

The right solution to having all information (which includes all IP addresses) of a node is to have an Agent.
So lets not code work-arounds, and focus on solving it properly, by having an Agent present on the server node :)
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #5 on: June 03, 2016, 10:37:37 pm »

Unfortunately, I can't do that.  I've begged, but first and foremost we need to have an agentless monitoring solution.  I'll test this out this week (and I apologize for the delay... hectic week).

Thank you very much. 
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #6 on: June 15, 2016, 05:06:34 pm »

Hey, finally was able to sit down and work on this.  Getting an error  .Error - "NXCException"!
Error message - "Incompatible operation".

It imports about 150 servers out of a list of about 600, then I get this message. 

Update:  Did a little troubleshooting.  Once I get past about 180 or so entires in the nodes table, I only seem to be able to import servers one at a time using the tool.  Otherwise it throws the above exception. 
« Last Edit: June 15, 2016, 05:42:56 pm by MatthewDreher »
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #7 on: June 15, 2016, 07:10:12 pm »

I will consult with Viktor (since the error is from the NetXMS API), and get back to you asap.
« Last Edit: June 15, 2016, 07:15:40 pm by tomaskir »
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #8 on: June 15, 2016, 07:15:03 pm »

Thank you very much.  You have no idea how helpful this is. 
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #9 on: June 20, 2016, 08:57:53 pm »

After consulting with Victor, we found a potential issue when containers for imported nodes have name duplicities with other objects in NetXMS.
(internally, code could have chosen a non-container object to attempt to bind a node to)

I fixed it and released a newer version:
https://github.com/tomaskir/NetXMS-csv-importer/releases

Please try and let me know if it works now.
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #10 on: June 21, 2016, 08:14:42 pm »

Ah... much better.  Thank you very much. 
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #11 on: June 21, 2016, 08:33:53 pm »

Is it working correctly for you now and importing all the nodes?
Logged

MatthewDreher

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Import list of servers
« Reply #12 on: June 22, 2016, 05:08:32 pm »

I had a few duplicate IPs to weed out, but yes, I got everything imported.  Thank you very much for the assistance.
Logged

gmonk63

  • Full Member
  • ***
  • Posts: 119
    • View Profile
Re: Import list of servers
« Reply #13 on: August 14, 2016, 01:29:55 am »

Would it be possible to auto create the container if it does not exist
Logged

tomaskir

  • Sr. Member
  • ****
  • Posts: 433
  • https://unimus.net
    • View Profile
Re: Import list of servers
« Reply #14 on: August 14, 2016, 02:40:27 am »

Do you want just to create the container under "Infrastructure services", or do you want to create a whole container path?
Logged
Pages: [1] 2