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 to a file:
sudo /usr/local/nmis9/admin/node_admin.pl act=import_bulk nodes="/tmp/Nodes_export_keep_id.nmis"
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:
Rename a node: This only works for a single node.
sudo /usr/local/nmis9/admin/node_admin.pl act=rename old=RokuStreamingStick new=Roku_stick
On this example you can see the new node Roku_stick:
sudo /usr/local/nmis9/admin/node_admin.pl act=list_uuid
Create a template node: This only works for a single node.
sudo /usr/local/nmis9/admin/node_admin.pl act=mktemplate placeholder=1 file="/tmp/template.json"
You can see the template node:
cat template.json
Make a copy of the template to create a new node:
cp template.json my_new_paradise.json
Fill out the information replacing the template node (See example below):
vim my_new_paradise.json
{
"activated" :{
"NMIS":1
...
"name" : "My_new_paradise",
"uuid" : ""
}