/
NMIS9 - Bulk Export and Import nodes from CLI and others Admin Options

NMIS9 - Bulk Export and Import nodes from CLI and others Admin Options


This article's purpose of helping export/import bulk nodes and know how to show, create, delete, rename, dump, restore, make templates, and clean node events in a simple way to learn the CLI commands. 

What this command can do:

sudo /usr/local/nmis9/admin/node_admin.pl -h

Show all nodes name on the NMIS:

sudo /usr/local/nmis9/admin/node_admin.pl act=list

Show all nodes name and Id on the NMIS:

 sudo /usr/local/nmis9/admin/node_admin.pl act=list_uuid

Show the node headers on the NMIS: You can use this information to put on import node csv header.

  sudo /usr/local/nmis9/admin/node_admin.pl act=show node=Printer

Bulk Export all nodes on the NMIS to a file: add keep_ids=1 to export the uuid, cluster and poller.

  sudo /usr/local/nmis9/admin/node_admin.pl act=export file="/tmp/Nodes_export_keep_id.nmis" keep_ids=1

You can check cluster id, uuid, poller and node name:

 grep -E "display_name|id|poller"  Nodes_export_keep_id.nmis

You can check the only nodes name:

 grep -E "display_name"  Nodes_export_keep_id.nmis

Bulk import all nodes on the NMIS from a file: 

sudo /usr/local/nmis9/admin/node_admin.pl act=import_bulk nodes="/tmp/Nodes_export_keep_id.nmis" nmis9_format=1

OBSERVATION: If you are bulk import for a NMIS9, you will need to add the parameter nmis9_format=1. If you forgot it, it will through an error.

Bulk import all nodes from the CSV file:

This way will enable activation on NMIS:

The best way to import from NMIS8 to NMIS9 is to create a CSV file and then copy it to NMIS9 Administration GUI ==> Add node

From your NMIS8

/usr/local/nmis8/admin

sudo  ./export_nodes.pl nodes=/tmp/node_export_location2.csv

https://docs.community.firstwave.com/wiki/display/opCommon/Importing+Nodes+with+Admin+GUI

sudo ./import_nodes.pl csv=/usr/local/nmis9/admin/node.csv verbose=1 simulate=f

sudo ./import_nodes.pl csv=/usr/local/nmis9/admin/node.csv 



Copy a node info to a zip file: This only works for a single node.

 sudo /usr/local/nmis9/admin/node_admin.pl act=dump node="RokuStreamingStick" everything=1 file="/tmp/RokuStreamingStick-dump.zip"

See the node info from zip file:

 unzip RokuStreamingStick-dump.zip

Delete a node: This only works for a single node.

sudo /usr/local/nmis9/admin/node_admin.pl act=delete  node="RokuStreamingStick" confirm=YES deletedata=1

Restore a node that was delete: This only works for a single node.

 sudo /usr/local/nmis9/admin/node_admin.pl act=restore file=RokuStreamingStick-dump.zip localise_ids=1

This is an example of Delete a node and restore: