<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=1110556&amp;fmt=gif">
Skip to content
    February 16, 2022

    How to Use the For-Each Feature with DX Unified Infrastructure Management’s Monitoring Configuration Service

    For-Each is a new feature added to the DX Unified Infrastructure Management’s (DX UIM) Monitoring Configuration Service (MCS) that uses the device attributes with one or multiple values. MCS will loop through each value and create a profile for each one. If that attribute does not exist for a device, no profile will be created. Similarly, if a new value is added or removed from a device, MCS will revaluate and add or remove profiles.

    There are two kinds of device attributes, one is defined as part of the niscache for all computer systems controlled by the discovery server. The other type of attribute is known as a device custom attribute; both types of device attributes are available for the users to create and use.

    A good example of when to use For-Each is for database instances. It is common to have multiple instances running on the same database server. With For-Each, you can define the name of each instance under the same device attribute and use it in a group or device profile.

    In this example, we created a custom attribute: mssqlinstances. We have two devices in a group, each device has the mssqlinstance attribute defined, and one has two instances while the other has three. Now we are going to create a group profile using the For-Each option.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 1

    It is important to note the For-Each option is not available for all templates. The template must require a profile name as the value of your chosen attribute is written to the profile name to differentiate them from each other.

    As shown below, to use the For-Each we need to set “Enable” to “Yes.” Now, give the For-Each Group profile a name in the “For-Each Value Of” drop-down. Select the device attribute from the list; in this example, we are using an MCS device custom attribute created in the “MCS Device Custom Attributes” section with the list of MS SQL Server instances “device.mssqlinstances.” You can also use the “Matching Expression” to filter that list even further, but for this example we don’t need to.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 2

    Now that the For-Each set up is complete, you need to associate the For-Each value to the SQL Server profile name. This value will always be {foreach-instance}. MCS will substitute the profile name with each different value it finds in the custom attribute you set up. If you need to use that same value in the profile itself, you can use {profilename}, as this is now set with that value. In the Server Name field we can use two variables, {device.ip} and the instance name which is now the {profilename}, and format this like {device.ip}\{profilename} as shown below.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 3

    For this example, one group profile has created five profiles over two devices as shown below.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 4

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 5

    If we look at one device profile below, you will see the actual values used from the attributes:

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 6

    If we look at the probe UI, you can see it is configured as we wanted.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 7

    MCS Device Custom Attributes

    One of the existing features in MCS, now exposed in 20.3.x and later, is the ability to define device custom attributes and allow MCS to use these in the profile. Each device can have a different value but the same named custom attribute. MCS will use the value defined for each device. This allows you to create group profile where the value of a field is different for every device in that group, whereas before you would have to create single profile for each device.

    Some useful device attributes are always present for you to use in profiles. These are:

    • {device.name}
    • {device.ipaddress}
    • {device.usertag1}
    • {device.usertag2}
    • {device.origin}
    • {device.os_type}

    Note: To reference these values in a profile they must be enclosed in curly brackets {}

    Creating device custom attributes is done using the uimapi (RESTful), wherein you update the device but also must supply all values every time. Not supplying an attribute will delete it, supplying a different value to an attribute will change it, and supplying a new attribute will add it.

    Any RESTful tool can be used to GET the device and PUT the updates to the device. There is also a swagger page to use:

    http://<hostname>:<port>/uimapi/swagger-ui.html

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 8

    Select the deviceoperations and GET / deviceoperations/{identifier}, Try it out. Enter the device name and choose the lookup by_name then Execute.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 9

    The device is returned

    <device>
      <robot>true</robot>
      <cs_id>42</cs_id>
      <device_id>27</device_id>
      <csdev_id>DCD1958D97E7FB11CE163EBC76D1E9B5E</csdev_id>
      <name>lvndev014756</name>
      <status>OK</status>
      <origin>BCRMUSA</origin>
      <os_type>Windows</os_type>
      <nimbus_type>1</nimbus_type>
      <ip>10.74.137.116</ip>
      <cs_type>A</cs_type>
      <customAttribute>
         <id>0</id>
         <name>device.name</name>
         <scope>default</scope>
         <discovered>true</discovered>
         <encrypted>true</encrypted>
         <lastModified>0</lastModified>
         <value>lvndev014756</value>
         <device_Id>27</device_Id>
         </customAttribute>

    </device>

    Copy the entire output and add your own custom attributes at the bottom before the </device>.

    For the “foreach” example, we will create one mssqlinstance device custom attribute with two values (instance names). You can have as many as you want for each attribute:

      <customAttribute>
         <id>120</id>
         <name>mssqlinstance</name>
         <scope>default</scope>
         <discovered>true</discovered>
         <encrypted>true</encrypted>
         <lastModified>0</lastModified>
         <value>MSSQLSERVER</value>
         <value>VALIDATION</value>
         <device_Id>27</device_Id>
      </customAttribute>

    Note: everything you send overwrites the device attributes, so changing or omitting values or entire attributes will be updated for that device.

    Using the Swagger page, select the “deviceoperations” and PUT / deviceoperations/{identifier}, Try it out. Enter the device name and choose the lookup by_name, paste the entire GET device output with your new device custom attribute(s), then Execute.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 10

    Note: this should get a 204 return code

    Application Discovery

    The Application Discovery feature in UIM allows you to create your own device attributes, which are written to the niscache on the local device and read by the discovery_server probe and saved in the CM_COMPUTER_SYSTEM_ATTR table associated with that device. Using the example of database instances, you could write an application discovery script that queries each database server for every instance and creates a device attribute. The device attribute name must be the same but you can have multiple instances of the same attribute with different values.

    Using the same example, we have two database servers, one with two instances and the other with three. The output of the application discovery script is shown below.

    Database server 1:

    instanceName=MSSQLSERVER
    instanceName=VALIDATION

    Database server 2:

    instanceName=MSSQLSERVER
    instanceName=VALIDATION
    instanceName=DEVELOPMENT

    These will be written to the CM_COMPUTER_SYSTEM_ATTR table as UserPropMV.{application discovery script name}.{attribute name}, so in this example for Database Server 1:

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 11

    Your device attribute will appear in the “For-Each Value Of” drop-down list for you to use:

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 12

    Details on creating custom scripts for application discovery can be found here.

    ESD_FY22_Academy-Blog.How to Use the For-Each Feature with the UIM Monitoring Configuration Service.Figure 13

    For more resources on infrastructure management, visit the DX UIM page on Broadcom’s Enterprise Software Academy.

    Tag(s): AIOps , DX UIM

    Steve D'Arcy

    Steve D’Arcy is one of Broadcom’s trusted advisors, learning about the challenges customers face and helping overcome them to ensure customers’ business goals are met. He has worked with unified infrastructure management since 2010, and during this time has collaborated closely with engineering and field operations to...

    Other posts you might be interested in

    Explore the Catalog
    icon
    Blog November 4, 2024

    Unlocking the Power of UIMAPI: Automating Probe Configuration

    Read More
    icon
    Blog October 4, 2024

    Capturing a Complete Topology for AIOps

    Read More
    icon
    Blog October 4, 2024

    Fantastic Universes and How to Use Them

    Read More
    icon
    Blog September 26, 2024

    DX App Synthetic Monitor (ASM): Introducing Synthetic Operator for Kubernetes

    Read More
    icon
    Blog September 16, 2024

    Streamline Your Maintenance Modes: Automate DX UIM with UIMAPI

    Read More
    icon
    Blog September 16, 2024

    Introducing The eBPF Agent: A New, No-Code Approach for Cloud-Native Observability

    Read More
    icon
    Blog September 6, 2024

    CrowdStrike: Are Regulations Failing to Ensure Continuity of Essential Services?

    Read More
    icon
    Blog August 28, 2024

    Monitoring the Monitor: Achieving High Availability in DX Unified Infrastructure Management

    Read More
    icon
    Blog August 27, 2024

    Topology for Incident Causation and Machine Learning within AIOps

    Read More