SQL Sentry Event Chains

Introduction

An event chain is a series of dependencies between events running on the same server or different servers. There is no limit to the length of a chain or the number of events that can be defined for a chain. To navigate to event chains, select the Event Chains node from the Navigator pane.

SQL Sentry Navigator Pane with the Event Chains Node highlighted and selected.
Add an Event Chain tab with sections to add a name and description.
ItemDescription
NameContains the name of the event chain. This also is the value displayed in the tree view under the Event Chains node.
DescriptionDescriptive text for the event chain.
Created byDisplays the chain creator and the date/time of chain creation.
Updated byIf the chain is updated, displays the updater and date/time of update.
Select Chain InstanceUse this drop-down list to select a past runtime for the chain to view its history.
End TimeWhen viewing a historical chain instance, this shows the time the chain completed.
StatusDisplays the status of the chain being viewed as Ready, Running, or Completed.
Chain EnabledOption to enable or disable the event chain.
EditTo add nodes or make changes to a chain, select this button.
CancelCancels adding an event chain. 
Auto refreshDetermines how often the chain workspace refreshes to show updated information when the chain is currently running.

Note:  Only the initial job of the event chain needs to be scheduled for the chain to run.

Event Chain Examples

Example A

When Job1 (SQL Server job) completes, execute Job2 (SQL Server job). If Job2 succeeds, execute Task A (Windows Task Scheduler Task). If Job2 fails, execute Job3.

Event Chain example with 4 jobs and 2 tasks. Job 1 completes and job 2 executes. If job 2 succeeds, Task A executes.

To accommodate a path that encompasses the same event more than once, and to avoid a circular reference, the concept of nodes are used. A node is simply a unique representation of an event. Even though Job1 is listed twice, the chain can treat the event as two separate instances and apply varying conditions to each instance that provides a greater degree of flexibility.

Circular References

An event chain is a logical workflow through a series of one or more event objects, with each occurrence of an event object represented by a unique event node. A circular reference occurs if the workflow was built to reference an event node a second time. Such a workflow is not allowed in an event chain.

For example, when Event A completes, execute Event C. When Event C completes, execute Event A.

SQL Sentry Circular reference example. When Event A completes, execute Event C. When Event C completes execute Event A.

To allow an event to occur a second time in an event chain, add the object Event A a second time to the object list. Change the To Node in the second link to reference the newly created node. This method can be repeated to allow the event to occur a discrete number of times.  

SQL Sentry Circular reference A1. To allow an event to occur a second time, Object Event A is added as Event A Node A_1.

Adding an Event Chain

  1. Double-click the Event Chains node in the Navigator pane, or select New in the context menu. SQL Sentry Navigator Pane with the Event Chains context menu opened and the New option selected.
  2. Assign the event chain a name and optional description. Add an Event Chain tab with the name Test Event Chain added.
  3. Right-click to add objects that are used in the event chain, or drag-and-drop jobs from the Navigator pane onto the Event Chain diagram. Node names are given to each object.
    Add an Event Chain tab with an added test object that was dragged from the Navigator pane.
  4. Add links to the chain by right-clicking the appropriate node, and then select WorkflowAdd an Event Chain tab with 5 added objects and the context menu opened to Workflow Completed for the test object.
  5. Select the status condition for execution and the Target node. Nodes can be dragged and dropped to reposition for easier viewing of the chain. The Auto Layout toolbar button may also be used once links are established.
    Add an Event Chain tab with 5 added objects. Each object has a workflow completed arrow indicating the order they execute.
    Add an Event Chain tab with 5 added objects and corresponding workflow arrows. The tab  has been arranged using auto layout.
  6. Select Save in the File menu or select the Save iconSQL Sentry Save toolbar button that displays as a floppy disk.to save the chain.

Editing an Event Chain

  1. Select the Event Chain node from the tree view in the Navigator pane, and then select Edit. SQL Sentry Navigator Pane with TestIt event chain selected and the Edit context menu option highlighted.
  2. Select the necessary properties of the event chain. Edit Event Chain tab for TestIt with an Instance selected and the Properties context menu option highlighted.
  3. Select Save in the File menu to save the chain.

Remapping Nodes in an Event Chain

Event Chain nodes can be remapped to other event objects. This can save you time over deleting and recreating nodes in your event chain. When you remap a node in an event chain, the next step(s) in the workflow remain intact. To remap a node, select Remap Node available through the node context menu.

