pattern { metadata { id = "49ee7454db3894500a1d34cc7c961915" name = "ILO 2 and 3" description = "Gather data from HP ILO v2 & v3 via xmldata page." citype = "cmdb_ci_outofband_device" } identification { name = "discovery" entry_point {type = "*"} find_process_strategy {strategy = NONE} step { name = "Get XML Data" custom_operation { attributes { attribute { name = "required_authentication" value = "false" } attribute { name = "url" value = concat { "https://" get_attr {"computer_system.managementIP"} "/xmldata?item=all" } } attribute { name = "headers" value = "" } } sys_id_op = "99a9f95a9f3312003cb191aec32e70e9" to_var_names = table { name = "ilo" col_names = "type","firmware","serial","host" } parsing_strategy = xml_parsing_strategy { rootXpath = "/RIMP" fields { field { col_name = "type" xpath = "/RIMP/MP/PN/text()" delimiters = "" position = 1 } field { col_name = "firmware" xpath = "/RIMP/MP/FWRI/text()" delimiters = "" position = 1 } field { col_name = "serial" xpath = "/RIMP/MP/SN/text()" delimiters = "" position = 1 } field { col_name = "host" xpath = "/RIMP/HSI/SBSN/text()" delimiters = "" position = 1 } field { col_name = "forEach" for_each = "forEach" delimiters = "" position = 1 } } } if_not_found_do = nop {} } } step { name = "FQDN NSLOOKUP" runcmd_to_var { cmd = concat { "nslookup " get_attr {"computer_system.managementIP"} } execution_mode = "LOCAL_SCRIPT" var_names = table { name = "DnsTable" col_names = "ilofqdn" } parsing_strategy = delimited_parsing { include_lines_pattern = "Name:" delimiters = " " selected_positions = 2 } if_not_found_do = nop {} cache_flag = 0 } } step { name = "GetName" parse_var_to_var { from_var_name = "DnsTable[*].ilofqdn" to_var_names = "iloName" parsing_strategy = regex_parsing {regex = "(.*?)\\."} if_not_found_do = nop {} } } step { name = "Set PrimaryHostName" set_attr { "computer_system.primaryHostname" get_attr {"iloName"} } } step { name = "Set Values" transform { src_table_name = "ilo" target_table_name = "cmdb_ci_outofband_device" operation { set_field { field_name = "type" value = get_attr {"ilo[*].type"} } set_field { field_name = "serial_number" value = get_attr {"ilo[*].serial"} } set_field { field_name = "firmware_version" value = get_attr {"ilo[*].firmware"} } set_field { field_name = "host" value = get_attr {"ilo[*].host"} } } } } step { name = "SetName" set_attr { "cmdb_ci_outofband_device[*].name" get_attr {"iloName"} } } step { name = "Set FQDN" set_attr { "cmdb_ci_outofband_device[*].fqdn" get_attr {"DnsTable[*].ilofqdn"} } } step { name = "Set IP" set_attr { "cmdb_ci_outofband_device[*].ip_address" get_attr {"computer_system.managementIP"} } } } }