Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To assist with integrating NMIS with other network management systems, NMIS includes a little script for importing nodes from a CSV file. From version 9.1.1G onwards there are also more fine-grained tools available, which are described on the page titled Node Administration Tools.

The bulk import script can be found in /usr/local/nmis9/admin/import_nodes.pl and there is a sample CSV file /usr/local/nmis9/admin/samples/import_nodes_sample.csv.

The minimum properties you need to have to add a device to NMIS are, name, host, group, role, community, roleType and netType.  Technically you can use defaults for group and role and the name and host maybe the same, so the absolute minimum is host and community.  This sample CSV includes the full five properties and if required you can use additional ones.

Code Block
name,host,group,role,community,netType,roleType
import_test1,127.0.0.1,Branches,core,nmisGig8,lan,default
import_test2,127.0.0.1,Sales,core,nmisGig8,lan,default
import_test3,127.0.0.1,DataCenter,core,nmisGig8,lan,default
newnode,127.0.0.1,DataCenter,core,nmisGig8,lan,default

To load these devices into NMIS9 run the following command:

Code Block
nmis9/admin$ ./import_nodes.pl csv=/usr/local/nmis9/admin/import_nodes_sample.csv simulate=f/t

This will take the CSV file and will look for the existence of the node based on the name/node_uuid. If the node exists, it will override its properties for the properties specified in the csv. 

Simulation mode

By default, NMIS will be run in simulation mode. At the end, you will able to see if the node will be created or update. As an example output:

...

Code Block
UPDATE: node=newnode host=127.0.0.1 group=DataCenter
	=> Successfully updated node newnode.
ADDING: node=import_test3 host=127.0.0.1 group=DataCenter
	=> Successfully created node import_test3.
ADDING: node=import_test1 host=127.0.0.1 group=Branches
	=> Successfully created node import_test1.
ADDING: node=import_test2 host=127.0.0.1 group=Sales
	=> Successfully created node import_test2.

Once you have added nodes or modified nodes an NMIS Update is required which you can run in the background or run for a single node.

To run an NMIS update in the background, the command nohup is No Hangup, so you can exit the SSH session if required, this will continue running.

Code Block
./bin/nmis-cli act=schedule at="now + 5 minutes" job.node=testnode job.force=1

To run an NMIS update for a single node, optionally with debug.

Code Block
./bin/nmis-cli act=schedule job.type=update at="now + 5 minutes" job.node=testnode job.force=1 job.verbosity=9

If adding a large number of devices it might take sometime to complete the adding.  This is because the first time a node is added to NMIS it needs to create all the RRD files for performance data, this only takes a few seconds per file, but each node may have 10 RRD files or more, so this compounds to a large number of seconds very fast when adding 1000's of devices at a time.  

Performance

You can check how long the script is going to last for each node using the following argument:

...