SQL Sentry Edit Event Chain tab with a node selected and the Remap Node context menu option highlighted.

Important:  If any Event Chain nodes or workflow steps are changed, including the remapping of a node, the history for the chain becomes invalid and is lost.

Chain History

To view a historical run of a chain, select the runtime from the Select Chain Instance box. Runtime and status information is displayed for each node. If the object is completed successfully, it has a green background. If it fails, it has a red background. This is also shown for currently executing chains. Currently executing nodes have an orange background.

Event Chain Test Event Chain tab with the Select Chain Instance option highlighted and set to <Current>.

Context Menus

Navigator Pane

SQL Sentry Navigator Pane Event Chain Context menu options.

ItemDescription
OpenOpens the event chain.
EditOpens the event chain in edit mode.
Start ChainStarts all lead nodes of this event chain.
Stop Tracking Node FailuresStops tracking any node failures. 
DeleteDeletes the chain.
ResetResets a currently running chain. 
DisableDisables the chain. 
Change FolderAllows you to move the specified chain to a different organizational folder.

View Mode

Workspace

Event Chain tab displaying 5 events with connected workflows, and the workspace context menu options highlighted.

ItemDescription
RefreshRefreshes the current view. Also done by pressing F5.
PrintPrints the chain diagram.
Print PreviewPreviews the printed chain layout.
Zoom >Zooms in or out to view entire chain.

Node - <Current> Chain Instance

Event Chain tab displaying 5 events with connected workflows, and the node context menu options highlighted.

ItemDescription
Execute NodeAllows you to manually run a node in a chain. If the node is a lead node for a chain, then any child nodes are executed upon completion. No child nodes start if the node being executed is not a lead node.
Jump To >
-- This InstanceBrings up a calendar displaying the selected node's current instance.
-- Last FailureBrings up a calendar displaying the last failure for the selected node.
-- Last InstanceBrings up a calendar displaying the last instance of the selected node.
-- Next InstanceBrings up a calendar displaying the next instance of the selected node.
-- NavigatorNavigates to the selected node in the Navigator pane.
Show >
-- History >
---- 4 HoursDisplays the last four hours of job history for the selected node.
---- 1 DayDisplays the last one day of job history for the selected node.
---- 3 DaysDisplays the last three days of job history for the selected node.
---- 7 DaysDisplays the last seven days of job history for the selected node.
---- 14 DaysDisplays the last 14 days of job history for the selected node.
---- 30 DaysDisplays the last 30 days of job history for the selected node.
-- Runtime StatsShows the current runtime stats for the selected node.
PropertiesViews the properties of the object.

Node - Historical Chain Instance

ItemDescription
Execute NodeAllows you to manually run a node in a chain. If the node is a lead node for a chain, then any child nodes is executed upon completion. No child nodes starts if the node being executed is not a lead node.
Jump To >
-- This InstanceBrings up a calendar displaying the selected node's current instance.
-- Last FailureBrings up a calendar displaying the last failure for the selected node.
-- Last InstanceBrings up a calendar displaying the last instance of the selected node.
-- Next InstanceBrings up a calendar displaying the next instance of the selected node.
-- NavigatorNavigates to the selected node in the Navigator pane.
Show >
-- History >
---- 4 HoursDisplays the last four hours of job history for the selected node.
---- 1 DayDisplays the last one day of job history for the selected node.
---- 3 DaysDisplays the last three days of job history for the selected node.
---- 7 DaysDisplays the last seven days of job history for the selected node.
---- 14 DaysDisplays the last 14 days of job history for the selected node
---- 30 DaysDisplays the last 30 days of job history for the selected node.
-- Runtime statsShows the current runtime stats for the selected node.
Start Chain HereAllows you to execute a chain from a node other than a lead node. When this option is selected, a new chain instance is created that contains a copy of the nodes status for the instance you are viewing.
PropertiesViews the properties of the object.

Edit Mode

Workspace

Edit Event Chain tab displaying 6 events with connected workflows, and the workspace context menu options highlighted.

ItemDescription
Add NodesAllows you to add new jobs or tasks as nodes in the chain.
SaveSaves any changes to the chain.
PrintPrints the chain diagram.
Print PreviewPreviews the printed chain layout.
Auto LayoutOrganizes and arranges the chain into a default flowchart pattern.
Zoom >Zooms in or out to view the entire chain.

Node

Edit Event Chain tab displaying 6 events with connected workflows, and the node context menu options highlighted.

