Customize SentryOne Message Text

Allen White

Published On: March 20, 2018

Categories: Alerting, SQL Sentry, SentryOne 0

One of the great things about the SentryOne solution is that it's designed to let you know when problems exist. The last thing you want to do each day is pore over log files looking for where problems occurred, so you can address them. However, there are cases where you need to make sure that the message format is consumable by another application. We've got you covered there, as we allow you to edit the messages to meet your needs.

Here's an example of a typical message.

Example message Example Message


This message contains information that will help you diagnose and solve the problem that caused it to occur. If you need to make changes to the format, to feed into a ticketing system, for example, you can.

The first thing you need to do is to determine what alerts need to have custom messages. In the Condition pane, select the condition you want to customize, then click on the Message tab below the conditions, and you can then click the Edit button to make changes.

Select Condition to Edit Message Select Condition to Edit Message


The SentryOne messages are defined by XML, and like most everything else in the SentryOne environment, inheritance plays a big part. Each message format can use the Imports attribute to inherit from another template, so if there's only one part of the message you need to change, you can make that change and let the inheritance features "fill in" the rest of the details.

Here's the window which opens up once you click the Edit button:

Message Edit Window Message Edit Window


Each message is broken up into three parts, the format element, the tokenSets element and the body element. The format element defines the style of the message, the tokenSets element defines the tokens associated with a given message, and is not changeable, as they are dependent on the condition that caused the action to fire. The body element is where you'll make your changes.

The panels on the left of the message edit window include the list of tokens, a list of text items, and a list of formats you can use in your customization. You can copy from these panels to configure your message to your specifications.

The panels on the right of the message indicate the conditions that use the template you're editing. You can include the conditions that you want to use your customized message by ensuring that those conditions are all checked in the right panel.

In the center of the window you'll see the panels containing the Message Level XML, the Complete XML, and the Message Sample. The changes you make in the Message Level XML window will be reflected in the Complete XML and Message Sample windows.

Message Level XML Message Level XML


One interesting thing you'll find is that the Before or After attributes are used to define the order of the sections in the message. To customize the message text you add tokens to the work area, then set the attributes of the tokens. As you make changes to the message, the Message Sample pane will show you the effect of the changes you're making.

Customized Message Sample Customized Message Sample


When you’ve completed the changes, give your new template a name, and save it. Any time the selected conditions become true and the alert fires, the message will be formatted using your new template.

Allen (@SQLRunr) is a Microsoft MVP and the Senior Technical Training Specialist for SentryOne. He's worked with SQL Server for more than 20 years in a variety of roles - developer, administrator, architect, analyst.