Name

nnmloadnodegroups.sh — script to load Node Group definitions from a comma-separated values (CSV) file.

SYNOPSIS

nnmloadnodegroups.sh [-?] [-u <username> -p <password>] [-r true | false] -f <csv_filename>

DESCRIPTION

NOTE: This script will not validate comma-separated values (CSV) files before injecting data in the NNMi data store.

The nnmloadnodegroups.sh script loads Node Group definitions from a comma-separated values (CSV) file, such as a .csv file exported from Microsoft™ Excel. This script is useful if you have a large amount of node data defined in an external datastore, and you want to load it into the NNMi database as a starting point for Node Group definitions. After loading the contents of the .csv file into NNMi, you can use the Node Group form to further refine the definition of each Node Group.

The following settings cannot be set in the CSV file. You must import the Node Group and then use the Node Group form to modify these default settings:

  • Calculate Status = true (NNMi calculates the Node Group status)

Parameters

nnmloadnodegroups.sh supports the following options:

-?

Prints the usage statement.

-u <username>

Supply the NNMi administrator username to run the script.

-p <password>

Supply the NNMi administrator password to run the script.

-r true | false

Back up the existing Node Group configuration before using this option.

-r false (the default setting) means if the Node Group Name already exists in the NNMi database, the nnmloadnodegroups.sh command does not change the previous settings.

-r true means all the settings for any existing Node Group with the same Name (column 1) are overwritten with the values in your CSV file. Caution: this is not a merge, it is a complete replacement of that Node Group configuration.

NOTE: When using the replace option with groups in a hierarchy it is required that all child groups are included in the same CSV file.

-f <csv_filename>

Enter the CSV file name and the path for the CSV file.

Syntax of Comma-Separated File

The CSV file you supply must have the following syntax:

Required. Column 1. You must provide a value for Node Group Name.

Optional. Columns 2-15 are optional. Leave any combination of these columns blank.

You do not need to add a comma to indicate the end of Column 15. No semicolon ";" is required at the end of the last entry within a column (between commas ",").

NNMi combines the results of all settings in the following manner:

1. NNMi first evaluates any Device Filters (column 5). Nodes must match at least one specification to belong to this Node Group.

2. NNMi then evaluates any Additional Filters (columns 7-14). Nodes must also pass all Additional Filters specifications to belong to this Node Group. Note: After importing, the Node Group form's Additional Filters tab displays the combined columns 7-14 settings. You can change the default Boolean logic using the Node Group form's Additional Filters Editor.

3. Any Additional Nodes specified (column 6) are always included in the Node Group, regardless of any filters.

4. Any Child Node Groups (column 4) results are treated the same as Additional Nodes.

Empty lines or lines starting with a # character are ignored as comments. Add the following comment to line 1 to make it easy to remember the syntax for each required column.

