...
NMIS provides a number of different methods for managing your nodes, both GUI-based and commandline-oriented. This document describes the commandline tools present in versions 8.5.4 and newer.
Bulk Import and Export
For importing lots of nodes in one go from a CSV file, NMIS has been providing admin/import_nodes.pl
for a long time. There is also a sibling admin/export_nodes.pl
tool, and both are documented on the Bulk Import page. The main benefit of these tools is utmost simplicity, but at the cost of some flexibility: import_nodes
does not make all common node properties controllable or accessible.
Node administration with node_admin.pl
Version 8.5.4G brings in a new, more fine-grained and capable tool: admin/node_admin.pl. It's scriptable and pipelineable, and can perform all node-related operations: creation, updating, renaming, exporting and deletion of nodes.
Basic Operation
Run the tool with no options or -? or -h and it'll display a simple help page:
Import nodes to NMIS9 from NMIS8
To import nodes from NMIS8 to NMIS9 copy /path/to/nmis8/conf/Nodes.nmis to /tmp/ on NMIS9 installation then:
Code Block |
---|
/usr/local/nmis9/admin/node_admin.pl act=import_bulk nodes="/tmp/Nodes.nmis" |
Caveats: you can not import a node to a server if there is already a node existing with that name, you should rename the node before importing.
Bulk Import and Export
For importing lots of nodes in one go from a CSV file, NMIS has been providing admin/import_nodes.pl
for a long time. There is also a sibling admin/export_nodes.pl
tool, and both are documented on the Bulk Import page. The main benefit of these tools is utmost simplicity, but at the cost of some flexibility: import_nodes
does not make all common node properties controllable or accessible.
Node administration with node_admin.pl
Version 8.5.4G brings in a new, more fine-grained and capable tool: admin/node_admin.pl. It's scriptable and pipelineable, and can perform all node-related operations: creation, updating, renaming, exporting and deletion of nodes.
Basic Operation
Run the tool with no options or -? or -h and it'll display a simple help page:
Code Block |
---|
./admin/node_admin.pl -h
Usage: node_admin.pl |
Code Block |
./admin/node_admin.pl -h
Usage: node_admin.pl act=[action to take] [extras...]
node_admin.pl act=list
node_admin.pl act={create|export|update|delete} node=nodeX
node_admin.pl act=mktemplate [placeholder=1/0]
node_admin.pl act=rename old=nodeX new=nodeY
mktemplate: prints blank template for node creation,
optionally with __REPLACE_XX__ placeholder
create: requires file=NewNodeDef.json
export: exports to file=someFile.json (or STDOUT if no file given)
update: updates existing node from file=someFile.json (or STDIN)
delete: only deletes if confirm=yes (in uppercase) is given
extras: deletedata=<true,false> which makes delete also
delete all RRD files for the node. default is false.
extras: conf=<configname> to use different configuration
extras: debug={1..9,verbose} sets debugging verbosity
extras: info=1 sets general verbosity |
...
NMIS uses a subset of the node properties of the commercial Opmantek tools. node_admin.pl act=mktemplate
includes a very brief listing of the most essential ones from NMIS' perspective, and the Common Node Properties wiki page describes most of the important ones in greater detail.
NMIS9 Enhancements
The node admin tool in NMIS9 brings some enhancements.
- The node_admin tool now supports more complete snapshotting of nodes (with
act=dump
), which optionally includes the node's RRD files, events and other historic records.
When importing a thusly dumped node withact=import
it is now possible to have all identifiers localised to the current system (withlocalise_ids=true
); this causes the imported node to be 'adopted' by and become active on the current NMIS system immediately.
This mechanism allows a node to be moved completely between NMIS systems, without losing any of the node's history.
Backup, Migrate or just play with a Node
Simple node export and import are described above, however, with NMIS9 you can backup a node and perform node migrations using the node_admin.pl tool, the functions to do this are dump and restore.
Dump (or Backup) a Node
The node admin tool in NMIS9 brings some enhancements.
Backup, Migrate or just play with a Node
Simple node export and import are described above, however, with NMIS9 you can backup a node and perform node migrations using the node_admin.pl tool, the functions to do this are dump and restore.
Dump (or Backup) a Node
Using the node_admin.pl tool you can dump a node including all database records and RRD files into a ZIP file.
Code Block |
---|
/usr/local/nmis9/admin/node_admin.pl node=NODENAME act=dump everything=1 file=/tmp/NODENAME-dump.zip |
This file would represent a backup of that node at this time. The file can then be used on another server to restore or could be used to restore the node on the same server.
Restoring a Node
To restore a node to the same poller you would not need to localise_ids option, if you wanted to copy/migrate the node to another server you would need to localise the ids so that the poller thinks it the node belongs to itUsing the node_admin.pl tool you can dump a node including all database records and RRD files into a ZIP file.
Code Block |
---|
/usr/local/nmis9/admin/node_admin.pl node=NODENAME act=dumprestore everything=1 file=/tmp/NODENAME-dump.zip |
This file would represent a backup of that node at this time. The file can then be used on another server to restore or could be used to restore the node on the same server.
Restoring a Node
localise_ids=1 |
Caveats: you can not restore a node to a server if there is already a node existing with that name, you should rename the node before dumping. This would include if the server was acting as a master and receiving the node from a remote poller.
Copy a Node
To make a duplicate node and start polling it, export the node, edit the json and import it, e.g.
Code Block |
---|
/usr/local/nmis9/admin/node_admin.pl act=export node=NODENAME file=NODENAME.json |
Edit NODENAME.json, change the display_name and name in the file and then import itTo restore a node to the same poller you would not need to localise_ids option, if you wanted to copy/migrate the node to another server you would need to localise the ids so that the poller thinks it the node belongs to it.
Code Block |
---|
/usr/local/nmis9/admin/node_admin.pl act=restoreimport file=NODENAME-dump.zip localise_ids=1.json |
The node will be created with the name used in the name fieldCaveats: you can not restore a node to a server if there is already a node existing with that name, you should rename the node before dumping. This would include if the server was acting as a master and receiving the node from a remote poller.
NMIS9 Basic Operation
Run the tool with no options or -? or -h and it'll display a simple help page:
...