Previous Topic: Create DM Script-based AlertsNext Topic: Configure Alert Templates


Create Remediation Script Using DM Script

You can create custom remediation scripts based on DM Script. Deploy the script to Script Directory, which is configured at Configuration Policy, DSM, Health Monitoring, Health Monitoring Agent, ScriptDir, on the agent machines before configuring alerts to use this remediation script.

Follow these steps:

  1. Navigate to Control Panel, Configuration, Configuration Policy, DSM, Health Monitoring, Alert Configuration, and Alerts.
  2. Select any alert to which you want to configure remediation action.
  3. Under the remediation section of the alert, specify the DM script name that is deployed to the agent machines.
  4. Specify the parameters in the Parameters fields.
  5. In the message field, add any text related to the alert (have parameters if needed).
  6. Set other alert parameters and apply to the agents for monitoring.

DM Script Remediation Example:

The following DM script reports whether the remediation has been successful or not to the HM agent by invoking hmAlertOPFormatter. For example,

dim remediationStatus as string
dim validate as string
dim remediationInfo as string
dim ret as integer
dim commandline as string
'Do your remediation here.
'...
'Set the value of remediationStatus to either 0 or 1. 0 is for remediation successful and 1 is for remediation failure
'Set the value of remediationInfo to any string that you want to displayed in WAC for this remediation. IDS_REM_SUCCESS and IDS_REM_FAILURE are standard string IDs that can be used to represent success and failure respectively.
'Set valudate to 1 if alert validation is required post remediation or 0 otherwise
' At bottom of your DM script, execute hmAlertOPFormatter
' to notify HM Agent about the status of remediation.
If left(osstring, 3) = "Win" Then
	commandline = "hmAlertOPFormatter.exe"
Else
	commandline = "hmAlertOPFormatter"
Endif
commandline = commandline + “ statuscode=” + remediationStatus + “ validate= “ + validate + “ statusmsg=” + remediationInfo
ret = Exec(commandline, TRUE, 0)

To notify Health Monitoring Agent about the status of remediation, execute the following command in the DM script:

hmAlertOPFormatter executable
hmAlertOPFormatter.exe statuscode=0|1 validate=0|1 statusmsg=”<Any string>”
stauscode=0|1

Use value 0, if remediation is successful. Use value 1, if remediation failed.

Validate=0|1

Use value 0, if no validation needs to be done to check whether the remediation has actually fixed the problem. Use 1 to inform Health Monitoring Agent to perform a validation and report remediation failed message if the alert condition still exists even after remediation.

statusmsg

(optional) String message representing the status of the remediation.