Versions Compared

Key

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

...

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

...

  1. Run the command: ./node_admin.pl act=mktemplate placeholder=1
    The results of this command are shown below:

    Code Block
    {
       "active" : "__REPLACE_ACTIVE__",
       "collect" : "__REPLACE_COLLECT__",
       "community" : "__REPLACE_COMMUNITY__",
       "group" : "__REPLACE_GROUP__",
       "host" : "__REPLACE_HOST__",
       "location" : "__REPLACE_LOCATION__",
       "model" : "__REPLACE_MODEL__",
       "name" : "__REPLACE_NAME__",
       "netType" : "__REPLACE_NETTYPE__",
       "notes" : "__REPLACE_NOTES__",
       "ping" : "__REPLACE_PING__",
       "roleType" : "__REPLACE_ROLETYPE__",
       "version" : "__REPLACE_VERSION__"
    }
    Edit the information inside the template (i.e. change
    " : "__REPLACE_
    ACTIVE
    ROLETYPE__"
    to "true") to correspond with the node you want to create then save it as a .json file.
  2. Once the .json file is created and edited to suite then you run this command to create the new node: ./node_admin.pl act=create node=newnode file=newnode.json (replace "newnode" with a node name of your choice)
  3. If the node was created successfully you should see a confirmation message saying, "Succesfully created node newnode.". To ensure the node was added you can go to the NMIS GUI and view it there as well.

Node Renaming

To rename nodes you should use act=rename which requires both old and new node names with arguments old and new, respectively. This operation first changes the node name (which is the primary name the node is known to and displayed by NMIS, and which is NOT necessarily the hostname or ip address of the node), and then adjusts all files related to the node in question:

  • all RRD database files are renamed,
  • and the node-related state files in /usr/local/nmis8/var are also renamed.

Deleting Nodes

To remove a node (but not its historic data) simply run node_admin with the argument act=delete node=ripnode, plus the option confirm=YES (must be uppercase) to make node_admin actually perform the deletion.

This removes only the node configuration record but not RRD database files or state files in var. To delete these as well, you can add the option deletedata=1 to the command, and all data related to this node will be removed permanently.

Code Block
./node_admin.pl act=delete node=ripnode confirm=YES deletedata=1
Successfully deleted ripnode

Node Properties

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.

...

  1. ,
       "version" : "__REPLACE_VERSION__"
    }


  2. Edit the information inside the template (i.e. change "__REPLACE_ACTIVE__" to "true") to correspond with the node you want to create then save it as a .json file.
  3. Once the .json file is created and edited to suite then you run this command to create the new node: ./node_admin.pl act=create node=newnode file=newnode.json (replace "newnode" with a node name of your choice)
  4. If the node was created successfully you should see a confirmation message saying, "Succesfully created node newnode.". To ensure the node was added you can go to the NMIS GUI and view it there as well.

Node Renaming

To rename nodes you should use act=rename which requires both old and new node names with arguments old and new, respectively. This operation first changes the node name (which is the primary name the node is known to and displayed by NMIS, and which is NOT necessarily the hostname or ip address of the node), and then adjusts all files related to the node in question:

  • all RRD database files are renamed,
  • and the node-related state files in /usr/local/nmis8/var are also renamed.

Deleting Nodes

To remove a node (but not its historic data) simply run node_admin with the argument act=delete node=ripnode, plus the option confirm=YES (must be uppercase) to make node_admin actually perform the deletion.

This removes only the node configuration record but not RRD database files or state files in var. To delete these as well, you can add the option deletedata=1 to the command, and all data related to this node will be removed permanently.

Code Block
./node_admin.pl act=delete node=ripnode confirm=YES deletedata=1
Successfully deleted ripnode

Node Properties

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.

Backup, Migrate or just play with a Node

...