name
stringlengths 3
72
| description
stringlengths 141
229
| ci_type
stringlengths 11
38
| pattern_type
stringclasses 4
values | pattern
stringlengths 196
32k
| pattern_commented
stringlengths 393
48.2k
|
---|---|---|---|---|---|
Active Directory Domain Controller On Windows | I would like for you to help me build a Pattern that helps achieve Discovery of Active Directory Domain Controller On Windows. \n CI Type: cmdb_ci_ad_controller\nPattern Type: 1 - Application | cmdb_ci_ad_controller | 1 - Application | pattern {
metadata {
id = "28d607dbfead4be3887c843814451003"
name = "Active Directory Domain Controller On Windows"
description = ""
citype = "cmdb_ci_ad_controller"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification for LDAP"
entry_point {type = "cmdb_ci_endpoint_ldap,cmdb_ci_endpoint_tcp"}
find_process_strategy {strategy = NONE}
step {
name = "verify running port"
ref {refid = "62bd12e7872c422b8462fc0036c8cd67"}
}
step {
name = "get short host name"
if {
condition = neq {
get_attr {"entry_point.host_name"}
get_attr {"computer_system.primaryManagementIP"}
}
on_true = parse_var_to_var {
from_var_name = "entry_point.host_name"
to_var_names = "short_hostname"
parsing_strategy = delimited_parsing {
delimiters = "."
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "set short name if empty"
if {
condition = is_empty {get_attr {"short_hostname"}}
on_true = runcmd_to_var {
cmd = "hostname"
var_names = "short_hostname"
parsing_strategy = delimited_parsing {
selected_positions = 1
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "create WMI query"
set_attr {
"WMI_query"
"Select * from Win32_NTDomain"
}
}
step {
name = "Get Domain and forest details"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = get_attr {"WMI_query"}
var_names = table {
name = "Win32_NTDomain"
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "filter NT domains"
filter {
src_table_name = "Win32_NTDomain"
target_table_name = "Win32_NTDomain"
condition = any {
starts_with {
concat {
"\\\\"
get_attr {"entry_point.ip_address"}
}
get_attr {"Win32_NTDomain[].DomainControllerAddress"}
}
eq {
get_attr {"Win32_NTDomain[].DomainControllerName"}
concat {
"\\\\"
get_attr {"entry_point.host_name"}
}
}
eq {
get_attr {"Win32_NTDomain[].DomainControllerName"}
concat {
"\\\\"
get_attr {"short_hostname"}
}
}
eq {
get_attr {"Win32_NTDomain[].DnsForestName"}
get_attr {"entry_point.host_name"}
}
}
}
}
step {
name = "parse hostname (remove backslashes)"
parse_var_to_var {
from_var_name = "Win32_NTDomain[*].DomainControllerName"
to_var_names = table {
name = "DomainControllerNames"
col_names = "name"
}
parsing_strategy = regex_parsing {regex = "\\\\\\\\(\\S+)"}
if_not_found_do = nop {}
}
}
step {
name = "parse ip (remove backslashes) step"
parse_var_to_var {
from_var_name = "Win32_NTDomain[*].DomainControllerAddress"
to_var_names = table {
name = "DomainControllerAddresses"
col_names = "ip"
}
parsing_strategy = regex_parsing {regex = "\\\\\\\\(\\S+)"}
if_not_found_do = nop {}
}
}
step {
name = "populate dc name"
set_attr {
"domain_controller_name"
get_attr {"DomainControllerNames[1].name"}
}
}
step {
name = "populate forest name"
set_attr {
"forest_name"
get_attr {"Win32_NTDomain[1].DnsForestName"}
}
}
step {
name = "populate domain name"
set_attr {
"domain_name"
get_attr {"Win32_NTDomain[1].DomainName"}
}
}
step {
name = "sets the display label"
set_attr {
"name"
get_attr {"Win32_NTDomain[1].DomainName"}
}
}
step {
name = "Check Mandatory Attributes"
match {
all {
is_not_empty {get_attr {"domain_name"}}
is_not_empty {get_attr {"domain_controller_name"}}
is_not_empty {get_attr {"forest_name"}}
}
terminate_op = terminate
}
}
}
connection {
name = "connection to child forest"
step {
name = "Get domains from system"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = get_attr {"WMI_query"}
var_names = table {
name = "Win32_NTDomain"
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "filter entries by parent forest name"
filter {
src_table_name = "Win32_NTDomain"
target_table_name = "Win32_NTDomain_CF"
condition = eq {
get_attr {"Win32_NTDomain[].DnsForestName"}
get_attr {"forest_name"}
}
}
}
step {
name = "add domain name to forest"
transform {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
operation {set_field {
field_name = "ChildDomain"
value = concat {
get_attr {"Win32_NTDomain_CF[].DomainName"}
"."
get_attr {"entry_point.host"}
}
}}
}
}
step {
name = "get nslookup"
transform {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
operation {set_field {
field_name = "nslookup"
value = concat {eval {"
import com.snc.sw.kb.lang.commands.ExecutionMode;
def cmd = \"nslookup \"+${Win32_NTDomain_CF[].ChildDomain};
return ctx.getCommandManager().shellCommand(cmd, false, ExecutionMode.LOCAL_SCRIPT, null, ctx);
"}}
}}
}
}
step {
name = "filter not existing domains"
filter {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
condition = all {
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"Non-existent domain"
}
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"timeout"
}
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"Non-authoritative answer"
}
}
}
}
step {
name = "create connection"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = ""
entry_point_type = "cmdb_ci_endpoint_ldap"
attributes {
attribute {
name = "host"
value = get_attr {"Win32_NTDomain_CF[*].ChildDomain"}
}
attribute {
name = "port"
value = "389"
}
attribute {
name = "protocol"
value = "ldap"
}
attribute {
name = "type"
value = ""
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "connections to AD services"
step {
name = "get all services"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = "SELECT * FROM Win32_Service"
var_names = table {
name = "Win32_Service"
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "filter AD services"
filter {
src_table_name = "Win32_Service"
target_table_name = "Win32_Service"
condition = any {
eq {
get_attr {"Win32_Service[].DisplayName"}
"DNS Client"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Distributed File System"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"DNS Server"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"DFS Replication"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Intersite Messaging"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Kerberos Key Distribution Center"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Windows Time"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Security Accounts Manager"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Server"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Workstation"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Remote Procedure Call (RPC)"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Net Logon"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Active Directory Domain Services"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Active Directory Web Services"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"LDAP Active Threads"
}
}
}
}
step {
name = "create connections"
create_connection {
connection_type = INCLUSION
target_ci_type = "cmdb_ci_appl_active_directory"
entry_point_type = "cmdb_ci_endpoint_ad_service_in"
attributes {
attribute {
name = "domain"
value = get_attr {"domain_name"}
}
attribute {
name = "name"
value = get_attr {"Win32_Service[*].DisplayName"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
}
| pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "28d607dbfead4be3887c843814451003" // Unique identifier for the pattern
name = "Active Directory Domain Controller On Windows"
description = "" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_ad_controller"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification for LDAP"
entry_point {type = "cmdb_ci_endpoint_ldap,cmdb_ci_endpoint_tcp"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "verify running port"
ref {refid = "62bd12e7872c422b8462fc0036c8cd67"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get short host name"
if {
condition = neq {
get_attr {"entry_point.host_name"}
get_attr {"computer_system.primaryManagementIP"}
}
on_true = parse_var_to_var {
from_var_name = "entry_point.host_name"
to_var_names = "short_hostname"
parsing_strategy = delimited_parsing {
delimiters = "."
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set short name if empty"
if {
condition = is_empty {get_attr {"short_hostname"}}
on_true = runcmd_to_var {
cmd = "hostname"
var_names = "short_hostname"
parsing_strategy = delimited_parsing {
selected_positions = 1
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create WMI query"
set_attr {
"WMI_query"
"Select * from Win32_NTDomain"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get Domain and forest details"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = get_attr {"WMI_query"}
var_names = table {
name = "Win32_NTDomain"
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter NT domains"
filter {
src_table_name = "Win32_NTDomain"
target_table_name = "Win32_NTDomain"
condition = any {
starts_with {
concat {
"\\\\"
get_attr {"entry_point.ip_address"}
}
get_attr {"Win32_NTDomain[].DomainControllerAddress"}
}
eq {
get_attr {"Win32_NTDomain[].DomainControllerName"}
concat {
"\\\\"
get_attr {"entry_point.host_name"}
}
}
eq {
get_attr {"Win32_NTDomain[].DomainControllerName"}
concat {
"\\\\"
get_attr {"short_hostname"}
}
}
eq {
get_attr {"Win32_NTDomain[].DnsForestName"}
get_attr {"entry_point.host_name"}
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse hostname (remove backslashes)"
parse_var_to_var {
from_var_name = "Win32_NTDomain[*].DomainControllerName"
to_var_names = table {
name = "DomainControllerNames"
col_names = "name"
}
parsing_strategy = regex_parsing {regex = "\\\\\\\\(\\S+)"}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse ip (remove backslashes) step" // Step definition: Represents a single action or set of actions in the pattern
parse_var_to_var {
from_var_name = "Win32_NTDomain[*].DomainControllerAddress"
to_var_names = table {
name = "DomainControllerAddresses"
col_names = "ip"
}
parsing_strategy = regex_parsing {regex = "\\\\\\\\(\\S+)"}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "populate dc name"
set_attr {
"domain_controller_name"
get_attr {"DomainControllerNames[1].name"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "populate forest name"
set_attr {
"forest_name"
get_attr {"Win32_NTDomain[1].DnsForestName"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "populate domain name"
set_attr {
"domain_name"
get_attr {"Win32_NTDomain[1].DomainName"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "sets the display label"
set_attr {
"name"
get_attr {"Win32_NTDomain[1].DomainName"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check Mandatory Attributes"
match {
all {
is_not_empty {get_attr {"domain_name"}}
is_not_empty {get_attr {"domain_controller_name"}}
is_not_empty {get_attr {"forest_name"}}
}
terminate_op = terminate
}
}
}
connection {
name = "connection to child forest"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get domains from system"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = get_attr {"WMI_query"}
var_names = table {
name = "Win32_NTDomain"
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter entries by parent forest name"
filter {
src_table_name = "Win32_NTDomain"
target_table_name = "Win32_NTDomain_CF"
condition = eq {
get_attr {"Win32_NTDomain[].DnsForestName"}
get_attr {"forest_name"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "add domain name to forest"
transform {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
operation {set_field {
field_name = "ChildDomain"
value = concat {
get_attr {"Win32_NTDomain_CF[].DomainName"}
"."
get_attr {"entry_point.host"}
}
}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get nslookup"
transform {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
operation {set_field {
field_name = "nslookup"
value = concat {eval {"
import com.snc.sw.kb.lang.commands.ExecutionMode;
def cmd = \"nslookup \"+${Win32_NTDomain_CF[].ChildDomain};
return ctx.getCommandManager().shellCommand(cmd, false, ExecutionMode.LOCAL_SCRIPT, null, ctx);
"}}
}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter not existing domains"
filter {
src_table_name = "Win32_NTDomain_CF"
target_table_name = "Win32_NTDomain_CF"
condition = all {
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"Non-existent domain"
}
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"timeout"
}
not_contains {
get_attr {"Win32_NTDomain_CF[].nslookup"}
"Non-authoritative answer"
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create connection"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = ""
entry_point_type = "cmdb_ci_endpoint_ldap"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"Win32_NTDomain_CF[*].ChildDomain"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = "389"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "protocol"
value = "ldap"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "type"
value = ""
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "connections to AD services"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get all services"
run_wmi_query_to_var {
namespace = "\\root\\CIMV2"
query = "SELECT * FROM Win32_Service"
var_names = table {
name = "Win32_Service"
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter AD services"
filter {
src_table_name = "Win32_Service"
target_table_name = "Win32_Service"
condition = any {
eq {
get_attr {"Win32_Service[].DisplayName"}
"DNS Client"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Distributed File System"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"DNS Server"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"DFS Replication"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Intersite Messaging"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Kerberos Key Distribution Center"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Windows Time"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Security Accounts Manager"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Server"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Workstation"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Remote Procedure Call (RPC)"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Net Logon"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Active Directory Domain Services"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"Active Directory Web Services"
}
eq {
get_attr {"Win32_Service[].DisplayName"}
"LDAP Active Threads"
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create connections"
create_connection {
connection_type = INCLUSION
target_ci_type = "cmdb_ci_appl_active_directory"
entry_point_type = "cmdb_ci_endpoint_ad_service_in"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "domain"
value = get_attr {"domain_name"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "name"
value = get_attr {"Win32_Service[*].DisplayName"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
}
|
Agility Process | I would like for you to help me build a Pattern that helps achieve Discovery of Agility Process. \n CI Type: cmdb_ci_agility_process\nPattern Type: 1 - Application | cmdb_ci_agility_process | 1 - Application | pattern {
metadata {
id = "68f1e3ad4ff26688998891311310c7e9"
name = "Agility Process"
description = ""
citype = "cmdb_ci_agility_process"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification of Agility"
entry_point {type = "cmdb_ci_endpoint_agility"}
find_process_strategy {strategy = NONE}
step {
name = "verify agility"
match {
any {
contains {
get_attr {"entry_point.install_dir"}
"AGILITY.exe"
}
contains {
get_attr {"entry_point.install_dir"}
"Admin.exe"
}
}
terminate_op = terminate
}
}
step {
name = "set install dir"
parse_var_to_var {
from_var_name = "entry_point.install_dir"
to_var_names = "install_dir"
parsing_strategy = delimited_parsing {
delimiters = "\\AGILITY.exe"
selected_positions = 1
}
if_not_found_do = nop {}
}
}
step {
name = "set name"
set_attr {
"name"
"Agility Process"
}
}
}
connection {
name = "Create agility Conns"
step {
name = "extract urls"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"entry_point.install_dir"}
".config"
}
foreach_attribute_name = "forEach"
}
var_names = table {
name = "http_conns"
col_names = "url"
}
parsing_strategy = xml_parsing_strategy {
rootXpath = "/configuration"
fields {
field {
col_name = "url"
xpath = "/configuration/system.serviceModel/client/endpoint/@address"
delimiters = ""
position = 1
}
field {
col_name = "forEach"
for_each = "forEach"
delimiters = ""
position = 1
}
}
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "parse urls"
parse_url_to_var {
from_var_name = "http_conns[*].url"
to_var_name = "http_conns"
if_not_found_do = nop {}
}
}
step {
name = "create http conns"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = ""
entry_point_type = "cmdb_ci_endpoint_http"
attributes {
attribute {
name = "host_name"
value = get_attr {"http_conns[*].host"}
}
attribute {
name = "url"
value = get_attr {"http_conns[*].url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
}
| pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "68f1e3ad4ff26688998891311310c7e9" // Unique identifier for the pattern
name = "Agility Process"
description = "" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_agility_process"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification of Agility"
entry_point {type = "cmdb_ci_endpoint_agility"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "verify agility"
match {
any {
contains {
get_attr {"entry_point.install_dir"}
"AGILITY.exe"
}
contains {
get_attr {"entry_point.install_dir"}
"Admin.exe"
}
}
terminate_op = terminate
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set install dir"
parse_var_to_var {
from_var_name = "entry_point.install_dir"
to_var_names = "install_dir"
parsing_strategy = delimited_parsing {
delimiters = "\\AGILITY.exe"
selected_positions = 1
}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set name"
set_attr {
"name"
"Agility Process"
}
}
}
connection {
name = "Create agility Conns"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "extract urls"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"entry_point.install_dir"}
".config"
}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = table {
name = "http_conns"
col_names = "url"
}
parsing_strategy = xml_parsing_strategy {
rootXpath = "/configuration"
fields {
field {
col_name = "url"
xpath = "/configuration/system.serviceModel/client/endpoint/@address"
delimiters = ""
position = 1
}
field {
col_name = "forEach"
for_each = "forEach"
delimiters = ""
position = 1
}
}
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse urls"
parse_url_to_var {
from_var_name = "http_conns[*].url"
to_var_name = "http_conns"
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create http conns"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = ""
entry_point_type = "cmdb_ci_endpoint_http"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host_name"
value = get_attr {"http_conns[*].host"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"http_conns[*].url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
}
|
Rubrik AIX Host (LP) | I would like for you to help me build a Pattern that helps achieve Discovery of Rubrik AIX Host (LP). \n CI Type: cmdb_ci_aix_server\nPattern Type: 4 - Cloud Resource | cmdb_ci_aix_server | 4 - Cloud Resource | pattern {
metadata {
id = "74c7ea442ff2e4d03550d7492799b635"
name = "Rubrik AIX Host (LP)"
description = "Rubrik AIX Host (LP)"
citype = "cmdb_ci_aix_server"
}
identification {
name = "Rubrik AIX Host identification"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step {
name = "Set IP as host"
if {
condition = is_not_empty {get_attr {"cmdb_ci_rubrik_cluster[1].comments"}}
on_true = set_attr {
"host"
get_attr {"cmdb_ci_rubrik_cluster[1].comments"}
}
on_false = nop {}
}
}
step {
name = "Set credential alias"
if {
condition = is_not_empty {get_attr {"cmdb_ci_rubrik_cluster[1].attributes"}}
on_true = set_attr {
"credential_alias"
get_attr {"cmdb_ci_rubrik_cluster[1].attributes"}
}
on_false = nop {}
}
}
step {
name = "Get Hosts"
if {
condition = is_not_empty {get_attr {"host"}}
on_true = custom_operation {
attributes {
attribute {
name = "rubrik_url"
value = concat {
"https://"
get_attr {"host"}
}
}
attribute {
name = "resource"
value = "host?primary_cluster_id=local&operating_system_type=UnixLike"
}
attribute {
name = "session_auth"
value = "false"
}
attribute {
name = "headers"
value = ""
}
attribute {
name = "response_name"
value = "aix_response"
}
}
sys_id_op = "bbd60d30db9b5410052464d74896192f"
to_var_names = "SystemVariable"
parsing_strategy = empty_strategy {}
if_not_found_do = nop {}
is_paginated = 1
}
on_false = nop {}
}
}
step {
name = "Parse Hosts"
if {
condition = is_not_empty {get_attr {"aix_response"}}
on_true = custom_operation {
attributes {
attribute {
name = "source"
value = "aix_response"
}
attribute {
name = "source_column"
value = ""
}
attribute {
name = "table_name"
value = "aix_details"
}
attribute {
name = "target_columns"
value = "host_id:data.id, host_init_name:data.name, hostname:data.hostname, cl_id:data.primaryClusterId, host_os:data.operatingSystem, host_os_type:data.operatingSystemType, host_status:data.status, vendor_type:data.nasBaseConfig.vendorType"
}
}
sys_id_op = "eb6ef2e353a533003e76ddeeff7b124d"
to_var_names = "SystemVariable"
parsing_strategy = empty_strategy {}
if_not_found_do = nop {}
is_paginated = 0
}
on_false = nop {}
}
}
step {
name = "Filter AIX hosts"
if {
condition = is_not_empty {get_attr {"aix_details[1].host_os_type"}}
on_true = filter {
src_table_name = "aix_details"
target_table_name = "aix_details"
condition = any {
contains {
get_attr {"aix_details[].host_os_type"}
"AIX"
}
contains {
get_attr {"aix_details[].host_os_type"}
"aix"
}
}
}
on_false = nop {}
}
}
step {
name = "Check if there are hosts"
match {
is_not_empty {get_attr {"aix_details"}}
terminate_op = graceful
terminate_msg = "No AIX hosts found, terminating the pattern"
}
}
step {
name = "Resolve hostname"
if {
condition = is_not_empty {get_attr {"aix_details[1].hostname"}}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "pure_host_name"
value = eval {"javascript: var rslt;
var rtrn;
var init = ${aix_details[].hostname} + '';
var domain = ${shouldIncludeDomain};
var lowerCase = ${hostnameCase};
var ip_rgx = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
try {
if (init && init.match(ip_rgx)) {
rslt = Packages.com.snc.sw.util.DNSUtils.reverseDns(init);
rtrn = rslt;
}
else if (init && init.indexOf('.') > -1 && domain != 'true'){
rtrn = init.split('.')[0];
}
else if (init && domain == 'true' && init.indexOf('.') > -1){
rtrn = init;
}
else {
rtrn = init;
}
if (rtrn && lowerCase !== 'Lower case'){
rtrn = rtrn.toUpperCase();
}
else if (rtrn && lowerCase == 'Lower case'){
rtrn = rtrn.toLowerCase();
}
} catch(e) {
e.getMessage();
}
rtrn += '';"}
}}
}
on_false = nop {}
}
}
step {
name = "Remove unresolved IPs"
if {
condition = is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
on_true = filter {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
condition = eq {
get_attr {"aix_details_resolved[].pure_host_name"}
eval {"javascript: var rtrn;
var init = ${aix_details_resolved[].pure_host_name};
var ip_rgx = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
if (init && !init.match(ip_rgx)) {
rtrn = init;
}
else{
rtrn = '';
}
rtrn;"}
}
}
on_false = nop {}
}
}
step {
name = "Validate final hostname"
if {
condition = is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "pure_host_name"
value = eval {"javascript: var rtrn;
var init = ${aix_details_resolved[].pure_host_name};
try {
if (init && init.indexOf('.') > -1){
rtrn = init.split('.')[0];
}
else {
rtrn = init;
}
} catch(e) {
e.getMessage();
}
rtrn;"}
}}
}
on_false = nop {}
}
}
step {
name = "Convert hostname to FQDN"
if {
condition = all {
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "fqdn_name"
value = eval {"import com.snc.sw.kb.lang.commands.ExecutionMode;
try {
def cmd = \"nslookup \" + ${aix_details_resolved[].pure_host_name};
def res = ctx.getCommandManager().shellCommand(cmd, false, ExecutionMode.LOCAL_SCRIPT, null, ctx);
return res;
}
catch (Exception e) {
return e;
}"}
}}
}
on_false = nop {}
}
}
step {
name = "Populate hostname if domain true"
if {
condition = all {
is_not_empty {get_attr {"aix_details_resolved"}}
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "host_name"
value = eval {"javascript: var rtrn = '';
var fqdnOut = ${aix_details_resolved[].fqdn_name};
match = /[nN]ame *[=:] *(.*)/.exec(fqdnOut);
if (match)
rtrn = match[1];"}
}}
}
on_false = nop {}
}
}
step {
name = "Populate hostname if domain false"
if {
condition = all {
is_not_empty {get_attr {"aix_details_resolved"}}
eq {
get_attr {"shouldIncludeDomain"}
"false"
}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "host_name"
value = get_attr {"aix_details_resolved[].pure_host_name"}
}}
}
on_false = nop {}
}
}
step {
name = "Merge into final table"
if {
condition = all {
is_not_empty {get_attr {"aix_details[1].host_id"}}
is_not_empty {get_attr {"aix_details_resolved[1].host_id"}}
}
on_true = merge {
table1_name = "aix_details"
key1_name = "host_id"
table2_name = "aix_details_resolved"
key2_name = "host_id"
result_table_name = "aix_details"
unmatched_lines = remove
}
on_false = nop {}
}
}
step {
name = "Filter empty host_name"
filter {
src_table_name = "aix_details"
target_table_name = "aix_details"
condition = is_not_empty {get_attr {"aix_details[].host_name"}}
}
}
step {
name = "Check if there are hosts"
match {
is_not_empty {get_attr {"aix_details"}}
terminate_op = graceful
terminate_msg = "No AIX hosts found, terminating the pattern"
}
}
step {
name = "Remove duplicates"
set_attr {
"tmp"
eval {"javascript: var tableWithoutDuplicates = '';
tableWithoutDuplicates = DuplicateRemover.removeDuplicates(${aix_details},[\"host_id\"]);
CTX.setAttribute(\"aix_details\", tableWithoutDuplicates);"}
}
}
step {
name = "Populate cmdb_ci_aix_server if FQDN is true"
if {
condition = eq {
get_attr {"shouldIncludeDomain"}
"true"
}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "host_name"
value = get_attr {"win_details[].pure_host_name"}
}
set_field {
field_name = "cluster_id"
value = get_attr {"aix_details[].cl_id"}
}
set_field {
field_name = "source_native_key"
value = concat {
"rubrik_host_"
get_attr {"aix_details[].host_name"}
"_"
get_attr {"cmdb_ci_rubrik_cluster[1].cluster_id"}
}
}
}
}
on_false = nop {}
}
}
step {
name = "Populate cmdb_ci_aix_server if FQDN is false"
if {
condition = eq {
get_attr {"shouldIncludeDomain"}
"false"
}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "host_name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "cluster_id"
value = get_attr {"aix_details[].cl_id"}
}
set_field {
field_name = "source_native_key"
value = concat {
"rubrik_host_"
get_attr {"aix_details[].host_name"}
"_"
get_attr {"cmdb_ci_rubrik_cluster[1].cluster_id"}
}
}
}
}
on_false = nop {}
}
}
step {
name = "Create relation between cmdb_ci_aix_server and cmdb_ci_rubrik_cluster"
relation_reference {
table1_name = "cmdb_ci_aix_server"
key1_name = "cluster_id"
table2_name = "cmdb_ci_rubrik_cluster"
key2_name = "cluster_id"
result_table_name = "aix_server_to_rubrik_cl"
unmatched_lines = remove
relation_type = "Managed by::Manages"
ref_direction = parentToChild
ref_field_name = "cluster_name"
}
}
}
}
| pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "74c7ea442ff2e4d03550d7492799b635" // Unique identifier for the pattern
name = "Rubrik AIX Host (LP)"
description = "Rubrik AIX Host (LP)" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_aix_server"
}
identification {
name = "Rubrik AIX Host identification"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Set IP as host"
if {
condition = is_not_empty {get_attr {"cmdb_ci_rubrik_cluster[1].comments"}}
on_true = set_attr {
"host"
get_attr {"cmdb_ci_rubrik_cluster[1].comments"}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Set credential alias"
if {
condition = is_not_empty {get_attr {"cmdb_ci_rubrik_cluster[1].attributes"}} // Attribute collection: Collects specific attributes from the discovered CI
on_true = set_attr {
"credential_alias"
get_attr {"cmdb_ci_rubrik_cluster[1].attributes"} // Attribute collection: Collects specific attributes from the discovered CI
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get Hosts"
if {
condition = is_not_empty {get_attr {"host"}}
on_true = custom_operation {
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "rubrik_url"
value = concat {
"https://"
get_attr {"host"}
}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "resource"
value = "host?primary_cluster_id=local&operating_system_type=UnixLike"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "session_auth"
value = "false"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "headers"
value = ""
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "response_name"
value = "aix_response"
}
}
sys_id_op = "bbd60d30db9b5410052464d74896192f"
to_var_names = "SystemVariable"
parsing_strategy = empty_strategy {}
if_not_found_do = nop {}
is_paginated = 1
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Parse Hosts"
if {
condition = is_not_empty {get_attr {"aix_response"}}
on_true = custom_operation {
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "source"
value = "aix_response"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "source_column"
value = ""
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "table_name"
value = "aix_details"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "target_columns"
value = "host_id:data.id, host_init_name:data.name, hostname:data.hostname, cl_id:data.primaryClusterId, host_os:data.operatingSystem, host_os_type:data.operatingSystemType, host_status:data.status, vendor_type:data.nasBaseConfig.vendorType"
}
}
sys_id_op = "eb6ef2e353a533003e76ddeeff7b124d"
to_var_names = "SystemVariable"
parsing_strategy = empty_strategy {}
if_not_found_do = nop {}
is_paginated = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Filter AIX hosts"
if {
condition = is_not_empty {get_attr {"aix_details[1].host_os_type"}}
on_true = filter {
src_table_name = "aix_details"
target_table_name = "aix_details"
condition = any {
contains {
get_attr {"aix_details[].host_os_type"}
"AIX"
}
contains {
get_attr {"aix_details[].host_os_type"}
"aix"
}
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check if there are hosts"
match {
is_not_empty {get_attr {"aix_details"}}
terminate_op = graceful
terminate_msg = "No AIX hosts found, terminating the pattern"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Resolve hostname"
if {
condition = is_not_empty {get_attr {"aix_details[1].hostname"}}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "pure_host_name"
value = eval {"javascript: var rslt; // Script execution: Custom script to perform a specific action or collect data
var rtrn;
var init = ${aix_details[].hostname} + '';
var domain = ${shouldIncludeDomain};
var lowerCase = ${hostnameCase};
var ip_rgx = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
try {
if (init && init.match(ip_rgx)) {
rslt = Packages.com.snc.sw.util.DNSUtils.reverseDns(init);
rtrn = rslt;
}
else if (init && init.indexOf('.') > -1 && domain != 'true'){
rtrn = init.split('.')[0];
}
else if (init && domain == 'true' && init.indexOf('.') > -1){
rtrn = init;
}
else {
rtrn = init;
}
if (rtrn && lowerCase !== 'Lower case'){
rtrn = rtrn.toUpperCase();
}
else if (rtrn && lowerCase == 'Lower case'){
rtrn = rtrn.toLowerCase();
}
} catch(e) {
e.getMessage();
}
rtrn += '';"}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Remove unresolved IPs"
if {
condition = is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
on_true = filter {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
condition = eq {
get_attr {"aix_details_resolved[].pure_host_name"}
eval {"javascript: var rtrn; // Script execution: Custom script to perform a specific action or collect data
var init = ${aix_details_resolved[].pure_host_name};
var ip_rgx = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
if (init && !init.match(ip_rgx)) {
rtrn = init;
}
else{
rtrn = '';
}
rtrn;"}
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Validate final hostname"
if {
condition = is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "pure_host_name"
value = eval {"javascript: var rtrn; // Script execution: Custom script to perform a specific action or collect data
var init = ${aix_details_resolved[].pure_host_name};
try {
if (init && init.indexOf('.') > -1){
rtrn = init.split('.')[0];
}
else {
rtrn = init;
}
} catch(e) {
e.getMessage();
}
rtrn;"}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Convert hostname to FQDN"
if {
condition = all {
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
is_not_empty {get_attr {"aix_details_resolved[1].pure_host_name"}}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "fqdn_name"
value = eval {"import com.snc.sw.kb.lang.commands.ExecutionMode;
try {
def cmd = \"nslookup \" + ${aix_details_resolved[].pure_host_name};
def res = ctx.getCommandManager().shellCommand(cmd, false, ExecutionMode.LOCAL_SCRIPT, null, ctx);
return res;
}
catch (Exception e) {
return e;
}"}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Populate hostname if domain true"
if {
condition = all {
is_not_empty {get_attr {"aix_details_resolved"}}
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "host_name"
value = eval {"javascript: var rtrn = ''; // Script execution: Custom script to perform a specific action or collect data
var fqdnOut = ${aix_details_resolved[].fqdn_name};
match = /[nN]ame *[=:] *(.*)/.exec(fqdnOut);
if (match)
rtrn = match[1];"}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Populate hostname if domain false"
if {
condition = all {
is_not_empty {get_attr {"aix_details_resolved"}}
eq {
get_attr {"shouldIncludeDomain"}
"false"
}
}
on_true = transform {
src_table_name = "aix_details_resolved"
target_table_name = "aix_details_resolved"
operation {set_field {
field_name = "host_name"
value = get_attr {"aix_details_resolved[].pure_host_name"}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Merge into final table"
if {
condition = all {
is_not_empty {get_attr {"aix_details[1].host_id"}}
is_not_empty {get_attr {"aix_details_resolved[1].host_id"}}
}
on_true = merge {
table1_name = "aix_details"
key1_name = "host_id"
table2_name = "aix_details_resolved"
key2_name = "host_id"
result_table_name = "aix_details"
unmatched_lines = remove
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Filter empty host_name"
filter {
src_table_name = "aix_details"
target_table_name = "aix_details"
condition = is_not_empty {get_attr {"aix_details[].host_name"}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check if there are hosts"
match {
is_not_empty {get_attr {"aix_details"}}
terminate_op = graceful
terminate_msg = "No AIX hosts found, terminating the pattern"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Remove duplicates"
set_attr {
"tmp"
eval {"javascript: var tableWithoutDuplicates = ''; // Script execution: Custom script to perform a specific action or collect data
tableWithoutDuplicates = DuplicateRemover.removeDuplicates(${aix_details},[\"host_id\"]);
CTX.setAttribute(\"aix_details\", tableWithoutDuplicates);"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Populate cmdb_ci_aix_server if FQDN is true"
if {
condition = eq {
get_attr {"shouldIncludeDomain"}
"true"
}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "host_name"
value = get_attr {"win_details[].pure_host_name"}
}
set_field {
field_name = "cluster_id"
value = get_attr {"aix_details[].cl_id"}
}
set_field {
field_name = "source_native_key"
value = concat {
"rubrik_host_"
get_attr {"aix_details[].host_name"}
"_"
get_attr {"cmdb_ci_rubrik_cluster[1].cluster_id"}
}
}
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Populate cmdb_ci_aix_server if FQDN is false"
if {
condition = eq {
get_attr {"shouldIncludeDomain"}
"false"
}
on_true = transform {
src_table_name = "aix_details"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "host_name"
value = get_attr {"aix_details[].host_name"}
}
set_field {
field_name = "cluster_id"
value = get_attr {"aix_details[].cl_id"}
}
set_field {
field_name = "source_native_key"
value = concat {
"rubrik_host_"
get_attr {"aix_details[].host_name"}
"_"
get_attr {"cmdb_ci_rubrik_cluster[1].cluster_id"}
}
}
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Create relation between cmdb_ci_aix_server and cmdb_ci_rubrik_cluster"
relation_reference {
table1_name = "cmdb_ci_aix_server"
key1_name = "cluster_id"
table2_name = "cmdb_ci_rubrik_cluster"
key2_name = "cluster_id"
result_table_name = "aix_server_to_rubrik_cl"
unmatched_lines = remove
relation_type = "Managed by::Manages"
ref_direction = parentToChild
ref_field_name = "cluster_name"
}
}
}
}
|
AIX Server | I would like for you to help me build a Pattern that helps achieve Discovery of AIX Server. \n CI Type: cmdb_ci_aix_server\nPattern Type: 3 - Infrastructure | cmdb_ci_aix_server | 3 - Infrastructure | pattern {
metadata {
id = "257794d44fc36200c7e881c18110c743"
name = "AIX Server"
description = ""
citype = "cmdb_ci_aix_server"
}
identification {
name = "discovery"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step {
name = "Unix\\Linux Name Formatting"
ref {refid = "46d81a979f10320055063758442e707f"}
}
step {
name = "Insert OS name, version and name to cmdb_ci_aix_server"
transform {
src_table_name = "cmdb_ci_aix_server"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"formattedHostname"}
}
set_field {
field_name = "os_version"
value = get_attr {"osVersion"}
}
set_field {
field_name = "os_name"
value = get_attr {"osName"}
}
}
}
}
step {
name = "DNS"
ref {refid = "ede27fe5db652200868a7c841f961984"}
}
step {
name = "Parse DNS Name"
if {
condition = all {
eq {
get_attr {"isDnsTrusted"}
"true"
}
is_not_empty {get_attr {"DnsTable[1].fqdn"}}
}
on_true = parse_var_to_var {
from_var_name = "DnsTable[1].fqdn"
to_var_names = "dns_name"
parsing_strategy = delimited_parsing {
delimiters = "."
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "Set name to DNS if DNS name trusted"
if {
condition = all {
eq {
get_attr {"isDnsTrusted"}
"true"
}
eq {
get_attr {"isSshTrusted"}
"false"
}
is_not_empty {get_attr {"dns_name"}}
}
on_true = set_attr {
"cmdb_ci_aix_server[*].name"
get_attr {"dns_name"}
}
on_false = nop {}
}
}
step {
name = "AIX - Identity"
ref {refid = "b79f1d509ffc32001d753758442e70b6"}
}
step {
name = "AIX - OS Patches"
ref {refid = "96bf99509ffc32001d753758442e70f7"}
}
step {
name = "UNIX - OS Filesystems"
ref {refid = "acd634b79fa032001d753758442e7002"}
}
step {
name = "Ref/Rel between cmdb_ci_file_system and AIX CI"
relation_reference {
table1_name = "cmdb_ci_aix_server"
table2_name = "cmdb_ci_file_system"
result_table_name = "Aix_to_fileSystem"
unmatched_lines = remove
condition = eq {
"1"
"1"
}
relation_type = "Contains::Contained by"
ref_direction = childToParent
ref_field_name = "computer"
}
}
step {
name = "Ref/Rel between cmdb_ci_file_system and AIX CI (provided_by)"
relation_reference {
table1_name = "cmdb_ci_aix_server"
table2_name = "cmdb_ci_file_system"
result_table_name = "Aix_to_fileSystem_prov"
unmatched_lines = remove
condition = eq {
"1"
"1"
}
ref_direction = childToParent
ref_field_name = "provided_by"
}
}
step {
name = "UNIX - OS Uptime"
ref {refid = "80d2cbe39f2032001d753758442e7092"}
}
step {
name = "Update start date in AIX CI"
set_attr {
"cmdb_ci_aix_server[*].start_date"
get_attr {"start_date"}
}
}
step {
name = "AIX - Hardware Model"
ref {refid = "5a7165d09ffc32001d753758442e7016"}
}
step {
name = "AIX - OS Release"
ref {refid = "5391a1d09ffc32001d753758442e70a2"}
}
step {
name = "AIX - CPU"
ref {refid = "8b62a9d09ffc32001d753758442e7005"}
}
step {
name = "AIX - Memory"
ref {refid = "7392e5d09ffc32001d753758442e7013"}
}
step {
name = "AIX - OS Revision"
ref {refid = "ece2e9d09ffc32001d753758442e70ad"}
}
step {
name = "AIX - Disk Space"
ref {refid = "462b1059872d89102b2aea8d0ebb358d"}
}
step {
name = "UNIX - Find FQDN"
ref {refid = "15c897ab9f2032001d753758442e7014"}
}
step {
name = "Update FQDN in AIX CI"
set_attr {
"cmdb_ci_aix_server[*].fqdn"
get_attr {"FQDN"}
}
}
step {
name = "Add domain name to server name"
if {
condition = all {
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
is_not_empty {get_attr {"FQDN"}}
}
on_true = set_attr {
"cmdb_ci_aix_server[*].name"
get_attr {"FQDN"}
}
on_false = nop {}
}
}
}
}
| pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "257794d44fc36200c7e881c18110c743" // Unique identifier for the pattern
name = "AIX Server"
description = "" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_aix_server"
}
identification {
name = "discovery"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Unix\\Linux Name Formatting"
ref {refid = "46d81a979f10320055063758442e707f"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Insert OS name, version and name to cmdb_ci_aix_server"
transform {
src_table_name = "cmdb_ci_aix_server"
target_table_name = "cmdb_ci_aix_server"
operation {
set_field {
field_name = "name"
value = get_attr {"formattedHostname"}
}
set_field {
field_name = "os_version"
value = get_attr {"osVersion"}
}
set_field {
field_name = "os_name"
value = get_attr {"osName"}
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "DNS"
ref {refid = "ede27fe5db652200868a7c841f961984"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Parse DNS Name"
if {
condition = all {
eq {
get_attr {"isDnsTrusted"}
"true"
}
is_not_empty {get_attr {"DnsTable[1].fqdn"}}
}
on_true = parse_var_to_var {
from_var_name = "DnsTable[1].fqdn"
to_var_names = "dns_name"
parsing_strategy = delimited_parsing {
delimiters = "."
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Set name to DNS if DNS name trusted"
if {
condition = all {
eq {
get_attr {"isDnsTrusted"}
"true"
}
eq {
get_attr {"isSshTrusted"}
"false"
}
is_not_empty {get_attr {"dns_name"}}
}
on_true = set_attr {
"cmdb_ci_aix_server[*].name"
get_attr {"dns_name"}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - Identity"
ref {refid = "b79f1d509ffc32001d753758442e70b6"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - OS Patches"
ref {refid = "96bf99509ffc32001d753758442e70f7"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "UNIX - OS Filesystems"
ref {refid = "acd634b79fa032001d753758442e7002"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Ref/Rel between cmdb_ci_file_system and AIX CI"
relation_reference {
table1_name = "cmdb_ci_aix_server"
table2_name = "cmdb_ci_file_system"
result_table_name = "Aix_to_fileSystem"
unmatched_lines = remove
condition = eq {
"1"
"1"
}
relation_type = "Contains::Contained by"
ref_direction = childToParent
ref_field_name = "computer"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Ref/Rel between cmdb_ci_file_system and AIX CI (provided_by)"
relation_reference {
table1_name = "cmdb_ci_aix_server"
table2_name = "cmdb_ci_file_system"
result_table_name = "Aix_to_fileSystem_prov"
unmatched_lines = remove
condition = eq {
"1"
"1"
}
ref_direction = childToParent
ref_field_name = "provided_by"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "UNIX - OS Uptime"
ref {refid = "80d2cbe39f2032001d753758442e7092"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Update start date in AIX CI"
set_attr {
"cmdb_ci_aix_server[*].start_date"
get_attr {"start_date"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - Hardware Model"
ref {refid = "5a7165d09ffc32001d753758442e7016"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - OS Release"
ref {refid = "5391a1d09ffc32001d753758442e70a2"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - CPU"
ref {refid = "8b62a9d09ffc32001d753758442e7005"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - Memory"
ref {refid = "7392e5d09ffc32001d753758442e7013"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - OS Revision"
ref {refid = "ece2e9d09ffc32001d753758442e70ad"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "AIX - Disk Space"
ref {refid = "462b1059872d89102b2aea8d0ebb358d"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "UNIX - Find FQDN"
ref {refid = "15c897ab9f2032001d753758442e7014"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Update FQDN in AIX CI"
set_attr {
"cmdb_ci_aix_server[*].fqdn"
get_attr {"FQDN"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Add domain name to server name"
if {
condition = all {
eq {
get_attr {"shouldIncludeDomain"}
"true"
}
is_not_empty {get_attr {"FQDN"}}
}
on_true = set_attr {
"cmdb_ci_aix_server[*].name"
get_attr {"FQDN"}
}
on_false = nop {}
}
}
}
}
|
Apache Active MQ | I would like for you to help me build a Pattern that helps achieve Discovery of Apache Active MQ. \n CI Type: cmdb_ci_apache_active_mq\nPattern Type: 1 - Application | cmdb_ci_apache_active_mq | 1 - Application | pattern {
metadata {
id = "8f2ca0b31be65510129298ec9c4bcbd6"
name = "Apache Active MQ"
description = "Apache Active MQ"
citype = "cmdb_ci_apache_active_mq"
apply_to_os_families = "cmdb_ci_linux_server","cmdb_ci_win_server"
}
identification {
name = "Windows Apache Active MQ"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step {
name = "exit if not windows"
match {
eq {
get_attr {"computer_system.osFamily"}
"WINDOWS"
}
terminate_op = graceful
terminate_msg = "Not windows server and exiting gracefully."
}
}
step {
name = "set name"
set_attr {
"name"
concat {
"ActiveMQ"
"@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step {
name = "get active mq home"
parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "-Dactivemq\\.home=\"?(.+?)\"?\\s+-"}
if_not_found_do = nop {}
}
}
step {
name = "get active mq home:failover"
if {
condition = is_empty {get_attr {"mq_home"}}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "\\\".*ACTIVEMQ_HOME=(.*?)\\\""}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "get active mq home:failover #2"
comment = "added this step in case the argument is not using double quotes"
if {
condition = is_empty {get_attr {"mq_home"}}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "ACTIVEMQ_HOME=(.*?)\\s+"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "set install directory"
set_attr {
"install_directory"
get_attr {"mq_home"}
}
}
step {
name = "set version"
runcmd_to_var {
cmd = concat {
"\""
get_attr {"mq_home"}
"\""
"\\\\bin\\\\activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "set version: failover"
if {
condition = is_empty {get_attr {"version"}}
on_true = parse_var_to_var {
from_var_name = "mq_home"
to_var_names = "version"
parsing_strategy = regex_parsing {regex = "activemq-?(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "exit gracefully if no version"
match {
is_not_empty {get_attr {"version"}}
terminate_op = graceful
terminate_msg = "No version found and exiting gracefully."
}
}
step {
name = "populate the table"
transform {
src_table_name = "cmdb_ci_apache_active_mq"
target_table_name = "cmdb_ci_apache_active_mq"
operation {
set_field {
field_name = "name"
value = get_attr {"name"}
}
set_field {
field_name = "version"
value = get_attr {"version"}
}
set_field {
field_name = "install_directory"
value = get_attr {"install_directory"}
}
}
}
}
}
identification {
name = "Linux Apache Active MQ"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step {
name = "exit if not unix"
match {
eq {
get_attr {"computer_system.osFamily"}
"UNIX"
}
terminate_op = graceful
terminate_msg = "Not Unix server and exiting gracefully."
}
}
step {
name = "set sudo"
set_attr {
"sudo"
eval {"return ${ctx}.getDiscoveryProvider(com.snc.sw.dto.ProviderType.SSH).getPrivilegedCommand();"}
}
}
step {
name = "set name"
set_attr {
"name"
concat {
"ActiveMQ"
"@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step {
name = "get activemq home"
parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = ".*-Dactivemq.home=(.*?)\\s+"}
if_not_found_do = nop {}
}
}
step {
name = "remove trailing /"
if {
condition = ends_with {
"/"
get_attr {"mq_home"}
}
on_true = parse_var_to_var {
from_var_name = "mq_home"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "(.*)/$"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "set install_directory"
set_attr {
"install_directory"
get_attr {"mq_home"}
}
}
step {
name = "set version"
runcmd_to_var {
cmd = concat {
get_attr {"install_directory"}
"/bin/activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "set version:failover 1"
if {
condition = is_empty {get_attr {"version"}}
on_true = runcmd_to_var {
cmd = concat {
get_attr {"sudo"}
" "
get_attr {"install_directory"}
"/bin/activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "set version:failover 2"
if {
condition = is_empty {get_attr {"version"}}
on_true = parse_var_to_var {
from_var_name = "install_directory"
to_var_names = "version"
parsing_strategy = regex_parsing {regex = "activemq-?(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "exit gracefully if no version"
match {
is_not_empty {get_attr {"version"}}
terminate_op = graceful
terminate_msg = "No version found and exiting gracefully."
}
}
step {
name = "populate the table"
transform {
src_table_name = "cmdb_ci_apache_active_mq"
target_table_name = "cmdb_ci_apache_active_mq"
operation {
set_field {
field_name = "name"
value = get_attr {"name"}
}
set_field {
field_name = "version"
value = get_attr {"version"}
}
set_field {
field_name = "install_directory"
value = get_attr {"install_directory"}
}
}
}
}
}
}
| pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "8f2ca0b31be65510129298ec9c4bcbd6" // Unique identifier for the pattern
name = "Apache Active MQ"
description = "Apache Active MQ" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_apache_active_mq"
apply_to_os_families = "cmdb_ci_linux_server","cmdb_ci_win_server"
}
identification {
name = "Windows Apache Active MQ"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "exit if not windows"
match {
eq {
get_attr {"computer_system.osFamily"}
"WINDOWS"
}
terminate_op = graceful
terminate_msg = "Not windows server and exiting gracefully."
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set name"
set_attr {
"name"
concat {
"ActiveMQ"
"@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get active mq home"
parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "-Dactivemq\\.home=\"?(.+?)\"?\\s+-"}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get active mq home:failover"
if {
condition = is_empty {get_attr {"mq_home"}}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "\\\".*ACTIVEMQ_HOME=(.*?)\\\""}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get active mq home:failover #2"
comment = "added this step in case the argument is not using double quotes" // Step definition: Represents a single action or set of actions in the pattern
if {
condition = is_empty {get_attr {"mq_home"}}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "ACTIVEMQ_HOME=(.*?)\\s+"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set install directory"
set_attr {
"install_directory"
get_attr {"mq_home"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set version"
runcmd_to_var {
cmd = concat {
"\""
get_attr {"mq_home"}
"\""
"\\\\bin\\\\activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set version: failover"
if {
condition = is_empty {get_attr {"version"}}
on_true = parse_var_to_var {
from_var_name = "mq_home"
to_var_names = "version"
parsing_strategy = regex_parsing {regex = "activemq-?(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "exit gracefully if no version"
match {
is_not_empty {get_attr {"version"}}
terminate_op = graceful
terminate_msg = "No version found and exiting gracefully."
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "populate the table"
transform {
src_table_name = "cmdb_ci_apache_active_mq"
target_table_name = "cmdb_ci_apache_active_mq"
operation {
set_field {
field_name = "name"
value = get_attr {"name"}
}
set_field {
field_name = "version"
value = get_attr {"version"}
}
set_field {
field_name = "install_directory"
value = get_attr {"install_directory"}
}
}
}
}
}
identification {
name = "Linux Apache Active MQ"
entry_point {type = "*"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "exit if not unix"
match {
eq {
get_attr {"computer_system.osFamily"}
"UNIX"
}
terminate_op = graceful
terminate_msg = "Not Unix server and exiting gracefully."
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set sudo"
set_attr {
"sudo"
eval {"return ${ctx}.getDiscoveryProvider(com.snc.sw.dto.ProviderType.SSH).getPrivilegedCommand();"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set name"
set_attr {
"name"
concat {
"ActiveMQ"
"@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get activemq home"
parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = ".*-Dactivemq.home=(.*?)\\s+"}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "remove trailing /"
if {
condition = ends_with {
"/"
get_attr {"mq_home"}
}
on_true = parse_var_to_var {
from_var_name = "mq_home"
to_var_names = "mq_home"
parsing_strategy = regex_parsing {regex = "(.*)/$"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set install_directory"
set_attr {
"install_directory"
get_attr {"mq_home"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set version"
runcmd_to_var {
cmd = concat {
get_attr {"install_directory"}
"/bin/activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set version:failover 1"
if {
condition = is_empty {get_attr {"version"}}
on_true = runcmd_to_var {
cmd = concat {
get_attr {"sudo"}
" "
get_attr {"install_directory"}
"/bin/activemq --version"
}
execution_mode = "DEFAULT"
var_names = "version"
parsing_strategy = regex_parsing {regex = "ActiveMQ\\s+(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set version:failover 2"
if {
condition = is_empty {get_attr {"version"}}
on_true = parse_var_to_var {
from_var_name = "install_directory"
to_var_names = "version"
parsing_strategy = regex_parsing {regex = "activemq-?(\\d+(?:\\.\\d+)+)"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "exit gracefully if no version"
match {
is_not_empty {get_attr {"version"}}
terminate_op = graceful
terminate_msg = "No version found and exiting gracefully."
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "populate the table"
transform {
src_table_name = "cmdb_ci_apache_active_mq"
target_table_name = "cmdb_ci_apache_active_mq"
operation {
set_field {
field_name = "name"
value = get_attr {"name"}
}
set_field {
field_name = "version"
value = get_attr {"version"}
}
set_field {
field_name = "install_directory"
value = get_attr {"install_directory"}
}
}
}
}
}
}
|
Apache On Windows | I would like for you to help me build a Pattern that helps achieve Discovery of Apache On Windows. \n CI Type: cmdb_ci_apache_web_server\nPattern Type: 1 - Application | cmdb_ci_apache_web_server | 1 - Application | pattern {
metadata {
id = "28d607dbfead4be3887c843814455300"
name = "Apache On Windows"
description = ""
citype = "cmdb_ci_apache_web_server"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification for HTTP(S) entry point type(s)"
entry_point {type = "cmdb_ci_endpoint_http,cmdb_ci_endpoint_tcp"}
find_process_strategy {strategy = LISTENING_PORT}
step {
name = "Check process name to match Apache"
match {
any {
contains {
get_attr {"process.executable"}
"httpd.exe"
}
contains {
get_attr {"process.executable"}
"apache.exe"
}
contains {
get_attr {"process.executable"}
"apache2.exe"
}
}
terminate_op = terminate
}
}
step {
name = "sets the display label"
set_attr {
"name"
concat {
"Apache server@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step {
name = "check if apache is running as a service -k runservice"
if {
condition = contains {
get_attr {"process.commandLine"}
"runservice"
}
on_true = set_attr {
"is_service"
"true"
}
on_false = nop {}
}
}
step {
name = "Get service process"
if {
condition = eq {
get_attr {"is_service"}
"true"
}
on_true = find_process_to_var {
process_id = ""
cmd_line = ""
working_dir = ""
parent_process_id = get_attr {"process.pid"}
ports = ""
var_name = "service_process"
}
on_false = nop {}
}
}
step {
name = "Transform service_process to table"
set_attr {
"tmp"
eval {"javascript: var resultList = new Packages.java.util.ArrayList();
var row;
var path = ${service_process[*].currentDir};
var dir = ${service_process[*].executablePath};
var pid = ${service_process[*].commandLine};
var exec = ${service_process[*].executable};
for (var a = 0; a < path.size() ; a++){
row = new Packages.java.util.HashMap();
row.put(\"currentDir\", (path.get(a)));
row.put(\"executablePath\", (dir.get(a)));
row.put(\"commandLine\", (pid.get(a)));
row.put(\"executable\", (exec.get(a)));
resultList.add(row);
}
CTX.setAttribute(\"process_table\", resultList);"}
}
}
step {
name = "Filter process_table"
if {
condition = is_not_empty {get_attr {"process_table[1].executable"}}
on_true = filter {
src_table_name = "process_table"
target_table_name = "process_table"
condition = any {
eq {
get_attr {"process_table[].executable"}
"httpd.exe"
}
eq {
get_attr {"process_table[].executable"}
"apache.exe"
}
eq {
get_attr {"process_table[].executable"}
"apache2.exe"
}
}
}
on_false = nop {}
}
}
step {
name = "Get home dir - Not service"
if {
condition = neq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "install_directory"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "Get home dir - service"
if {
condition = all {
eq {
get_attr {"is_service"}
"true"
}
is_not_empty {get_attr {"process_table[1].commandLine"}}
}
on_true = parse_var_to_var {
from_var_name = "process_table[1].commandLine"
to_var_names = "install_directory"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "take working_dir if home_dir was not set"
if {
condition = is_empty {get_attr {"install_directory"}}
on_true = set_attr {
"install_directory"
get_attr {"process.workingDir"}
}
on_false = nop {}
}
}
step {
name = "Get config file - not service"
if {
condition = neq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "config_file"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "default location of conf file"
if {
condition = all {
is_empty {get_attr {"config_file"}}
not_ends_with {
"/"
get_attr {"install_directory"}
}
contains {
get_attr {"install_directory"}
"/"
}
}
on_true = set_attr {
"config_file"
concat {
get_attr {"install_directory"}
"/conf/httpd.conf"
}
}
on_false = nop {}
}
}
step {
name = "default location of conf file without slash"
if {
condition = all {
is_empty {get_attr {"config_file"}}
contains {
get_attr {"install_directory"}
"/"
}
}
on_true = set_attr {
"config_file"
concat {
get_attr {"install_directory"}
"conf/httpd.conf"
}
}
on_false = nop {}
}
}
step {
name = "Get config file - service"
if {
condition = eq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "service_process.commandLine"
to_var_names = "config_file"
parsing_strategy = cmdline_linux_parsing {after_option = "-f"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "get version from version.signature (IBM HTTPSERVER) "
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"install_directory"}
"\\version.signature"
}
foreach_attribute_name = "forEach"
}
var_names = "version"
parsing_strategy = position_from_end {
tokens_from_end = 1
delimiter = " "
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Condition - check that version was set if not extract it from httpd -v"
runcmd_to_var {
cmd = concat {
"\""
get_attr {"process.executablePath"}
"\" -V "
}
var_names = "version"
parsing_strategy = delimited_parsing {
include_lines_pattern = "Server version"
delimiters = "/"," "
selected_positions = 4
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "Get short description"
runcmd_to_var {
cmd = concat {
"\""
get_attr {"process.executablePath"}
"\" -V "
}
execution_mode = "DEFAULT"
var_names = "temp_description"
parsing_strategy = delimited_parsing {
selected_positions = 1
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Clean and format short description"
if {
condition = is_not_empty {get_attr {"temp_description"}}
on_true = set_attr {
"short_description"
eval {"javascript: var rtrn = \"\";
var array = ${temp_description};
var i;
for (i=0; i<array.size() ; i++) {
if(i==0){
rtrn = array.get(i);
}else{
rtrn = rtrn + \" \\n\" + array.get(i);
}
}
"}
}
on_false = nop {}
}
}
step {
name = "reference to Apache Enrich attributes"
ref {refid = "118e7a04e4d4441ba0e64e4d0e3338d7"}
}
step {
name = "set type"
set_attr {
"type"
"Apache"
}
}
step {
name = "set process_ids"
set_attr {
"process_ids"
get_attr {"process.pid"}
}
}
}
identification {
name = "Lightweight identification for Apache"
entry_point {type = "cmdb_ci_endpoint_tcp,cmdb_ci_endpoint_http"}
find_process_strategy {strategy = NONE}
step {
name = "Check process name to match Apache"
match {
any {
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"httpd.exe"
}
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"apache.exe"
}
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"apache2.exe"
}
}
terminate_op = terminate
}
}
step {
name = "Reference to library \"Apache basic identification\""
ref {refid = "669fc85a9fa23200472d5f9bc32e7014"}
}
step {
name = "Set discovery source"
set_attr {
"discovery_source"
"CredentiallessDiscovery"
}
}
}
connection {
name = "WAS connectivity"
step {
name = "Get WAS plugin conf file"
parse_text_file_to_var {
file_path = get_attr {"config_file"}
var_names = "wasplugin"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebSpherePluginConfig"
exclude_lines_pattern = "#WebSpherePluginConfig"
delimiters = "WebSpherePluginConfig"
selected_positions = 1
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "Strip the \" if needed"
if {
condition = contains {
get_attr {"wasplugin"}
"\""
}
on_true = parse_var_to_var {
from_var_name = "wasplugin"
to_var_names = "wasplugin"
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = "\""
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "Get hosts"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "virtual_hosts"
col_names = "group","host","port"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "group"
xpath = "/Config/VirtualHostGroup/@Name"
delimiters = ""
position = 1
}
field {
col_name = "host"
xpath = "/Config/VirtualHostGroup/VirtualHost/@Name"
delimiters = ":"
position = 1
}
field {
col_name = "port"
xpath = "/Config/VirtualHostGroup/VirtualHost/@Name"
delimiters = ":"
position = 2
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = " Filter hosts by input host (URL)"
filter {
src_table_name = "virtual_hosts"
target_table_name = "virtual_hosts"
condition = any {
contains {
get_attr {"virtual_hosts[].host"}
get_attr {"entry_point.ip_address"}
}
contains {
get_attr {"virtual_hosts[].port"}
get_attr {"entry_point.port"}
}
eq {
get_attr {"virtual_hosts[].host"}
"*"
}
eq {
get_attr {"virtual_hosts[].port"}
"*"
}
}
}
}
step {
name = "Get URIs"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "URI_groups"
col_names = "group","uri"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "group"
xpath = "/Config/UriGroup/@Name"
delimiters = ""
position = 1
}
field {
col_name = "uri"
xpath = "/Config/UriGroup/Uri/@Name"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = " Filter hosts by input host (URL)1"
best_match {
values = get_attr {"URI_groups[*].uri"}
url = get_attr {"entry_point.url"}
var_name = "best_match"
}
}
step {
name = " Filter hosts by input host (URL)2"
filter {
src_table_name = "URI_groups"
target_table_name = "URI_groups"
condition = eq {
get_attr {"URI_groups[].uri"}
get_attr {"best_match"}
}
}
}
step {
name = "get routes"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "routes"
col_names = "cluster","urigroup","hostgroup"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "cluster"
xpath = "/Config/Route/@ServerCluster"
delimiters = ""
position = 1
}
field {
col_name = "urigroup"
xpath = "/Config/Route/@UriGroup"
delimiters = ""
position = 1
}
field {
col_name = "hostgroup"
xpath = "/Config/Route/@VirtualHostGroup"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "Merge routes & URIs"
merge {
table1_name = "routes"
key1_name = "urigroup"
table2_name = "URI_groups"
key2_name = "group"
result_table_name = "routes"
unmatched_lines = remove
}
}
step {
name = "Merge routes to hosts"
merge {
table1_name = "routes"
key1_name = "hostgroup"
table2_name = "virtual_hosts"
key2_name = "group"
result_table_name = "routes"
unmatched_lines = remove
}
}
step {
name = "Get clusters"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "clusters"
col_names = "name","hostname","portvalue","protocol"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "name"
xpath = "/Config/ServerCluster/@Name"
delimiters = ""
position = 1
}
field {
col_name = "hostname"
xpath = "/Config/ServerCluster/Server/Transport/@Hostname"
delimiters = ""
position = 1
}
field {
col_name = "portvalue"
xpath = "/Config/ServerCluster/Server/Transport/@Port"
delimiters = ""
position = 1
}
field {
col_name = "protocol"
xpath = "/Config/ServerCluster/Server/Transport/@Protocol"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "Filter clusters by protocol (URL)"
filter {
src_table_name = "clusters"
target_table_name = "clusters"
condition = eq {
get_attr {"clusters[].protocol"}
get_attr {"entry_point.protocol"}
}
}
}
step {
name = "Merge clusters to routes"
merge {
table1_name = "routes"
key1_name = "cluster"
table2_name = "clusters"
key2_name = "name"
result_table_name = "clusters"
unmatched_lines = remove
}
}
step {
name = "create connection"
if {
condition = is_empty {get_attr {"clusters"}}
on_true = nop {}
on_false = create_connection {
connection_type = CLUSTER
cluster_name = get_attr {"clusters[*].cluster"}
target_ci_type = "cmdb_ci_app_server_websphere"
entry_point_type = "cmdb_ci_endpoint_http"
attributes {
attribute {
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
attribute {
name = "host"
value = get_attr {"clusters[*].hostname"}
}
attribute {
name = "port"
value = get_attr {"clusters[*].portvalue"}
}
}
traffic_based = "false"
}
}
}
}
connection {
name = "Create LDAP Connection"
step {
name = "set confdir"
parse_var_to_var {
from_var_name = "config_file"
to_var_names = "confdir"
parsing_strategy = regex_parsing {regex = "(.*)\\\\httpd.conf"}
if_not_found_do = terminate {}
}
}
step {
name = "parse ldap.prop"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"confdir"}
"\\\\ldap.prop"
}
foreach_attribute_name = "forEach"
}
var_names = "ldap_url"
parsing_strategy = properties_parsing_strategy {fields {
field {
col_name = "ldap_url"
xpath = "/ldap/URL/text()"
delimiters = ""
position = 1
}
field {
col_name = "forEach"
for_each = "forEach"
delimiters = ""
position = 1
}
}}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step {
name = "parse ldap url"
parse_url_to_var {
from_var_name = "ldap_url"
to_var_name = "ldap_conn"
if_not_found_do = nop {}
}
}
step {
name = "get db if specified"
if {
condition = contains {
get_attr {"ldap_conn[1].path"}
"o="
}
on_true = parse_var_to_var {
from_var_name = "ldap_conn[*].path"
to_var_names = "db"
parsing_strategy = regex_parsing {regex = "o=(.*),"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step {
name = "create ldap connection"
if {
condition = is_not_empty {get_attr {"ldap_conn"}}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_sun_ldap_dir_server"
entry_point_type = "cmdb_ci_endpoint_ldap"
attributes {
attribute {
name = "host"
value = get_attr {"ldap_conn[1].host"}
}
attribute {
name = "port"
value = get_attr {"ldap_conn[1].port"}
}
attribute {
name = "protocol"
value = "ldap"
}
attribute {
name = "type"
value = get_attr {"db"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
}
connection {
name = "OC4J Connectivity"
step {
name = "find oc4j include"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "oc4j_mod"
parsing_strategy = delimited_parsing {
include_lines_pattern = "include \".*\\\\mod_oc4j.conf\""
exclude_lines_pattern = "\\s*#"
delimiters = "\""
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Verify oc4j module loaded"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"install_directory"}
"\\conf\\mod_oc4j.conf"
}
foreach_attribute_name = "forEach"
}
var_names = table {
name = "oc4j_mounts"
col_names = "uri","destination"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "Oc4jMount"
exclude_lines_pattern = "#"
delimiters = " "
selected_positions = 2,3
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Local OC4J connectivity"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "local_oc4j"
condition = all {
not_starts_with {
"instance"
get_attr {"oc4j_mounts[].destination"}
}
not_starts_with {
"cluster"
get_attr {"oc4j_mounts[].destination"}
}
not_starts_with {
"ajp"
get_attr {"oc4j_mounts[].destination"}
}
}
}
}
step {
name = "if no mounts, read instances AJP ports"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = runcmd_to_var {
cmd = concat {
get_attr {"process.currentDir"}
"\\..\\..\\opmn\\bin\\opmnctl.exe status -fmt %cmp32%prt32%por40%pid"
}
var_names = table {
name = "instances"
col_names = "oc4j_instance","ports","pid"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "OC4J"
exclude_lines_pattern = ""
delimiters = "|"
selected_positions = 2,3,4
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "extract AJP ports"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = transform {
src_table_name = "instances"
target_table_name = "AJP_PORTS"
operation {set_field {
field_name = "ajp_port"
value = concat {eval {"var = ${instances[].ports}; matcher = var =~ /jms:(\\d+),ajp:(\\d+)/; return matcher[0][2]"}}
}}
}
on_false = nop {}
}
}
step {
name = "set dest_host"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = set_attr {
"destHost"
get_attr {"computer_system.primaryManagementIP"}
}
on_false = nop {}
}
}
step {
name = "create broadcast AJP connection"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_ora_ias"
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes {
attribute {
name = "host"
value = get_attr {"destHost"}
}
attribute {
name = "port"
value = get_attr {"AJP_PORTS[*].ajp_port"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
step {
name = "parse ep URL"
parse_url_to_var {
from_var_name = "entry_point.url"
to_var_name = "ep_url"
if_not_found_do = nop {}
}
}
step {
name = "filter oc4j_mounts by uri"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "oc4j_mounts"
condition = any {
contains {
get_attr {"oc4j_mounts[].uri"}
get_attr {"ep_url[1].path"}
}
contains {
get_attr {"ep_url[1].path"}
get_attr {"oc4j_mounts[*].uri"}
}
}
}
}
step {
name = "parse ajp:// mounts"
parse_var_to_var {
from_var_name = "oc4j_mounts[*].destination"
to_var_names = table {
name = "ajp_destinations"
col_names = "host","port"
}
parsing_strategy = regex_parsing {regex = "ajp13://(.*):(\\d+)"}
if_not_found_do = nop {}
}
}
step {
name = "create direct AJP connections"
create_connection {
connection_type = APPLICATION_FLOW
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes {
attribute {
name = "host"
value = get_attr {"ajp_destinations[*].host"}
}
attribute {
name = "port"
value = get_attr {"ajp_destinations[*].port"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
step {
name = "filter instance:// mounts"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "instance_oc4j"
condition = starts_with {
"instance://"
get_attr {"oc4j_mounts[].destination"}
}
}
}
step {
name = "parse instance:// destinations"
parse_var_to_var {
from_var_name = "instance_oc4j[*].destination"
to_var_names = table {
name = "ias_instances"
col_names = "as_instance","oc4j_instance"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = ":","//"
selected_positions = 2,3
}
if_not_found_do = nop {}
}
}
step {
name = "filter cluster:// mounts"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "cluster_oc4j"
condition = starts_with {
"cluster://"
get_attr {"oc4j_mounts[].destination"}
}
}
}
step {
name = "parse cluster:// destinations"
parse_var_to_var {
from_var_name = "cluster_oc4j[*].destination"
to_var_names = table {
name = "as_clusters"
col_names = "cluster_name","oc4j_instance_name"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = ":","//"
selected_positions = 2,3
}
if_not_found_do = nop {}
}
}
step {
name = "get @farm oc4j instances"
runcmd_to_var {
cmd = concat {
get_attr {"install_directory"}
"\\..\\..\\opmn\\bin\\opmnctl @farm status -noheaders -fsep \"|\" -fmt %cmp%prt%clu%ins%por"
}
var_names = table {
name = "oc4j_instances"
col_names = "oc4j_name","cluster_name","instance_name","ports"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "OC4J"
exclude_lines_pattern = ""
delimiters = "|"
selected_positions = 2,3,4,5
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "handle instance:// mounts connections"
if {
condition = is_not_empty {get_attr {"ias_instances"}}
on_true = merge {
table1_name = "oc4j_instances"
key1_name = "instance_name"
table2_name = "ias_instances"
key2_name = "as_instance"
result_table_name = "oc4j_instances"
unmatched_lines = remove
}
on_false = nop {}
}
}
step {
name = "handle cluster:// mounts connections"
if {
condition = is_not_empty {get_attr {"as_clusters"}}
on_true = merge {
table1_name = "oc4j_instances"
key1_name = "cluster_name"
table2_name = "as_clusters"
key2_name = "cluster_name"
result_table_name = "oc4j_instances"
unmatched_lines = remove
}
on_false = nop {}
}
}
step {
name = "extract AJP port from oc4j_instances table"
transform {
src_table_name = "oc4j_instances"
target_table_name = "oc4j_instances"
operation {set_field {
field_name = "ajp_port"
value = concat {eval {"m = ${oc4j_instances.ports} =~ /ajp:(\\d+),?/; m[0][1]"}}
}}
}
}
step {
name = "extract host name from instance_name"
transform {
src_table_name = "oc4j_instances"
target_table_name = "oc4j_instances"
operation {set_field {
field_name = "hostname"
value = eval {"a = ${oc4j_instances.instance_name}; arr = a.split(\"\\\\.\"); arr[1..<arr.length].join(\".\")"}
}}
}
}
step {
name = "split oc4j_instances to instances only"
filter {
src_table_name = "oc4j_instances"
target_table_name = "conn_instances"
condition = is_empty {get_attr {"oc4j_instances[].cluster_name"}}
}
}
step {
name = "split oc4j_instances to clusters only"
filter {
src_table_name = "oc4j_instances"
target_table_name = "conn_clusters"
condition = is_not_empty {get_attr {"oc4j_instances[].cluster_name"}}
}
}
step {
name = "create APP_FLOW connections"
create_connection {
connection_type = APPLICATION_FLOW
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes {
attribute {
name = "host"
value = get_attr {"conn_instances[*].hostname"}
}
attribute {
name = "port"
value = get_attr {"conn_instances[*].ajp_port"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
step {
name = "create CLUSTER connections"
create_connection {
connection_type = CLUSTER
cluster_name = get_attr {"conn_clusters[*].cluster_name"}
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes {
attribute {
name = "host"
value = get_attr {"conn_clusters[*].hostname"}
}
attribute {
name = "port"
value = get_attr {"conn_clusters[*].ajp_port"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "WebLogic connectivity"
step {
name = "Check if WL module configured in Apache"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "wl_identification"
parsing_strategy = delimited_parsing {
include_lines_pattern = "weblogic_module"
delimiters = "\\"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Get WebLogic host"
if {
condition = is_not_empty {get_attr {"wl_identification"}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "wl_host"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicHost"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "Get WebLogic port"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "wl_port"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicPort"
delimiters = " "
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step {
name = "Create connection to single WL host"
if {
condition = all {
is_not_empty {get_attr {"wl_port"}}
is_not_empty {get_attr {"wl_host"}}
}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_weblogic"
entry_point_type = "cmdb_ci_endpoint_http"
attributes {
attribute {
name = "host"
value = get_attr {"wl_host"}
}
attribute {
name = "port"
value = get_attr {"wl_port"}
}
attribute {
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
step {
name = "Get Weblogic cluster hosts and ports"
if {
condition = is_empty {concat {
get_attr {"wl_host"}
get_attr {"wl_host"}
}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "wl_cluster_hosts_ports"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicCluster"
delimiters = " "
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "Build table of WL hosts and ports in cluster"
parse_var_to_var {
from_var_name = "wl_cluster_hosts_ports"
to_var_names = table {
name = "wl_hosts_ports"
col_names = "wl_hosts","wl_ports"
}
parsing_strategy = delimited_parsing {
delimiters = ":"
selected_positions = 1,2
line_seperator = ","
}
if_not_found_do = nop {}
}
}
step {
name = "Create connection to cluster WL hosts"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_weblogic"
entry_point_type = "cmdb_ci_endpoint_http"
attributes {
attribute {
name = "host"
value = get_attr {"wl_hosts_ports[*].wl_hosts"}
}
attribute {
name = "port"
value = get_attr {"wl_hosts_ports[*].wl_ports"}
}
attribute {
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute {
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "Jiva Connectivity"
step {
name = "Match"
match {
contains {
"1"
"1"
}
terminate_op = terminate
}
}
step {
name = "Get jiva conf file"
if {
condition = is_not_empty {get_attr {"config_file"}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach"
}
var_names = "jiva_conf"
parsing_strategy = delimited_parsing {
include_lines_pattern = "Include"," jiva"
exclude_lines_pattern = "#"
delimiters = "conf/"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step {
name = "Set conf directory"
if {
condition = is_not_empty {get_attr {"config_file"}}
on_true = parse_var_to_var {
from_var_name = "config_file"
to_var_names = "conf_dir"
parsing_st... | pattern {
metadata { // Metadata section: Contains metadata information about the pattern
id = "28d607dbfead4be3887c843814455300" // Unique identifier for the pattern
name = "Apache On Windows"
description = "" // Script execution: Custom script to perform a specific action or collect data
citype = "cmdb_ci_apache_web_server"
apply_to_os_families = "cmdb_ci_win_server"
}
identification {
name = "Identification for HTTP(S) entry point type(s)"
entry_point {type = "cmdb_ci_endpoint_http,cmdb_ci_endpoint_tcp"}
find_process_strategy {strategy = LISTENING_PORT}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check process name to match Apache"
match {
any {
contains {
get_attr {"process.executable"}
"httpd.exe"
}
contains {
get_attr {"process.executable"}
"apache.exe"
}
contains {
get_attr {"process.executable"}
"apache2.exe"
}
}
terminate_op = terminate
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "sets the display label"
set_attr {
"name"
concat {
"Apache server@"
get_attr {"computer_system.primaryHostname"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "check if apache is running as a service -k runservice"
if {
condition = contains {
get_attr {"process.commandLine"}
"runservice"
}
on_true = set_attr {
"is_service"
"true"
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get service process"
if {
condition = eq {
get_attr {"is_service"}
"true"
}
on_true = find_process_to_var {
process_id = "" // Unique identifier for the pattern
cmd_line = ""
working_dir = ""
parent_process_id = get_attr {"process.pid"} // Unique identifier for the pattern
ports = ""
var_name = "service_process"
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Transform service_process to table"
set_attr {
"tmp"
eval {"javascript: var resultList = new Packages.java.util.ArrayList(); // Script execution: Custom script to perform a specific action or collect data
var row;
var path = ${service_process[*].currentDir};
var dir = ${service_process[*].executablePath};
var pid = ${service_process[*].commandLine}; // Unique identifier for the pattern
var exec = ${service_process[*].executable};
for (var a = 0; a < path.size() ; a++){
row = new Packages.java.util.HashMap();
row.put(\"currentDir\", (path.get(a)));
row.put(\"executablePath\", (dir.get(a)));
row.put(\"commandLine\", (pid.get(a)));
row.put(\"executable\", (exec.get(a)));
resultList.add(row);
}
CTX.setAttribute(\"process_table\", resultList);"}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Filter process_table"
if {
condition = is_not_empty {get_attr {"process_table[1].executable"}}
on_true = filter {
src_table_name = "process_table"
target_table_name = "process_table"
condition = any {
eq {
get_attr {"process_table[].executable"}
"httpd.exe"
}
eq {
get_attr {"process_table[].executable"}
"apache.exe"
}
eq {
get_attr {"process_table[].executable"}
"apache2.exe"
}
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get home dir - Not service"
if {
condition = neq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "install_directory"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get home dir - service"
if {
condition = all {
eq {
get_attr {"is_service"}
"true"
}
is_not_empty {get_attr {"process_table[1].commandLine"}}
}
on_true = parse_var_to_var {
from_var_name = "process_table[1].commandLine"
to_var_names = "install_directory"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "take working_dir if home_dir was not set"
if {
condition = is_empty {get_attr {"install_directory"}}
on_true = set_attr {
"install_directory"
get_attr {"process.workingDir"}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get config file - not service"
if {
condition = neq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "process.commandLine"
to_var_names = "config_file"
parsing_strategy = cmdline_linux_parsing {after_option = "-d"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "default location of conf file"
if {
condition = all {
is_empty {get_attr {"config_file"}}
not_ends_with {
"/"
get_attr {"install_directory"}
}
contains {
get_attr {"install_directory"}
"/"
}
}
on_true = set_attr {
"config_file"
concat {
get_attr {"install_directory"}
"/conf/httpd.conf"
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "default location of conf file without slash"
if {
condition = all {
is_empty {get_attr {"config_file"}}
contains {
get_attr {"install_directory"}
"/"
}
}
on_true = set_attr {
"config_file"
concat {
get_attr {"install_directory"}
"conf/httpd.conf"
}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get config file - service"
if {
condition = eq {
get_attr {"is_service"}
"true"
}
on_true = parse_var_to_var {
from_var_name = "service_process.commandLine"
to_var_names = "config_file"
parsing_strategy = cmdline_linux_parsing {after_option = "-f"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get version from version.signature (IBM HTTPSERVER) "
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"install_directory"}
"\\version.signature"
}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "version"
parsing_strategy = position_from_end {
tokens_from_end = 1
delimiter = " "
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Condition - check that version was set if not extract it from httpd -v"
runcmd_to_var {
cmd = concat {
"\""
get_attr {"process.executablePath"}
"\" -V "
}
var_names = "version"
parsing_strategy = delimited_parsing {
include_lines_pattern = "Server version"
delimiters = "/"," "
selected_positions = 4
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get short description" // Script execution: Custom script to perform a specific action or collect data
runcmd_to_var {
cmd = concat {
"\""
get_attr {"process.executablePath"}
"\" -V "
}
execution_mode = "DEFAULT"
var_names = "temp_description" // Script execution: Custom script to perform a specific action or collect data
parsing_strategy = delimited_parsing {
selected_positions = 1
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Clean and format short description" // Script execution: Custom script to perform a specific action or collect data
if {
condition = is_not_empty {get_attr {"temp_description"}} // Script execution: Custom script to perform a specific action or collect data
on_true = set_attr {
"short_description" // Script execution: Custom script to perform a specific action or collect data
eval {"javascript: var rtrn = \"\"; // Script execution: Custom script to perform a specific action or collect data
var array = ${temp_description}; // Script execution: Custom script to perform a specific action or collect data
var i;
for (i=0; i<array.size() ; i++) {
if(i==0){
rtrn = array.get(i);
}else{
rtrn = rtrn + \" \\n\" + array.get(i);
}
}
"}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "reference to Apache Enrich attributes" // Attribute collection: Collects specific attributes from the discovered CI
ref {refid = "118e7a04e4d4441ba0e64e4d0e3338d7"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set type"
set_attr {
"type"
"Apache"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set process_ids"
set_attr {
"process_ids"
get_attr {"process.pid"}
}
}
}
identification {
name = "Lightweight identification for Apache"
entry_point {type = "cmdb_ci_endpoint_tcp,cmdb_ci_endpoint_http"}
find_process_strategy {strategy = NONE}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check process name to match Apache"
match {
any {
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"httpd.exe"
}
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"apache.exe"
}
contains {
get_attr {"pre_cmdb_running_process[1].command"}
"apache2.exe"
}
}
terminate_op = terminate
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Reference to library \"Apache basic identification\""
ref {refid = "669fc85a9fa23200472d5f9bc32e7014"} // Unique identifier for the pattern
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Set discovery source"
set_attr {
"discovery_source"
"CredentiallessDiscovery"
}
}
}
connection {
name = "WAS connectivity"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get WAS plugin conf file"
parse_text_file_to_var {
file_path = get_attr {"config_file"}
var_names = "wasplugin"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebSpherePluginConfig"
exclude_lines_pattern = "#WebSpherePluginConfig"
delimiters = "WebSpherePluginConfig"
selected_positions = 1
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Strip the \" if needed"
if {
condition = contains {
get_attr {"wasplugin"}
"\""
}
on_true = parse_var_to_var {
from_var_name = "wasplugin"
to_var_names = "wasplugin"
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = "\""
selected_positions = 1
}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get hosts"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "virtual_hosts"
col_names = "group","host","port"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "group"
xpath = "/Config/VirtualHostGroup/@Name"
delimiters = ""
position = 1
}
field {
col_name = "host"
xpath = "/Config/VirtualHostGroup/VirtualHost/@Name"
delimiters = ":"
position = 1
}
field {
col_name = "port"
xpath = "/Config/VirtualHostGroup/VirtualHost/@Name"
delimiters = ":"
position = 2
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = " Filter hosts by input host (URL)"
filter {
src_table_name = "virtual_hosts"
target_table_name = "virtual_hosts"
condition = any {
contains {
get_attr {"virtual_hosts[].host"}
get_attr {"entry_point.ip_address"}
}
contains {
get_attr {"virtual_hosts[].port"}
get_attr {"entry_point.port"}
}
eq {
get_attr {"virtual_hosts[].host"}
"*"
}
eq {
get_attr {"virtual_hosts[].port"}
"*"
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get URIs"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "URI_groups"
col_names = "group","uri"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "group"
xpath = "/Config/UriGroup/@Name"
delimiters = ""
position = 1
}
field {
col_name = "uri"
xpath = "/Config/UriGroup/Uri/@Name"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = " Filter hosts by input host (URL)1"
best_match {
values = get_attr {"URI_groups[*].uri"}
url = get_attr {"entry_point.url"}
var_name = "best_match"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = " Filter hosts by input host (URL)2"
filter {
src_table_name = "URI_groups"
target_table_name = "URI_groups"
condition = eq {
get_attr {"URI_groups[].uri"}
get_attr {"best_match"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get routes"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "routes"
col_names = "cluster","urigroup","hostgroup"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "cluster"
xpath = "/Config/Route/@ServerCluster"
delimiters = ""
position = 1
}
field {
col_name = "urigroup"
xpath = "/Config/Route/@UriGroup"
delimiters = ""
position = 1
}
field {
col_name = "hostgroup"
xpath = "/Config/Route/@VirtualHostGroup"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Merge routes & URIs"
merge {
table1_name = "routes"
key1_name = "urigroup"
table2_name = "URI_groups"
key2_name = "group"
result_table_name = "routes"
unmatched_lines = remove
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Merge routes to hosts"
merge {
table1_name = "routes"
key1_name = "hostgroup"
table2_name = "virtual_hosts"
key2_name = "group"
result_table_name = "routes"
unmatched_lines = remove
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get clusters"
parse_xml_file_to_var {
file_path = get_attr {"wasplugin"}
var_names = table {
name = "clusters"
col_names = "name","hostname","portvalue","protocol"
}
xml_parsing_strategy {
rootXpath = "//Config"
fields {
field {
col_name = "name"
xpath = "/Config/ServerCluster/@Name"
delimiters = ""
position = 1
}
field {
col_name = "hostname"
xpath = "/Config/ServerCluster/Server/Transport/@Hostname"
delimiters = ""
position = 1
}
field {
col_name = "portvalue"
xpath = "/Config/ServerCluster/Server/Transport/@Port"
delimiters = ""
position = 1
}
field {
col_name = "protocol"
xpath = "/Config/ServerCluster/Server/Transport/@Protocol"
delimiters = ""
position = 1
}
}
}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Filter clusters by protocol (URL)"
filter {
src_table_name = "clusters"
target_table_name = "clusters"
condition = eq {
get_attr {"clusters[].protocol"}
get_attr {"entry_point.protocol"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Merge clusters to routes"
merge {
table1_name = "routes"
key1_name = "cluster"
table2_name = "clusters"
key2_name = "name"
result_table_name = "clusters"
unmatched_lines = remove
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create connection"
if {
condition = is_empty {get_attr {"clusters"}}
on_true = nop {}
on_false = create_connection {
connection_type = CLUSTER
cluster_name = get_attr {"clusters[*].cluster"}
target_ci_type = "cmdb_ci_app_server_websphere"
entry_point_type = "cmdb_ci_endpoint_http"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"clusters[*].hostname"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"clusters[*].portvalue"}
}
}
traffic_based = "false"
}
}
}
}
connection {
name = "Create LDAP Connection"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set confdir"
parse_var_to_var {
from_var_name = "config_file"
to_var_names = "confdir"
parsing_strategy = regex_parsing {regex = "(.*)\\\\httpd.conf"}
if_not_found_do = terminate {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse ldap.prop"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"confdir"}
"\\\\ldap.prop"
}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "ldap_url"
parsing_strategy = properties_parsing_strategy {fields {
field {
col_name = "ldap_url"
xpath = "/ldap/URL/text()"
delimiters = ""
position = 1
}
field {
col_name = "forEach"
for_each = "forEach"
delimiters = ""
position = 1
}
}}
if_not_found_do = terminate {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse ldap url"
parse_url_to_var {
from_var_name = "ldap_url"
to_var_name = "ldap_conn"
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get db if specified"
if {
condition = contains {
get_attr {"ldap_conn[1].path"}
"o="
}
on_true = parse_var_to_var {
from_var_name = "ldap_conn[*].path"
to_var_names = "db"
parsing_strategy = regex_parsing {regex = "o=(.*),"}
if_not_found_do = nop {}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create ldap connection"
if {
condition = is_not_empty {get_attr {"ldap_conn"}}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_sun_ldap_dir_server"
entry_point_type = "cmdb_ci_endpoint_ldap"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"ldap_conn[1].host"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"ldap_conn[1].port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "protocol"
value = "ldap"
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "type"
value = get_attr {"db"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
}
connection {
name = "OC4J Connectivity"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "find oc4j include"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "oc4j_mod"
parsing_strategy = delimited_parsing {
include_lines_pattern = "include \".*\\\\mod_oc4j.conf\""
exclude_lines_pattern = "\\s*#"
delimiters = "\""
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Verify oc4j module loaded"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = concat {
get_attr {"install_directory"}
"\\conf\\mod_oc4j.conf"
}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = table {
name = "oc4j_mounts"
col_names = "uri","destination"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "Oc4jMount"
exclude_lines_pattern = "#"
delimiters = " "
selected_positions = 2,3
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Local OC4J connectivity"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "local_oc4j"
condition = all {
not_starts_with {
"instance"
get_attr {"oc4j_mounts[].destination"}
}
not_starts_with {
"cluster"
get_attr {"oc4j_mounts[].destination"}
}
not_starts_with {
"ajp"
get_attr {"oc4j_mounts[].destination"}
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "if no mounts, read instances AJP ports"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = runcmd_to_var {
cmd = concat {
get_attr {"process.currentDir"}
"\\..\\..\\opmn\\bin\\opmnctl.exe status -fmt %cmp32%prt32%por40%pid"
}
var_names = table {
name = "instances"
col_names = "oc4j_instance","ports","pid"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "OC4J"
exclude_lines_pattern = ""
delimiters = "|"
selected_positions = 2,3,4
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "extract AJP ports"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = transform {
src_table_name = "instances"
target_table_name = "AJP_PORTS"
operation {set_field {
field_name = "ajp_port"
value = concat {eval {"var = ${instances[].ports}; matcher = var =~ /jms:(\\d+),ajp:(\\d+)/; return matcher[0][2]"}}
}}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "set dest_host"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = set_attr {
"destHost"
get_attr {"computer_system.primaryManagementIP"}
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create broadcast AJP connection"
if {
condition = is_not_empty {get_attr {"local_oc4j"}}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_ora_ias"
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"destHost"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"AJP_PORTS[*].ajp_port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse ep URL"
parse_url_to_var {
from_var_name = "entry_point.url"
to_var_name = "ep_url"
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter oc4j_mounts by uri"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "oc4j_mounts"
condition = any {
contains {
get_attr {"oc4j_mounts[].uri"}
get_attr {"ep_url[1].path"}
}
contains {
get_attr {"ep_url[1].path"}
get_attr {"oc4j_mounts[*].uri"}
}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse ajp:// mounts"
parse_var_to_var {
from_var_name = "oc4j_mounts[*].destination"
to_var_names = table {
name = "ajp_destinations"
col_names = "host","port"
}
parsing_strategy = regex_parsing {regex = "ajp13://(.*):(\\d+)"}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create direct AJP connections"
create_connection {
connection_type = APPLICATION_FLOW
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"ajp_destinations[*].host"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"ajp_destinations[*].port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter instance:// mounts"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "instance_oc4j"
condition = starts_with {
"instance://"
get_attr {"oc4j_mounts[].destination"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse instance:// destinations"
parse_var_to_var {
from_var_name = "instance_oc4j[*].destination"
to_var_names = table {
name = "ias_instances"
col_names = "as_instance","oc4j_instance"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = ":","//"
selected_positions = 2,3
}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "filter cluster:// mounts"
filter {
src_table_name = "oc4j_mounts"
target_table_name = "cluster_oc4j"
condition = starts_with {
"cluster://"
get_attr {"oc4j_mounts[].destination"}
}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "parse cluster:// destinations"
parse_var_to_var {
from_var_name = "cluster_oc4j[*].destination"
to_var_names = table {
name = "as_clusters"
col_names = "cluster_name","oc4j_instance_name"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = ""
exclude_lines_pattern = ""
delimiters = ":","//"
selected_positions = 2,3
}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "get @farm oc4j instances"
runcmd_to_var {
cmd = concat {
get_attr {"install_directory"}
"\\..\\..\\opmn\\bin\\opmnctl @farm status -noheaders -fsep \"|\" -fmt %cmp%prt%clu%ins%por"
}
var_names = table {
name = "oc4j_instances"
col_names = "oc4j_name","cluster_name","instance_name","ports"
}
parsing_strategy = delimited_parsing {
include_lines_pattern = "OC4J"
exclude_lines_pattern = ""
delimiters = "|"
selected_positions = 2,3,4,5
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "handle instance:// mounts connections"
if {
condition = is_not_empty {get_attr {"ias_instances"}}
on_true = merge {
table1_name = "oc4j_instances"
key1_name = "instance_name"
table2_name = "ias_instances"
key2_name = "as_instance"
result_table_name = "oc4j_instances"
unmatched_lines = remove
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "handle cluster:// mounts connections"
if {
condition = is_not_empty {get_attr {"as_clusters"}}
on_true = merge {
table1_name = "oc4j_instances"
key1_name = "cluster_name"
table2_name = "as_clusters"
key2_name = "cluster_name"
result_table_name = "oc4j_instances"
unmatched_lines = remove
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "extract AJP port from oc4j_instances table"
transform {
src_table_name = "oc4j_instances"
target_table_name = "oc4j_instances"
operation {set_field {
field_name = "ajp_port"
value = concat {eval {"m = ${oc4j_instances.ports} =~ /ajp:(\\d+),?/; m[0][1]"}}
}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "extract host name from instance_name"
transform {
src_table_name = "oc4j_instances"
target_table_name = "oc4j_instances"
operation {set_field {
field_name = "hostname"
value = eval {"a = ${oc4j_instances.instance_name}; arr = a.split(\"\\\\.\"); arr[1..<arr.length].join(\".\")"}
}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "split oc4j_instances to instances only"
filter {
src_table_name = "oc4j_instances"
target_table_name = "conn_instances"
condition = is_empty {get_attr {"oc4j_instances[].cluster_name"}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "split oc4j_instances to clusters only"
filter {
src_table_name = "oc4j_instances"
target_table_name = "conn_clusters"
condition = is_not_empty {get_attr {"oc4j_instances[].cluster_name"}}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create APP_FLOW connections"
create_connection {
connection_type = APPLICATION_FLOW
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"conn_instances[*].hostname"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"conn_instances[*].ajp_port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "create CLUSTER connections"
create_connection {
connection_type = CLUSTER
cluster_name = get_attr {"conn_clusters[*].cluster_name"}
entry_point_type = "cmdb_ci_endpoint_ajp"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"conn_clusters[*].hostname"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"conn_clusters[*].ajp_port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "WebLogic connectivity"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Check if WL module configured in Apache"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "wl_identification"
parsing_strategy = delimited_parsing {
include_lines_pattern = "weblogic_module"
delimiters = "\\"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get WebLogic host"
if {
condition = is_not_empty {get_attr {"wl_identification"}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "wl_host"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicHost"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get WebLogic port"
parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "wl_port"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicPort"
delimiters = " "
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Create connection to single WL host"
if {
condition = all {
is_not_empty {get_attr {"wl_port"}}
is_not_empty {get_attr {"wl_host"}}
}
on_true = create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_weblogic"
entry_point_type = "cmdb_ci_endpoint_http"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"wl_host"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"wl_port"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get Weblogic cluster hosts and ports"
if {
condition = is_empty {concat {
get_attr {"wl_host"}
get_attr {"wl_host"}
}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "wl_cluster_hosts_ports"
parsing_strategy = delimited_parsing {
include_lines_pattern = "WebLogicCluster"
delimiters = " "
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Build table of WL hosts and ports in cluster"
parse_var_to_var {
from_var_name = "wl_cluster_hosts_ports"
to_var_names = table {
name = "wl_hosts_ports"
col_names = "wl_hosts","wl_ports"
}
parsing_strategy = delimited_parsing {
delimiters = ":"
selected_positions = 1,2
line_seperator = ","
}
if_not_found_do = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Create connection to cluster WL hosts"
create_connection {
connection_type = APPLICATION_FLOW
target_ci_type = "cmdb_ci_app_server_weblogic"
entry_point_type = "cmdb_ci_endpoint_http"
attributes { // Attribute collection: Collects specific attributes from the discovered CI
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "host"
value = get_attr {"wl_hosts_ports[*].wl_hosts"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "port"
value = get_attr {"wl_hosts_ports[*].wl_ports"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "protocol"
value = get_attr {"entry_point.protocol"}
}
attribute { // Attribute collection: Collects specific attributes from the discovered CI
name = "url"
value = get_attr {"entry_point.url"}
}
}
is_artificial = "false"
traffic_based = "false"
}
}
}
connection {
name = "Jiva Connectivity"
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Match"
match {
contains {
"1"
"1"
}
terminate_op = terminate
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Get jiva conf file"
if {
condition = is_not_empty {get_attr {"config_file"}}
on_true = parse_text_file_to_var {
file_path = get_files_by_filter {
expression = get_attr {"config_file"}
foreach_attribute_name = "forEach" // Attribute collection: Collects specific attributes from the discovered CI
}
var_names = "jiva_conf"
parsing_strategy = delimited_parsing {
include_lines_pattern = "Include"," jiva"
exclude_lines_pattern = "#"
delimiters = "conf/"
selected_positions = 2
}
if_not_found_do = nop {}
cache_flag = 0
}
on_false = nop {}
}
}
step { // Step definition: Represents a single action or set of actions in the pattern
name = "Set conf directory"
if {
condition = is_not_empty {get_attr {"config_file"}}
on_true = parse_var_to_var {
from_var_name = "config_file"
to_var_names = "conf_dir"
parsing_st... |
Apache on UNIX based OS | "I would like for you to help me build a Pattern that helps achieve Discovery of Apache on UNIX base(...TRUNCATED) | cmdb_ci_apache_web_server | 1 - Application | "pattern {\n metadata {\n id = \"28d607dbfead4be3887c843814455100\"\n name = \"Apache on UNIX base(...TRUNCATED) | "pattern {\n metadata { // Metadata section: Contains metadata information about the pattern\n id =(...TRUNCATED) |
Credentialless Discovery Application | "I would like for you to help me build a Pattern that helps achieve Discovery of Credentialless Disc(...TRUNCATED) | cmdb_ci_appl | 1 - Application | "pattern {\n metadata {\n id = \"4197575ec76b32003f199c569b976348\"\n name = \"Credentialless Disc(...TRUNCATED) | "pattern {\n metadata { // Metadata section: Contains metadata information about the pattern\n id =(...TRUNCATED) |
Active Directory Service | "I would like for you to help me build a Pattern that helps achieve Discovery of Active Directory Se(...TRUNCATED) | cmdb_ci_appl_active_directory | 1 - Application | "pattern {\n metadata {\n id = \"f2dfec7d49ba40d69ef705f25c366ac0\"\n name = \"Active Directory Se(...TRUNCATED) | "pattern {\n metadata { // Metadata section: Contains metadata information about the pattern\n id =(...TRUNCATED) |
APIGee Pattern | "I would like for you to help me build a Pattern that helps achieve Discovery of APIGee Pattern. \\n(...TRUNCATED) | cmdb_ci_appl_apigee_srv | 1 - Application | "pattern {\n metadata {\n id = \"3e221256db16d3404c93f3671d9619b8\"\n name = \"APIGee Pattern\"\n (...TRUNCATED) | "pattern {\n metadata { // Metadata section: Contains metadata information about the pattern\n id =(...TRUNCATED) |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 0