Set Alias Names Using a Script

You can set aliases for monitored devices, interfaces, and components simultaneously using a script.
You can set the alias names for one or more monitored devices, interfaces, and components simultaneously using the
update_alias_name.sh
script.  The alias appears in the inventory lists for the device, interface, or component.
You can also set the alias name for a monitored device, an interface, or a component using the
devices
endpoint for the
NetOps Portal
REST web service. Alias names set from the REST web service take precedence over alias names set using the script.
For more information:
Follow these steps:
  1. From an open command prompt, access the
    <installation_directory>
    /PerformanceCenter/Tools/bin
    directory.
    /opt/CA
    is the default installation directory.
  2. Issue the following command:
    ./update_alias_name.sh
  3. Export the CSV file by issuing the following command and options:
    ./update_alias_name.sh -h <
    host_name>
    -u
    <username>
    -p <
    password>
    -T <
    item_type
    > -o <
    output_filename
    >
    • host_name
      Specifies the
      NetOps Portal
      host name.
    • username
      Specifies the username of the administrator who sets the alias names.
    • password
      Specifies the password for the
      NetOps Portal
      administrator who sets the alias names.
    • item_type
      Specifies the type of item for which you want to set alias names.
      Values:
      device, interface, component
      Default:
      device
    • (Optional)
      output_filename
      Specifies the name of the CSV file with the total number of monitored devices, interfaces, or components by item ID and device name. Use the
      -o
      option to specify to override the default file name. If you do not use this option,
      DeviceList.csv
      is used as the CSV filename.
      The CSV file has the following format:
      • (If you used the
        -T device
        option)
        device Item_ID, <device> Name
        Examples:
        • 123,MyDevice123
        • 123,MyDevice456
      • (If you used the
        -T component/interface
        option)
        device Item_ID, <interface/component> Item_ID, <interface/component> Name
        Examples:
        • 123,456,MyComponent456
        • 123,789,MyInterface789
    A list of monitored device, interface, or component item IDs and monitored device, interface, or component names is returned in CSV format.
  4. Add the alias names that you want to set for each monitored device, interface, or component to the CSV file using the following format:
    • (If you used the
      -T device
      option when you exported the CSV file)
      device Item_ID, <device> Alias Name
      For devices,
      URL
      -encode the
      Alias Name
      value, for example, URL-encode spaces as “%20”. You can use commas in the
      Alias Name
      value.
      Examples:
      • 123,MyDevice123Alias
      • 123,MyDevice456Alias
    • (If you used the
      -T component/interface
      option when you exported the CSV file)
      device Item_ID, <interface/component> Item_ID, <interface/component> Alias Name
      For interfaces and components,
      XML
      -encode the
      Alias Name
      value. XML-encode ampersands (&) as “&amp;” less-than characters (<) as “&lt;”, and greater-than characters (>) as "&gt;". You can use commas and spaces in the
      Alias Name
      value.
      Examples:
      • 123,456,MyComponent456Alias
      • 123,789,MyInterface789Alias
    If the Item IDs in your CSV file are invalid, the entries are ignored.
  5. Import the CSV file by issuing the following command and options:
    ./update_alias_name.sh -h <
    host_name>
    -u
    <username>
    -p <
    password>
    -T
    <item_type>
    -i <
    input_filename>
    (Optional) To control the workload when setting the alias names for many monitored devices, interfaces, or components, adjust the batch size and create pauses between batches by issuing the command with the following additional options:
    ./update_alias_name.sh -h <
    host_name>
    -u
    <username>
    -p <
    password>
    -T
    <item_type>
    -i <
    input_filename>
    -b <
    batch_size>
    -t <
    time_in_seconds>
    • batch_size
      Indicates the number of items to process in each batch.
      Default:
      10000
      Default with the
      -i
      option:
      150
    • time_in_seconds
      Indicates the time, in seconds, to pause between batches.
      Default:
      1
      Default with the
      -i
      option:
      1
      Example:
      ./update_alias_name.sh -h
      host_name
      -u
      username
      -p
      password
      -T device -i
      input_file
      -b 20 -t 2
    • host_name
      Specifies the
      NetOps Portal
      host name.
    • username
      Specifies the username of the administrator who sets the alias names.
    • password
      Specifies the password for the
      NetOps Portal
      administrator who sets the alias names.
    • item_type
      Specifies the type of item for which you want to set alias names.
      Values:
      device, interface, component
      Default:
      device
    • input_filename
      Specifies the name of the CSV file.
The script reads the updated CSV file and sets the alias names for the monitored devices, interfaces, or components. If you do not use the
-i
option with the command, the script locates the item IDs that are required for the specified type, and creates a CSV file with item IDs and item names.