Create Custom Attributes

You can add custom attributes to items such as devices or interfaces. Populate these items using REST Web Services. Custom devices and interfaces are then available in reports, dashboards, and group rules. Custom devices, device components, and interfaces are also available for OpenAPI queries with some delay due to ETL job scheduling.
capm320
HID_Create_Custom_Attributes
You can add custom attributes to items such as devices or interfaces. Populate these items using REST Web Services. Custom devices and interfaces are then available in reports, dashboards, and group rules. Custom devices, device components, and interfaces are also available for OpenAPI queries with some delay due to ETL job scheduling.
Custom attributes for devices and interfaces appear in the Information section of the Details tabs in a context page for an item. For more information, see Context Pages.
After custom attributes are created, you cannot delete them.
Define Custom Attributes
To define custom attributes for items such as devices or interfaces, POST the XML using a REST client.
By default, the maximum number of custom attributes is 5 for string and 5 for integer for each supported item type. If you attempt to exceed the maximum number of attributes, the Data Aggregator returns an error.
Follow these steps:
  1. Set up a REST client with a connection to the Data Aggregator server.
  2. Specify the following URL:
    http://
    da_hostname
    :8581/rest/customattributedefinition
  3. POST the XML for defining your custom attributes.
    The following example defines a
    CustomerID
    attribute for all devices.
    <CustomAttributeDefinition version='1.0.0'>
       <Label>Customer ID #</Label>
       <Description>Customer account number</Description>
       <Hidden>true</Hidden>
       <Storage>
          <AttributeName>CustomerID</AttributeName>
          <Type>String</Type>
          <ItemType>Device</ItemType>
       </Storage>
    </CustomAttributeDefinition>
    • <Label>
      Specify a label that can be displayed in the
      Performance Center
      user interface for the custom attribute.
      Limit:
      64 characters
    • <Hidden>
      Specify whether to hide the property by default from the
      Performance Center
      user interface. If this tag is set to "true," you can manually display the custom attribute in the user interface. This tag impacts whether custom attributes appear by default in the
      Performance Center
      user interface only. They are available by default in other areas, such as the OpenAPI QueryBuilder.
      Default:
      "true"
      If this tag is set to "true", custom attributes are hidden from context pages and cannot be manually shown in the user interface. If you want custom attributes to appear on context pages, you must set this tag to "false."
    • <Description>
      Specify a description for the attribute.
    • <AttributeName>
      Specify an internal reference name for the custom attribute. Use this name to set a value for the custom attribute in the following procedure.
      Limit:
      26 characters
    • <Type>
      Specify whether the custom attribute is a string or an integer.
      Valid entries:
      "String" and "Integer"
    • <Item Type>
      Specify whether the custom attribute is for a device, component, or interface ("Port")
      .
      Valid entries:
      "Device", "DeviceComponent", and "Port"
      Custom device component attributes are available only for OpenAPI queries with some delay due to ETL job scheduling. They are
      not
      available in reports, dashboards, and group rules.
    The POST returns an ID for the definition of the custom attribute.
Set Values for Custom Attributes
To set values for your custom attributes, PUT the XML using a REST client.
Follow these steps:
  1. Specify one of the following URLs:
    • http://
      da_hostname
      :8581/rest/
      devices
      /customattributes/
      itemID
    • http://
      da_hostname
      :8581/rest/
      devices/components
      /customattributes/
      itemID
    • http://
      da_hostname
      :8581/rest/
      ports
      /customattributes/
      itemID
      • devices
        If the custom attributes are for devices, specify this item type in your URL.
      • devices/components
        If the custom attributes are for device components, specify this item type in your URL.
      • ports
        If the custom attributes are for interfaces, specify this item type in your URL.
      • itemID
        Specify the device or interface ID.
  2. PUT the XML for setting your custom attributes.
    String attributes support up to 255 characters. Integer attributes support up to 64-bit integers.
    The following example sets the
    CustomerID
    attribute from the previous example.
    <DeviceCustomAttributes version='1.0.0'>
         <CustomerID>
    CustomAttributeValue
    </CustomerID>
    </DeviceCustomAttributes>
    The following example sets the custom attributes for a device component:
    <DeviceComponentCustomAttributes version='1.0.0'>
         <
    AttributeName
    >
    CustomAttributeValue
    </
    AttributeName
    >
    </DeviceComponentCustomAttributes>
    The following example sets the custom attributes for a port:
    <PortCustomAttributes version='1.0.0'>
         <
    AttributeName
    >
    CustomAttributeValue
    </
    AttributeName
    >
    </PortCustomAttributes>
Change the Maximum Custom Attributes
By default, the maximum number of custom attributes is 5 for string and 5 for integer for each supported item type. However, you can increase or decrease these values.
Consider the performance impact of increasing the maximum number of custom attributes for each supported item type. For example, the
Performance Center
user interface allows only a defined number of custom attributes to display. We recommend that you avoid exceeding a maximum of 30 attributes total for string and integer combined.
Follow these steps:
  1. Create the following file:
    DA_install_directory
    /apache-karaf-
    version
    /etc/com.ca.im.item.custattr.CustAttrColumnCache.cfg
  2. Add new limits.
    Example:
    MaxStringColumnsPerItemType=7
    MaxIntegerColumnsPerItemType=2
    A message appears logged in the
    karaf.log
    file.
    Example:
    INFO | AttrColumnCache) | 2016-07-29 09:46:34,464 | CustAttrColumnCache | tem.custattr.CustAttrColumnCache 80 | ository.webservices.impl | | Max Integer custom attributes per item type:2
    INFO | AttrColumnCache) | 2016-07-29 09:46:34,465 | CustAttrColumnCache | tem.custattr.CustAttrColumnCache 93 | ository.webservices.impl | | Max String custom attributes per item type:7