Name

nnmloadattributes.ovpl — load custom attributes from a comma separated values (CSV) file or line for Nodes, Interfaces, and PhysComps (Cards/Chassis).

SYNOPSIS

nnmloadattributes.ovpl [-?] [-r <true | false>] -t <type> (-f <path & filename of csv file>) | (-s <"csv formatted line">) [-u <username> -p <password>] [-jndiHost <hostName> Default: localhost] [-jndiPort <port> Default: 1099]

DESCRIPTION

nnmloadattributes.ovpl allows custom attributes to be loaded from a comma separated values (CSV) file, such as a .csv file from Microsoft™ Excel. This command is useful if you have a large number of nodes, interfaces, or phys comps that are defined in an external datastore, and you would like to load these attributes into NNM. For nodes, after loading into NNM you can use the Node Group forms to group nodes according to their custom attributes.

Parameters

nnmloadattributes.ovpl supports the following options:

-?

Prints the usage statement.

-r <true | false>

Existing attribute values are not changed unless this argument is provided with the value of true.

-t <type>

Supply the object type to load attributes on. Must be either "node", "interface", or "physcomp".

-f <path & filename of csv file>

Supply the CSV file name (with path, e.g. /tmp/csvfile.csv) that contains the custom attributes to load.

-s <"csv formatted line">

Supply a single CSV formatted line. Eliminates the need to create a file for a small change.

-u <username>

Supply the NNMi administrator username to run the script. This script requires the NNMi administrator username unless you use an nnm.properties file. See the nnm.properties.4 reference page for more information.

-p <password>

Supply the NNMi administrator password to run the script. This script requires the NNMi administrator password unless you use an nnm.properties file. See the nnm.properties.4 reference page for more information.

-jndiHost <serverName>

The server JNDI host; default is localhost.

-jndiPort <port>

The server JNDI port; default is 1099.

Syntax of Comma Separated File For Node Attributes

The CSV file you supply must have the following syntax for adding attributes on Nodes.

Empty lines are ignored.

Lines that being with the # character are ignored.

  • Column 1(A) : Node DNS | IP Address

    Specify the DNS name of the node OR the IP address. This field is compulsory.

  • Column 2(B) : Attribute Name

    The name of the custom attribute.

  • Column 3(C) : Attribute Value

    The value of the custom attribute.

Additional attribute name and value pairs may be specified on the same line or on a separate line with the same node DNS | IP Address.

Example lines:

192.168.1.1,Location,Building Five Upper,Service Type,eCommerce

192.168.1.1,Asset Tracking,N1234

192.168.2.2,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

Syntax of Comma Separated File For Interface Attributes

The CSV file you supply must have the following syntax for adding attributes on Interfaces.

Empty lines are ignored.

Lines that being with the # character are ignored.

  • Column 1(A) : Node DNS | IP Address

    Specify the DNS name of the node OR the IP address. This field is compulsory.

  • Column 2(B) : Interface Id

    Specify the identifier of the interface on the node specified in the previous field. The value may be the interface index, alias, name or description and is searched in this same order. All matching interfaces will have the attribute(s) loaded. This field is compulsory.

  • Column 3(C) : Attribute Name

    The name of the custom attribute.

  • Column 4(D) : Attribute Value

    The value of the custom attribute.

Additional attribute name and value pairs may be specified on the same line or on a separate line with the same node DNS | IP Address and Interface Id.

Example lines:

192.168.1.1,1001,Location,Building Five Upper,Service Type,eCommerce

192.168.1.1,1001,Asset Tracking,N1234

192.168.2.2,A1,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

Syntax of Comma Separated File For PhysComp Attributes

The CSV file you supply must have the following syntax for adding attributes on PhysComps (Cards/Chassis).

Empty lines are ignored.

Lines that being with the # character are ignored.

  • Column 1(A) : Node DNS | IP Address

    Specify the DNS name of the node OR the IP address. This field is compulsory.

  • Column 2(B) : PhysComp Id

    Specify the identifier of the phys comp on the node specified in the previous field. The value may be the phys comp physical index, name or description and is searched in this same order. All matching phys comps will have the attribute(s) loaded. This field is compulsory.

  • Column 3(C) : PhysComp Type

    The name to identify the type of PhysComp. "card" and "chassis" are valid types.

  • Column 4(D) : Attribute Name

    The name of the custom attribute.

  • Column 5(E) : Attribute Value

    The value of the custom attribute.

Additional attribute name and value pairs may be specified on the same line or on a separate line with the same node DNS | IP Address, PhysComp Id, and PhysComp Type.

Example lines:

192.168.1.1,7,chassis,Location,Building Five Upper,Service Type,eCommerce

192.168.1.1,7,chassis,Asset Tracking,N1234

192.168.2.2,/AmdFE,card,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

Error Codes

There are several error codes that help identify problems:

  • INFO : information message.

  • ATTR_ERROR : A problem was found with the specified attribute.

  • DEL_FAIL_ERROR : An attempt to delete the specified attribute failed.

  • OBJECT_ERROR : The specified object was not found.

  • BAD_LINE_ERROR : The line provided is not properly formatted.

  • IO_ERROR : The CSV file was not found or is not readable.

  • BAD_NAME_WARNING : The specified attribute name is too long (50 character maximum).

  • BAD_VALUE_WARNING : The specified value is too long (2000 character maximum).

Use of Microsoft Excel

Microsoft Excel is a handy tool to create comma separated files, but .csv files do not maintain the Excel spreadsheet's column width, comments, etc. It is recommended that you store a nnmloadattributes.ovpl input file as a native .xls format, and then perform File:Save As... to create a .csv file. Then you can add Excel comments to the file, make columns wider, and you do not need to worry about escaping the comma character.

EXAMPLES

Sample node CSV file (/tmp/test.csv) contents:

192.168.2.2,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

To load the Node custom attributes from a CSV file overwriting existing values:

nnmloadattributes.ovpl -t node -f /tmp/test.csv -r true

To load a single Node custom attributes line from the command line:

nnmloadattributes.ovpl -t node -s "192.168.1.1,Project,IT Update of Building Five"

Sample interface CSV file (/tmp/test.csv) contents:

192.168.2.2,A1,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

To load the Interface custom attributes from a CSV file overwriting existing values:

nnmloadattributes.ovpl -t interface -f /tmp/test.csv -r true

To load a single Interface custom attributes line from the command line:

nnmloadattributes.ovpl -t interface -s "192.168.1.1,1001,Project,IT Update of Building Five"

Sample phys comp CSV file (/tmp/test.csv) contents:

192.168.2.2,7,chassis,Location,Fort Collins,Service Type,IT,Asset Tracking,F4321

To load the PhysComp custom attributes from a CSV file overwriting existing values:

nnmloadattributes.ovpl -t interface -f /tmp/test.csv -r true

To load a single PhysComp custom attributes line from the command line:

nnmloadattributes.ovpl -t physcomp -s "192.168.1.1,/AmdFE,card,Project,IT Update of Building Five"

AUTHOR

nnmloadattributes.ovpl was developed by Hewlett Packard Enterprise.

FILES

Windows: install_dir\bin\nnmloadattributes.ovpl

UNIX: $NNM_BIN/nnmloadattributes.ovpl

SEE ALSO

nnmdeleteattributes.ovpl (1M) , nnmloadnodegroups.ovpl (1M) , nnm.properties (4) .

Return to Reference Pages Index