#[NodeGroupName],[Notes],[AddtoFilterList],[ChildNodeGroup:0/1;...],DeviceFilter[Category1:Vendor1:Family1:Profile1;...],AdditionalNodes[Fully-Qaul-hostname;...],AdditionalFilters > [hostname;...],[hostedIPAddress;...],[mgmtIPAddress;...],[customAttrName/customAttrValue;...],[capability;...]

  • Column 1(A) : Node Group Name

    Required. Specify the Name of the Node Group you want to import. (This becomes the Name attribute value in the Node Group form.)

  • Column 2(B) : Notes

    Optional. Describe the Node Group in your own terms. (This becomes the Notes field text in the Node Group form.)

  • Column 3(C) : Add to View Filter List

    Optional. Sets the Add to View Filter List field of the Node Group form.

    1 (the default setting) means this Node Group is available in the drop-down filter list when viewing tables, such as the All Nodes table.

    0 means do not include this Node Group in the view drop-down filter list.

    Recommendation: Set this value to 1 only for top-level or most commonly used Node Groups. Avoid too many Node Groups or the view filter list is too long and difficult to use.

  • Column 4(D) : Child Node Groups

    Optional. Specify a list of child Node Groups for this Node Group, separated by semicolon ";" (After importing, these specifications appear on the Child Node Groups tab of the Node Group form.) Note: If you are configuring Child Node Groups, the specified child Node Group must either already exist in the NNMi database or be defined in the same CSV file.

    Example: ChildNodeGroup1:1[;ChildNodeGroup2:0;...]

    0 (the default setting) means that child Node Group is shown as a Node Group icon in maps of the parent Node Group.

    1 means expand the child Node Group in a map of the parent Node Group. This option displays all nodes as if they were defined within the parent Node Group.

    Valid entries for Child Node Groups are:

    • computers:1

    • computers:0

    • computers:

    • computers:;printers:1

  • Column 5(E) : Device Filters

    Optional. Add Device Filters settings, separated by semicolon ";" (After importing, these specifications appear on the Device Filters tab of the Node Group form.) Each filter specification consists of 4 optional colon-separated parts in the following format:

    Category1:Vendor1:Family1:Profile1[;Category2:Vendor2:Family2:Profile2 ...]

    Provide the exact specification from the device's MIB file (not the text string displayed in the NNMi console's Device Profile form).

    To match more filters, you may omit portions of a filter specification. For example, if you want to match any family for Category1 and Vendor1, add an entry such as the following:

    Category1:Vendor1::

    To leave family unspecified for filter1 and family and profile unspecified for filter2:

    Category1:vendor1::profile1;Category2:vendor2::;

    Valid example entries for device profile:

    • com.hp.ov.nms.devices.printer:com.hp.ov.nms.devices.hewlettpackard::.1.3.6.1.4.1.9.1.380

    • com.mycomp.ov.nms.devices.printer:com.hp.ov.nms.devices.mycompanyname::

    • com.hp.ov.nms.devices.printer:::

    • :::.1.3.6.1.4.1.9.1.380

  • Column 6(F) : Additional Nodes

    Optional. Specify a list of specific node hostnames you want added to this Node Group, separated by a semicolon ";" (After importing, these specifications appear on the Additional Nodes tab of the Node Group form.) The hostnames you provide must be the current value of the fully-qualified, case-sensitive Hostname attribute as it appears on the Node form.

    For example hostname1.x.y.z;hostname2.x.y.z;hostname3.x.y.z

  • Column 7(G) : Additional Filters "sysName" code (Hostname Wildcards)

    Optional. List the hostname wildcards separated by semicolon ";" (equivalent to the Operator "="). If you need other Operators, use the Node Group form after importing (these specifications appear on the Additional Filters tab of the Node Group form).

    For example: *.cnd.hp.com;*snmp.hp.com

  • Column 8(H) : Additional Filters "hostedIPAddress" code (Hosted IP Address Ranges)

    Optional. List the hosted IP address ranges separated by semicolon ";" (equivalent to the Operator "=") If you need other Operators, use the Node Group form after importing (these specifications appear on the Additional Filters tab of the Node Group form). Ranges have a lower and an upper address, separated by a dash. The addresses are inclusive. To include a single IP address, use the same value for the lower and upper address values. Note that if any address on a node matches this range, the node will be included in the Node Group.

    Valid example: 10.20.30.1-10.20.30.254;192.168.177.1-192.168.180.254;1.1.1.1-1.1.1.1

  • Column 9(I) : Additional Filters "mgmtIPAddress" code (Management Address Ranges)

    Optional. List the management Address ranges separated by semicolon ";" (equivalent to the Operator "=") Ranges are in the same format as hosted IP address ranges. If you need other Operators, use the Node Group form after importing (these specifications appear on the Additional Filters tab of the Node Group form). Note that Spiral Discovery only creates management IP Addresses on nodes that support SNMP. See the online help for the Node form's Management Address field for more information about how Spiral Discovery selects the Management Address.

  • Column 10(J) : Additional Filters "customAttrName:customAttrValue" codes (Custom Node Attributes)

    Optional. List the custom attributes assigned to nodes as follows: "custom attribute name" operator "custom attribute value"[;...] and note the name and the value must be surrounded by quotes. After importing, these Custom Node Attribute specifications appear on the Additional Filters tab of the Node Group form.

    Valid values for operator are as follows:

    =, !=, like, not like, between, not between, >, >=, <, <=, is null, is not null (If you need other values, use the Node Group form after importing.) The operators is null and is not null do not have a value, for example, "my attribute" is not null. The values for between and not between are specified as x AND y (for example, "my attribute" between "100 AND 200").

    For more than one custom attribute statement, place a semicolon between statements (for example, "Location" = "Bldg. Five";"Service Type" = "eCommerce"). Multiple "customAttrName:customAttrValue" statements are AND'ed together. Therefore, all the statements must evaluate to true for each node to be included in the Node Group.

  • Column 11(K) : Additional Filters "capability" code (Capabilities)

    Optional. List the capabilities assigned to nodes as follows: capability operator "capability value"[;...] Note the value must be surrounded by quotes. After importing, these Capabilities specifications appear on the Additional Filters tab of the Node Group form.

    The valid values for operator are as follows:

    =, !=, like, not like (If you need other values, use the Node Group form after importing.)

    For more than one capability statement, place a semicolon between statements (for example, capability = "com.hp.ov.nms.isLANSwitch";capability != "com.hp.ov.nms.isIPv4Router"). Multiple capability statements are AND'ed together. Therefore, all the statements must evaluate to true for each node to be included in the Node Group.

  • Column 12(L) : Security Group Details

    Optional. Specify a list of security-group properties that you want to add to this node-group, separated by semicolon ";". To associate this node-group with a security-group by UUID, enter in the security-group's UUID in the form (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx), where (x) is a hexadecimal digit (0-9a-fA-F) otherwise it will be assumed that the node-group is to be associated with a security-group by name.

    For example 12345678-1234-1234-123456123456;test_security_group_name

  • Column 13(M) : Tenant Details

    Optional. Specify a list of tenant properties that you want to add to this node-group, separated by semicolon ";". To associate this node-group with a tenant by UUID, enter in the tenant's UUID in the form (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx), where (x) is a hexadecimal digit (0-9a-fA-F) otherwise it will be assumed that the node-group is to be associated with a tenant by name.

    For example 12345678-1234-1234-123456123456;test_security_group_name

  • Column 14(N) : Node Name

    Optional. Specify a list of nodes by name that you want to add to this node-group, separated by semicolon ";". To associate this node-group with a node by node-name, include the node names in a list of semicolon-separated values.

    For example test_node_name;node_name_2

  • Column 15(O) : Add to Filter List

    Optional. Sets the Add to Filter List field of the Node Group form.

    0 (the default setting) means this Node Group is not available as a filter in NNM iSPI Performance reports.

    1 means this Node Group appears in the Optional Filters selection panel of the NNM iSPI Performance reports.

    Recommendation: Set this value to 1 only for Node Groups that are needed as filters in NNM iSPI Performance reports.

