Name

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

SYNOPSIS

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

DESCRIPTION

NOTE: This script will do as much validation as possible on the comma-separated values (CSV) file before injecting data in the NNMi data store.

The nnmloadinterfacegroups.sh script loads Interface 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 interface data defined in an external data store, and you want to load it into the NNMi database as Interface Group definitions. After loading the contents of the .csv file into NNMi, you can use the Interface Group form to further refine the definition of each Interface Group.

Parameters

nnmloadinterfacegroups.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 Interface Group configuration before using this option.

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

-r true means all the settings for any existing Interface 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 Interface Group configuration.

-f <csv_filename>

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

Syntax of Comma-Separated File

NOTE: Fields containing special characters such as newlines, commas or quotes should be surrounded by double-quotes in the CSV file. Fields containing embedded double-quote characters must also use the escaped form of two double-quote characters in the field which is surrounded by double-quotes as specified by RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files.

The CSV file you supply must have the following syntax:

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

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

You do not need to add a comma to indicate the end of Column 7. No semicolon ";" is required at the end of a list of values in a CSV field within a column (between commas ",").

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

1. NNMi first evaluates any ifType Filters (column 6). Interfaces must match at least one specification to belong to this Interface Group.

2. NNMi then evaluates any Additional Filters (column 7). Interfaces must also pass all Additional Filters specifications to belong to this Interface Group.

3. If a Node Group (column 5) is specified for this Interface Group, any interface in this group must be contained in a node that is a member of that Node Group.

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.

#InterfaceGroupName,[Notes],[AddtoFilterList],[AddtoPerformanceFilterList],[NodeGroupName],[ifType1;...], [AdditionalFilters]

  • Column 1(A) : Interface Group Name

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

  • Column 2(B) : Notes

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

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

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

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

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

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

  • Column 4(D) : Add to Performance Filter List

    Optional. Sets the NNMi iSPI Performance Add to Filter List field of the Interface Group form.

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

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

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

  • Column 5(E) : Node Group Name

    Optional. The specified Node Group serves as a filter for this Interface Group.

    Note: If you specify a Node Group, the Node Group must already exist in the NNMi database.

  • Column 6(F) : ifType Filters

    Optional. Add ifType Filters settings, separated by semicolon ";" (After importing, these specifications appear on the ifType Filters tab of the Interface Group form.) Each ifType is identified by the ifType name.

    Provide the exact ifType name as it appears in the NNMi console.

    Example entries for ifType Filters:

    • ds0;ds0Bundle;ds1;ds1FDL;ds3;g703at2mb

    • ppp;pppMultilinkBundle;propPointToPointSerial;slip

    • ethernetCsmacd

  • Column 7(G) : Additional Filters

    Optional. Specify additional filter expressions used to further define the interfaces to be included in an Interface Group. The format of additional filters is:

    1. Define a filter condition operator and its associated filter conditions within a matching set of parentheses.

    2. Define a filter by specifying the filter attribute followed by a filter operator and then finally by the filter value.

    All filter attributes and operators that are available in the interface group form are supported. Multiple filter values can be specified by using a ':' to separate them while multiple filters for a filter condition operator will be separated by a ';'. A space is used to separate a filter attribute and the filter operator and a space is also used to separate a filter operator and the filter value.

    Filter Attributes:

    • ifAlias

    • ifDesc

    • ifIndex

    • ifName

    • ifSpeed

    • hostedOn

    • ipAddress

    • isSnmpInterface

    • sysOidInterface

    • devCategoryInterface

    • devVendorInterface

    • devFamilyInterface

    • customAttrName

    • customAttrValue

    • capability

    • vlanId

    • vlanName

    • ipPhysAddress

    • configuredDuplexSetting

    Filter Operators:

    • !=

    • >

    • >=

    • <

    • <=

    • =

    • between

    • in

    • is_not_null

    • is_null

    • like

    • not_between

    • not_in

    • not_like

    Filter Condition Operators:

    • AND

    • OR

    • NOT

    • EXISTS

    • NOT_EXISTS

    Examples:

    • (AND hostedOn like *.mycompany.com (OR (EXISTS (AND customAttrName = circuit; customAttrValue = 12) ) (EXISTS (AND customAttrName = circuit; customAttrValue = 15) ) ) )

    • (AND hostedOn like *.mycompany.com (EXISTS (AND customAttrName = circuit; customAttrValue in 12:15) ) )

    • hostedOn like *.mycompany.com

    • ifAlias = " Alias with leading and trailing spaces "

    • ifAlias = Alias with embedded \"double quotes\"

    These examples show the field value as it should be entered in a tool, like Microsoft Excel, which creates CSV files with correct formatting. When formatting CSV files by hand the rules specified in RFC 4180 should be followed, resulting in files such as:

    "My Group",,,,,,"ifAlias = Alias with embedded \""double quotes\"""

Note

When entering filter values, avoid using the special characters '"', '(', ')', ':' and ';'. If you need to use these special characters then escape them with a '\'. For example:

  • 'circuit:57' must be entered as 'circuit\:57'

  • 'circuit(57)' must be entered as 'circuit\(57\)'

  • 'circuit"57"' must be entered as 'circuit\"57\"'

  • 'circuit;57' must be entered as 'circuit\;57'

  • 'circuit\:57' must be entered as 'circuit\\\:57'

These examples show the field value as it should be entered in a tool, like Microsoft Excel, which creates CSV files with correct formatting. When formatting CSV files by hand the rules specified in RFC 4180 should be followed, resulting in files such as:

"My Group",,,,,,"ifAlias = circuit\(57\)"

"My Group",,,,,,"ifAlias = circuit\""57\"""

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 nnmloadinterfacegroups.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.

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 Interface Group with a Name starting with the # character).

EXAMPLES

Sample CSV file contents:

Point to Point Interfaces,Point to Point Interfaces are usually associated with dial-up.,1,1,,ppp;pppMultilinkBundle;propPointToPointSerial;slip

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

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

To load the Interface Groups from a CSV file, and overwrite any existing Interface 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 Interface Group's configuration):

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

AUTHOR

nnmloadinterfacegroups.sh was developed by Hewlett Packard Enterprise.

FILES

$NMS_BIN/nnmloadinterfacegroups.sh

Return to Reference Pages Index