Versions Compared

Key

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


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" : ""

}


Create a new node based on the modified template: remember that the node name is inside the file. In this example My_new_paradise

sudo /usr/local/nmis9/admin/node_admin.pl act=create  file="/tmp/my_new_paradise.json"

You can see the new node created:

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

Clear the node events: This only works for a single node. You can clear by node name or by id.

 sudo /usr/local/nmis9/admin/node_admin.pl act=clean-node-events node=My_new_paradise

sudo /usr/local/nmis9/admin/node_admin.pl act=clean-node-events uuid=95bc5b15-afbb-4ea0-a899-5e7026a56d4d