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 8.5.4G onwards there are also more fine-grained tools available, which are described on the page titled Node Administration Tools.

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

The minimum properties you need to have to add a device to NMIS are, name, host, group, role and community.  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
import_test1,127.0.0.1,Branches,core,nmisGig8
import_test2,127.0.0.1,Sales,core,nmisGig8
import_test3,127.0.0.1,DataCenter,core,nmisGig8

To load these devices into NMIS8 run the following command

Code Block
/usr/local/nmis8/admin/import_nodes.pl csv=/usr/local/nmis8/admin/import_nodes_sample.csv nodes=/usr/local/nmis8/conf/Nodes.nmis.new

This will take the CSV file and merge it with the existing /usr/local/nmis8/conf/Nodes.nmis file and create a new nodes file /usr/local/nmis8/conf/Nodes.nmis.new.  Merging the files means that you can use this script and CSV to update existing properties of devices as well as adding new devices, perfect for integration into other systems and to create automated processes.

Once you have created /usr/local/nmis8/conf/Nodes.nmis.new you need to replace the existing Nodes.nmis file and it is a good idea to keep a backup, running these two commands together is a good idea.

Code Block
mv /usr/local/nmis8/conf/Nodes.nmis /usr/local/nmis8/conf/Nodes.nmis.old
mv /usr/local/nmis8/conf/Nodes.nmis.new /usr/local/nmis8/conf/Nodes.nmis
/usr/local/nmis8/admin/fixperms.pl 

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
nohup nice /usr/local/nmis8/bin/nmis.pl type=update mthread=true maxthreads=5 &

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

Code Block
/usr/local/nmis8/bin/nmis.pl type=update node=NAME_OF_NODE [debug=true]

If adding a large number of devices it might take sometime to complete the adding, it might be better to add them in batches.  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.  You can suspend cron from running the NMIS polling by modifying /etc/cron.d/nmis , comment out the type=collect line, like this:

Code Block
######################################################
# Run Statistics Collection
#*/5 * * * * /usr/local/nmis8/bin/nmis.pl type=collect mthread=true maxthreads=8

Then when finished adding the files and doing the update, run the first collect manually

Code Block
nohup /usr/local/nmis8/bin/nmis.pl type=collect mthread=true maxthreads=8 &

When this is finished re-enable the collection in cron by removing the comment.

Importing Nodes with SNMPv3

To handle importing nodes with SNMPv3, check out this article: Importing Nodes into NMIS8 with SNMPv3 Credentials