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"
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
https://community.opmantek.com/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:
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
},
"cluster_id" : "7c1084fe-5f66-4b3b-8a3b-6e58cc8aff4f",
"configuration" : {
"authkey" : "",
"authpassword" : "",
"authprotocol" : "md5",
"collect" : 1,
"community" : "nmisGig8",
"group" : "NMIS9",
"host" : "192.168.0.95",
"location" : "Default Location",
"model" : "automatic",
"netType" : "default",
"notes" : "",
"ping" : 1,
"port" : 161,
"privkey" : "",
"privpassword" : "",
"privprotocol" : "des",
"roleType" : "default",
"threshold" :1,
"username" : "",
"version" : "snmpv2c"
},
"name" : "My_new_paradise",
"uuid" : ""
}