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.
Item | Description |
---|---|
Name | Contains the name of the event chain. This also is the value displayed in the tree view under the Event Chains node. |
Description | Descriptive text for the event chain. |
Created by | Displays the chain creator and the date/time of chain creation. |
Updated by | If the chain is updated, displays the updater and date/time of update. |
Select Chain Instance | Use this drop-down list to select a past runtime for the chain to view its history. |
End Time | When viewing a historical chain instance, this shows the time the chain completed. |
Status | Displays the status of the chain being viewed as Ready, Running, or Completed. |
Chain Enabled | Option to enable or disable the event chain. |
Edit | To add nodes or make changes to a chain, select this button. |
Cancel | Cancels adding an event chain. |
Auto refresh | Determines how often the chain workspace refreshes to show updated information when the chain is currently running. |
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.
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.
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.
Adding an Event Chain
- Double-click the Event Chains node in the Navigator pane, or select New in the context menu.
- Assign the event chain a name and optional description.
- 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 links to the chain by right-clicking the appropriate node, and then select Workflow.
- 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.
- Select Save in the File menu or select the Save icon to save the chain.
Editing an Event Chain
- Select the Event Chain node from the tree view in the Navigator pane, and then select Edit.
- Select the necessary properties of the event chain.
- 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.
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.
Context Menus
Navigator Pane
Item | Description |
---|---|
Open | Opens the event chain. |
Edit | Opens the event chain in edit mode. |
Start Chain | Starts all lead nodes of this event chain. |
Stop Tracking Node Failures | Stops tracking any node failures. |
Delete | Deletes the chain. |
Reset | Resets a currently running chain. |
Disable | Disables the chain. |
Change Folder | Allows you to move the specified chain to a different organizational folder. |
View Mode
Workspace
Item | Description |
---|---|
Refresh | Refreshes the current view. Also done by pressing F5. |
Prints the chain diagram. | |
Print Preview | Previews the printed chain layout. |
Zoom > | Zooms in or out to view entire chain. |
Node - <Current> Chain Instance
Item | Description |
---|---|
Execute Node | Allows 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 Instance | Brings up a calendar displaying the selected node's current instance. |
-- Last Failure | Brings up a calendar displaying the last failure for the selected node. |
-- Last Instance | Brings up a calendar displaying the last instance of the selected node. |
-- Next Instance | Brings up a calendar displaying the next instance of the selected node. |
-- Navigator | Navigates to the selected node in the Navigator pane. |
Show > |
|
-- History > |
|
---- 4 Hours | Displays the last four hours of job history for the selected node. |
---- 1 Day | Displays the last one day of job history for the selected node. |
---- 3 Days | Displays the last three days of job history for the selected node. |
---- 7 Days | Displays the last seven days of job history for the selected node. |
---- 14 Days | Displays the last 14 days of job history for the selected node. |
---- 30 Days | Displays the last 30 days of job history for the selected node. |
-- Runtime Stats | Shows the current runtime stats for the selected node. |
Properties | Views the properties of the object. |
Node - Historical Chain Instance
Item | Description |
---|---|
Execute Node | Allows 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 Instance | Brings up a calendar displaying the selected node's current instance. |
-- Last Failure | Brings up a calendar displaying the last failure for the selected node. |
-- Last Instance | Brings up a calendar displaying the last instance of the selected node. |
-- Next Instance | Brings up a calendar displaying the next instance of the selected node. |
-- Navigator | Navigates to the selected node in the Navigator pane. |
Show > |
|
-- History > |
|
---- 4 Hours | Displays the last four hours of job history for the selected node. |
---- 1 Day | Displays the last one day of job history for the selected node. |
---- 3 Days | Displays the last three days of job history for the selected node. |
---- 7 Days | Displays the last seven days of job history for the selected node. |
---- 14 Days | Displays the last 14 days of job history for the selected node |
---- 30 Days | Displays the last 30 days of job history for the selected node. |
-- Runtime stats | Shows the current runtime stats for the selected node. |
Start Chain Here | Allows 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. |
Properties | Views the properties of the object. |
Edit Mode
Workspace
Item | Description |
---|---|
Add Nodes | Allows you to add new jobs or tasks as nodes in the chain. |
Save | Saves any changes to the chain. |
Prints the chain diagram. | |
Print Preview | Previews the printed chain layout. |
Auto Layout | Organizes and arranges the chain into a default flowchart pattern. |
Zoom > | Zooms in or out to view the entire chain. |
Node
Item | Description |
---|---|
Workflow | Allows you to specify the condition on which one node executes another. |
Rename Node | Renames the node. This doesn't rename the actual job or task. |
Delete Node | Deletes the existing node from the chain. |
Remap Node | Remaps the node. |
Properties | Views the properties of the job or task. |
Event Chain Notifications
General Actions
Condition | Fired When |
---|---|
Event Chain: Started | Any lead node for an event chain has completed. |
Event Chain: Completed | After last node in an event chain has completed. |
Event Chain: Success | Every node in an event chain runs. |
Event Chain: Failure | One or more nodes in an event chain don't run. |
Event Chain: Runtime Threshold Max | The event chain runtime exceeds the Maximum Runtime Threshold settings specified for the event chain. |
Event Chain: Runtime Threshold Min | The event chain runtime exceeds the Minimum Runtime Threshold settings specified for the event chain. |
Event Chain Node: Started | The Event Chain node starts. |
Event Chain Node: Completed | The Event Chain node completes. |
Event Chain Node: Success | The Event Chain node completes, reporting a success. |
Event Chain Node: Failure | The Event Chain node completes, reporting a failure. |
Event Chain Node: Runtime Threshold Max | The Event Chain node exceeds the maximum runtime threshold specified for the node. |
Event Chain Node: Runtime Threshold Min | The 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.
Setting | Description |
---|---|
Inherit From Parent | Specified whether the Runtime Threshold settings are inherited from the parent object. |
Maximum Runtime Threshold | The maximum allowed runtime for the chain/node. |
Minimum Runtime Threshold | The minimum allowed runtime for the chain/node. |
Audit Actions
Condition | Fired When |
---|---|
Event Chain Modified | Modifications are made and saved to an event chain. |
Event View
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 EventView, you have the ability to add Performance Counters to any Event Chain View.
Event Chain Calendar Info
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.
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.
You will then be asked to enter a new name and optional description for the chain.
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.