To assist with integrating NMIS with other network management systems, NMIS includes a little script for importing nodes from a zenbatchdump file.
This script handles importing nodes both with SNMPv3 and earlier SNMP support.
The Zenoss bulk import script can be found in /usr/local/nmis8/admin/import_zenoss_backup.pl and there is a sample zenbatchdump file at /usr/local/nmis8/admin/samples/zenbatchdump_sample.txt
The command-line parameters can be viewed by running the script without arguments:
import_zenoss_backup.pl \ zenbatchdump=/usr/local/nmis8/admin/samples/zenbatchdump_sample.txt \ nodes=/usr/local/nmis8/conf/Nodes.nmis.new \ locations=/usr/local/nmis8/conf/Locations.nmis.new \ customers=/usr/local/nmis8/conf/Customers.nmis.new \ role=access group=NMIS8 customer_is_imported_group=0|1 fixNames=0|1 setlocation=all|setAddress|setTitle verbose=1|0
- zenbatchdump is a required argument to the zenbatchdump file from which the import is to be run;
- nodes is a required argument that points at the Nodes.nmis target file that NMIS8 already loaded nodes and the imported nodes will be written to;
- locations is a required argument that points at the Locations.nmis target file that NMIS8 already loaded locations and the imported locations will be written to;
- customers is a required argument that points at the Customers.nmis target file that NMIS8 already loaded customers and the imported customers will be written to - customers are loaded from the '/Groups/' provided in the zenbatchdump file we are importing from;
- role=access causes role for all imported devices to be set to role=access, which is also the default should no role be provided on the command-line - role can be set to the desired value for the imported nodes using this argument;
- group=NMIS8 causes role for all imported devices to be set to group=NMIS8, which is also the default should no group be provided on the command-line - group can be set to the desired value for the imported nodes using this argument;
- Each imported node can have its customer property set to the last group provided in the setGroups directive of the zenbatchdump file by passing argument customer_is_imported_group=1; customer_is_imported_group=0 is the default;
- fixNames=1 causes the script to attempt to fix any imported nodenames that are not deemed suitable by the script; fixNames=0 is the default;
- setlocation=all|setAddress|setTitle provides some flexibility in how Locations are imported:
- setlocation=all , the default, causes all locations to be imported;
- setlocation=setAddress causes only those locations that include a setAddress directive to be imported;
- setlocation=setTitle causes only those locations that include a setTitle directive to be imported;
- verbose=1, the default, causes complete information to be printed as output during the import; verbose=0 causes only important information to be printed as output during the import.
The output from the script when run successfully should end with oputput along the lines of:
RESULTS: 3 locations processed 3 locations added 0 locations updated New locations imported into "Locations.nmis.test", check the file and copy over existing NMIS Locations file cp Locations.nmis.test /usr/local/nmis8/conf/Locations.nmis 2 customers processed 2 customers added 0 customers updated New customers imported into "Customers.nmis.test", check the file and copy over existing NMIS Customers file cp Customers.nmis.test /usr/local/nmis8/conf/Customers.nmis 3 nodes processed 3 nodes added 0 nodes updated New nodes imported into "Nodes.nmis.test", check the file and copy over existing NMIS Nodes file cp Nodes.nmis.test /usr/local/nmis8/conf/Nodes.nmis
Once one is satisfied that the contents of the target Nodes.nmis, Locations.nmis and Customers.nmis files are as desired,
one can backup then replace the equivalent NMIS8 operational files Node.nmis, Locations.nmis and Customers.nmis in directory /path/to/nmis8/conf/ with these target files generated by this import script.