ItemDescription 
WorkflowAllows you to specify the condition on which one node executes another.
Rename NodeRenames the node. This doesn't rename the actual job or task.
Delete NodeDeletes the existing node from the chain.
Remap NodeRemaps the node. 
PropertiesViews the properties of the job or task.

Event Chain Notifications

General Actions

ConditionFired When
Event Chain: StartedAny lead node for an event chain has completed.
Event Chain: CompletedAfter last node in an event chain has completed.
Event Chain: SuccessEvery node in an event chain runs.
Event Chain: FailureOne or more nodes in an event chain don't run.
Event Chain: Runtime Threshold MaxThe event chain runtime exceeds the Maximum Runtime Threshold settings specified for the event chain.
Event Chain: Runtime Threshold MinThe event chain runtime exceeds the Minimum Runtime Threshold settings specified for the event chain.
Event Chain Node: StartedThe Event Chain node starts.
Event Chain Node: CompletedThe Event Chain node completes.
Event Chain Node: SuccessThe Event Chain node completes, reporting a success.
Event Chain Node: FailureThe Event Chain node completes, reporting a failure.
Event Chain Node: Runtime Threshold MaxThe Event Chain node exceeds the maximum runtime threshold specified for the node.
Event Chain Node: Runtime Threshold MinThe Event Chain node exceeds the minimum runtime threshold specified for the node.

When more than one workflow path exists in a chain, the Chain Success and Chain Failure conditions become less valuable since they are based exclusively on whether or not all nodes completed. At that point the Node Success and Node Failure conditions should be used for more accurate status information about the respective nodes and/or paths.

Settings

Event chains and Event Chain nodes support Runtime Threshold settings. These settings are specified as absolute runtimes for both the minimum and maximum runtime thresholds.

SQL Sentry Settings pane displaying Event Chain Node settings.

SettingDescription
Inherit From ParentSpecified whether the Runtime Threshold settings are inherited from the parent object.
Maximum Runtime ThresholdThe maximum allowed runtime for the chain/node.
Minimum Runtime ThresholdThe minimum allowed runtime for the chain/node.

Audit Actions

ConditionFired When
Event Chain ModifiedModifications are made and saved to an event chain.

Event View

SQL Sentry Event Calendar Filter tab displaying varying filter options.

All event chains contain an Event View sub-node. Double-clicking or selecting Open from the context menu produces a calendar of all the objects that are a part of the selected chain. As with any Custom Event View, you have the ability to add Performance Counters to any Event Chain View.

Event Chain Calendar Info

SQL Sentry Event Calendar with an Event Chain selected and the event info pop-up displayed.

All event source objects that appear on a calendar because of an event chain display a small chain glyph in the top left corner.

Additionally, the event source object tooltip displays information about any chain(s) that this object is associated with. An is placed next to the actual chain that created this instance.

Reporting Services Jobs in Event Chains

It is a known limitation that Reporting Services jobs don't work within chains in versions prior to 2.7. This limitation occurs because Reporting Services jobs are filtered out of SQL Sentry as they have no duration and don't reflect the accurate information about the report.

A workaround is available in version 2.7 and later. Normally, SQL Sentry filters out a Reporting Services job. You can force them to stay in the history and alert chaining that they have completed by placing an additional space after the AddEvent call.

For example, if you currently have:

AddEvent @EventType='Test', @EventData= '5B0537EA-7A87-4C8B-B002-03A51DD5100C'

You could change it to:

AddEvent  @EventType='Test', @EventData= '5B0537EA-7A87-4C8B-B002-03A51DD5100C'

After the change is made, reset the chain.

Important:  If you manually modify the SSRS scheduler job step text as described previously, and at a later date make modifications to the report schedule in any SSRS tool, the manual step text changes you made will be overwritten. It is important to remember to make these modifications to the step text again if you have included an SSRS report as a node in an event chain.

Copy Chain

You may run into a situation where you want to create a second chain that is similar to an existing chain, or you want to use an existing chain as a template for a new chain. You can effectively copy a chain using the Save Chain As option on the File menu.

SQL Sentry File toolbar options with the Save Chain As option highlighted.You will then be asked to enter a new name and optional description for the chain. 

Note:  To see new event chains created by other client users, right-click on the Event Chains root node, and then select Refresh.

Organizing Event Chains

Event chains can be organized using custom folder names. Any event chain can be moved into another folder by dragging and dropping it into another folder.

SQL Sentry Navigator Pane with the Event Chains context menu options highlighted.