Event rule for sending e-mail with context-sensitive URL

One of the most common requests is for Workload Scheduler to send the output of jobs ended in error to a user. The built-in event-driven workload automation module seems well-suited to the task. However, there are a few problems.

  1. There is no event rule action for gathering a job's output. You must use an external (generic) action for that purpose. If you use a generic action, you must also write it to perform the e-mail sending functions on your own.
  2. Even if there were a way to gather a job's output, sending it via e-mail is not very secure. There is no way to prevent a user forwarding (or plain ignoring) the job output contents around.

The solution, then, is to integrate the event management with some other mechanism. The best approach is to integrate with a trouble-ticketing system, such as IBM Control Desk, to manage the management, messaging, logging, and escalation procedures. Control Desk integration is built into Workload Scheduler; there is an event rule action you can easily use to open tickets for all sorts of Workload Scheduler events.

Failing that, the next best option is to send a user a message which contains the relevant job information, along with a link to enter the Workload Scheduler console (with proper authentication) and manage the job properly. Fortuneately, this is easy to setup.

  1. Create an event rule to manage the messaging.
  2. In the event rule triggers, select the Workload Scheduler status change events on which you want to notify.
  3. In the event rule actions, use the e-mail sending task, and fill the Subject and To fields with the relevant information. Remember, you can use variables from the event trigger inside the Subject line to provide the recipients with good information about the problem, without even opening the message.
  4. In the e-mail task, add a Body field, and insert text like the following message into the e-mail body.
For your attention:
Job workstation=%{jobStatChgEvt1.Workstation}
Job stream workstation=%{jobStatChgEvt1.JobStreamWorkstation}
Job stream=%{jobStatChgEvt1.JobStreamName}
Job=%{jobStatChgEvt1.JobName}
Internal status=%{jobStatChgEvt1.InternalStatus}
Occurred at %{jobStatChgEvt1.TimeStamp} on %{jobStatChgEvt1.Hostname}
Extra message: %{jobStatChgEvt1.ErrorMessage}
Click the following link to review the status and take action:

https://dynwrkcons.example.com:16311/ibm/console/xLaunch.do?pageID=com.ibm.tws.WebUI.External.navigation&showNavArea=false&action=BrowseJobs&hostname=ws93mdm.example.com&port=31117&workstation=%{jobStatChgEvt1.JobStreamWorkstation}&jobstream=%{jobStatChgEvt1.JobStreamName}&job=%{jobStatChgEvt1.JobName}

The Workload Scheduler event processor replaces the variables (insideĀ  %{} tags) with values from the actual job status change event, and provides the e-mail recipient with a clickable URL which opens the Dynamic Workload Console in a monitoring task pre-filtered with the job that caused the event.

Tags: