Import Nodes into NMIS9 - bulk import and integration
Introduction
To assist with batch node operations, 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.
Important
IMPORTANT: The import_nodes.pl script was updated on 10 Dec 2020 to better handle node activation which was causing problems with nodes. If you are using this tool you should update from the NMIS9 GitHub repository, the links are below.
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.
Use the activated.XXX field to activate for NMIS, opConfig, opEvents, you can activate for NMIS but not opConfig for example.
name,host,group,role,community,netType,roleType,activated.NMIS,activated.opConfig import_test1,127.0.0.1,Branches,core,nmisGig8,lan,default,1,1 import_test2,127.0.0.1,Sales,core,nmisGig8,lan,default,1,1 import_test3,127.0.0.1,DataCenter,core,nmisGig8,lan,default,1,1 newnode,127.0.0.1,DataCenter,core,nmisGig8,lan,default,1,0
To load these devices into NMIS9 run the following command:
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.