Skip to main content

getJDBCEnrichment

A JDBC Enrichment Workflow Engine function that adds data to alerts or Situations from a JDBC database. The destination argument allows the destination for the enrichment data to be modified from the default custom_info.enrichment to another location under custom_info or even to a workflowContext key.

This function relates directly to the database and table definitions from your JDBC Enrichment integration.

This function can save results to the workflowContext.

This function is available as a feature of the Add-ons v1.3 download and later.

NOTE: This topic reflects updates to the getJDBCEnrichment function in the Add-ons 2.5 release. For more information, see Moogsoft Add-ons.

This function is available for JDBC Enrichment workflows.CEventTypes, alerts, and Situations.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function getJDBCEnrichment takes the following arguments:

Name

Required

Type

Description

databaseDefName

Yes

String

Name of the database definition from the JDBC Enrichment integration.

tableDefName

Yes

String

Name of the table definition from the JDBC Enrichment integration

value1

No

String

Alert property to use in the Query field of the table definitions in the JDBC Enrichment integration. For example, "source", or "custom_info.host_name".

value2

No

String

Alert property to use in the Query field of the table definitions in the JDBC Enrichment integration. For example, "source", or "custom_info.host_name".

destination

No

string

Use an alternative "custom_info "or workflowContext destination instead of the default: "custom_info.enrichment".

Enriching Situations

To use the JDBC Enrichment integration with Situations, you must first add the JDBCEnrichmentWFE.js, moobot to a Situation moolet.

For example, to add to the “Situation Inform Engine”, update $MOOGSOFT_HOME/config/moolets/situation_inform_workflows.conf to include the JDBCEnrichmentWFE.js moobot:

{
    name            : "Situation Inform Engine",
    classname       : "com.moogsoft.farmd.moolet.workflowengine.CWorkflowEngine",
    run_on_startup  : true,
    metric_path_moolet : false,
    moobot          : [ "WorkflowEngine.js", "MicroFocusOOActions.js", "AutomationWorkflowEngine.js", "AyehuActions.js", "JDBCEnrichmentWFE.js" ],
    message_type: "situation",
    inform_engine: true
}

When you restart the moolet, the getJDBCEnrichment function will be available.

Using with the “Situation Inform Engine” is very similar to using the “JDBC Enrichment Workflows” for alerts.

  1. Create a JDBC enrichment workflow in the “Situation Inform Engine” called “Enrich Situation”:

    1. Add an action using the getJDBCEnrichment function.

    2. Configure the arguments according to the database definition you configured in the JDBC Enrichment integration.

  2. Add a workflow called “Forward to JDBC Enrichment” as the last workflow in “Situation Workflows”.

    Add an action for forward to the “Enrich Situation” workflow in the “Situation Inform Engine” using the sendToWorkflow function.

Examples using the destination argument

The following example demonstrates typical use of Workflow Engine function getJDBCEnrichment. It assumes you have set up and configured the JDBC Enrichment integration with:

  • A database definition of "localmdb".

  • A table definition name of "ci"

See Enrich Alerts Using a JDBC Data Source for the full workflow.

Example 1. Retrieve data from a record in an external database and store specific columns in custom_info

To retrieve data from a record in an external database and store specific columns in the alert’s custom_info, set the following:

  • databaseDefName: localcmdb

  • tableDefName: ci

The UI translates your settings to the following JSON:

{"databaseDefName":"localcmdb","tableDefName":"ci"}

The function retrieves the data and adds it to custom info:

{
  "enrichment": {
    "HostDetails": {
      "OS Version": "2.6.9-22.0.1.ELsmp",
      "SupportGroup": "Linux Server",
      "Class": "Linux Server"
    }
  },
  "mooghandling": {
    "isEnriched": true
  }
}

Under the default location custom_info.enrichment.



Example 2. Store the results under custom_info.ci_info

To instead store the results under custom_info.ci_info, supply the following arguments:

  • databaseDefName: localcmdb

  • tableDefName: ci

  • destination: custom_info.ci_info

The UI translates your settings to the following JSON:

{"databaseDefName":"localcmdb","tableDefName":"ci", "destination": "custom_info.ci_info"}

The function retrieves the data and adds it to custom info under the alternative path:

{
  "ci_info": {
    "HostDetails": {
      "OS Version": "2.6.9-22.0.1.ELsmp",
      "SupportGroup": "Linux Server",
      "Class": "Linux Server"
    }
  },
    "mooghandling": {
    "isEnriched": true
  }
}


Example 3. Save the data to the workflow context under the key ci_info

To instead save the data to the workflow context under the key ci_info, supply the arguments:

  • databaseDefName: localcmdb

  • tableDefName: ci

  • destination: workflowContext.ci_info

The function retrieves the data and adds it to workflowContext:

{
  "ci_info": {
    "HostDetails": {
      "OS Version": "2.6.9-22.0.1.ELsmp",
      "SupportGroup": "Linux Server",
      "Class": "Linux Server"
    }
  }
}