Use of Microsoft Excel

Microsoft Excel is a useful tool to create comma-separated files, but .csv files do not maintain their column width, comments, and other spreadsheet options. HP recommends that you store a nnmloadnodegroups.sh input file as a native .xls format, then complete a File:Save As... command to create a .csv file. You can then add Excel comments to the file, make columns wider, and do not need to escape the comma character. Microsoft Excel also makes it easy to populate the list of child Node Groups. To do this, make column 4(D) contain a calculated value such as the following:

=$A1&":0;"&$A2&":0;"&$A3&":0;"&$A4&":0;"&$A5&":0;"&$A6&":0;"&$A7&":0;"

This example combines the Node Group Names defined in the first column of the first 7 rows, as child Node Groups of the Node Group Name defined in the first cell of the current row. Using this Excel reference, if you rename the child Node Group in the first column, you do not need to go back and change the reference in the parent Node Group's column 4(D). Note that typing a comma in a line after a leading # in Microsoft Excel generates a non-commented entry when the .xls file is saved as a .csv file (creating a Node Group with a Name starting with the # character).

EXAMPLES

Sample CSV file contents:

SNMP,Nodes that support SNMP and that are present in Colorado,,,,,server1.myco.com;server2.myco.com,*.hp.com

Note

When entering data in CSV files, do not use the separator characters (":" and ";") for other purposes (for example, in the Names - column 1 - of Node Groups). If you need to use the separator characters, escape them with "\". For example:

  • "computer:1" must be entered as "computer\:1"

  • "computer;1" must be entered as "computer\;1"

  • "computer\:1" must be entered as "computer\\\:1"

To load the Node Groups from a CSV file without overwriting any existing Node Group that matches a Name defined in column 1 of your CSV file:

nnmloadnodegroups.sh -u system -p myadminpasswd –f /tmp/test.csv

To load the Node Groups from a CSV file, and overwrite any existing Node Group that matches a Name defined in column 1 of your CSV file (Caution: this is not a merge, it is a complete replacement of that matching Node Group's configuration):

nnmloadnodegroups.sh -u system -p myadminpasswd -r true –f /tmp/test.csv

AUTHOR

nnmloadnodegroups.sh was developed by Hewlett Packard Enterprise.

FILES

$NMS_BIN/nnmloadnodegroups.sh

Return to Reference Pages Index