Example 10: Remediation Workflow

In this example we see an example of a Remediation workflow for restarting a WebLogic server and it's corresponding Remediation Action to start a Weblogic server from an alert.

Start a WebLogic Server Workflow
This sample workflow shows how to start a WebLogic workflow, this workflow will be called by the remediation action definition.
{
  "name": "Web Logic Server Start Demo",
  "workflow": {
    "plan": {
      "name": "WebLogic_Start_WF",
      "steps": [{
        "name": "start_weblogic",
        "type": "ENTITY",
        "input": {
          "command": "/bin/sh",
          "arguments": ["/home/u01/WebLogic1221/user_projects/domains/medrec/startWebLogic.sh"],
          "credential": "MonitorCred"
        }
      }]
    },
    "input": {
      "workers": {
        "thread1": {
          "entity": {
            "entityByName": {
              "name": "weblogicserver193.example.com",
              "type": "omc_host_linux"
            }
          }
        }
      }
    }
  }
}
Remediation Action definition using Start WebLogic Workflow
This Remediation Action includes the Start WebLogic Server workflow from the previous example and incorporates the entity variable substitution section that will be define via the alert what server needs to be restarted. The entity variable substitution section is defined by this line of code: "name": "${entity.hostName}",.
{ "type": "OrchestrationWorkflow",
  "name": "Auto Remediate WebLogic Server Start",
  "requestBody":{
  "name": "Auto Remediate WebLogic Server by Starting",
  "workflow": {
    "plan": {
      "name": "WebLogic_Start_WF",
      "steps": [{
        "name": "start_weblogic",
        "type": "ENTITY",
        "input": {
          "command": "/bin/sh",
          "arguments": ["/home/u01/WebLogic1221/user_projects/domains/medrec/startWebLogic.sh"],
          "credential": "emcosComplianceCred"
        }
      }]
    },
    "input": {
      "workers": {
        "thread1": {
          "entity": {
            "entityByName": {
              "name": "${entity.hostName}",
              "type": "omc_host_linux"
            }
          }}}}}
},
  "responseBody": {
    "annotation": "${'Submitted workflow 'response.name'. Submission Id = 'response.submissionId}"
  }}