cfxdm - dm:map
dm:map: This cfxdm tag allows the user to manipulate or transform the columns and it's values.
Below are some of the operations you can perform using this tag.
    Copy the Column X along with it's values as is and create a new Column Y
    Transform values from a Column to something else using 'functions' based on user's requirement
dm:map syntax:
    dm:map from = 'COLUMN_X' & to = 'COLUMN_Y'
OR
    dm:map attr = 'COLUMN_Y' & func = "<function-name>" & <argument syntax>
Note: Only single 'func' is supported per dm:map tag usage.
In the below example, for a reference, we are going to use VMware vROps as an extension to query the data and ingest it into dm:map tag for data manipulation or transformation using cfxdm functions.
Enter the below command to select VMware vROps VM Summary tag (*vrops:vm_summary). (In this example, vrops name is used as a label to identify VMware vROps extension and it's tags. The label is defined while adding the extension in cfxdx configuration file or through UI.)
1
tag *vrops:vm_summary
Copied!
Example 1: Clone the Column (copy)
Get the data from VMware vROps VM Summary tag (*vrops:vm_summary) which includes some of the below columns, clone the column 'guest_full_name' to 'guest_os_type'.
Column Names:
    guest_hostname
    guest_ip_address
    guest_full_name
    datastore
    .....
1
data --> @dm:map from = 'guest_full_name' & to = 'guest_os_type'
Copied!
Example 2: Clone the Column (copy) & Transform the data with function 'evaluate' (simple 'if' and 'else' condition using a python expression)
Get the data from VMware vROps VM Summary tag (*vrops:vm_summary) which includes some of the below columns, clone the column 'guest_full_name' to 'guest_os_type' and transform the values (data) within the 'guest_os_type' based on the existing value.
If column guest_os_type's value contains 'Microsoft Windows', transform it to 'Windows', else keep the existing value.
Column Names:
    guest_full_name (from)
    guest_os_type (to)
Column Values: (some of them)
    Microsoft Windows Server 2008 R2 (64-bit) --> Transform to 'Windows'
    CentOS 4/5/6/7 (64-bit)
    Red Hat Enterprise Linux 7 (64-bit)
In the below syntax, @dm:map is used twice, 1st step is to clone the column to new column and 2nd step is to transform the values on cloned column.
1
data --> @dm:map from = 'guest_full_name' & to = 'guest_type' --> @dm:map attr = 'guest_type' & func = 'evaluate' & expr = "'Windows' if 'Microsoft Windows' in guest_type else guest_type"
Copied!
Example 3: Clone the Column (copy) & Transform the data with function 'evaluate' (using multiple 'if' and 'else' conditions using a python expression)
Get the data from VMware vROps VM Summary tag (*vrops:vm_summary) which includes some of the below columns, clone the column 'guest_full_name' to 'guest_os_type' and transform the values (data) within the 'guest_os_type' based on the existing value.
If column guest_os_type's value contains 'Microsoft Windows', transform it to 'Windows', else keep the existing value.
Column Names:
    guest_full_name (from)
    guest_os_type (to)
Column Values: (some of them)
    Microsoft Windows Server 2008 R2 (64-bit) --> Transform to 'Windows'
    CentOS 4/5/6/7 (64-bit) --> Transform to 'Linux OS Opensource'
    Red Hat Enterprise Linux 7 (64-bit) --> Transform to 'Linux OS Commercial'
1
data --> @dm:map from = 'guest_full_name' & to = 'guest_type' --> @dm:map attr = 'guest_type' & func = 'evaluate' & expr = "'Windows' if 'Microsoft Windows' in guest_type else 'Linux OS Opensource' if 'CentOS' in guest_type else 'Linux OS Commercial' if 'Red Hat Enterprise' in guest_type else 'Other OS'"
Copied!
Last modified 7mo ago
Copy link