Saturday, September 21, 2024
Google search engine
HomeData Modelling & AIAdvisory Conditions : Available Actions

Advisory Conditions : Available Actions

Introduction

SentryOne Advisory Conditions provide a powerful and flexible solution for monitoring environments across a diverse range of situations. This post focuses on the available actions and alerting options for Advisory Conditions. As shown below, the options for available actions are as robust as the conditions themselves.

To illustrate how the actions work, I’ve created a dummy condition that checks for 1=1. Therefore, it will evaluate to True each time during testing.

Example Advisory ConditionFigure 1: Example Advisory Condition

Available Actions

First of all, we need to add an action to a condition. If you right-click on a condition in the Conditions List and select Add Actions from the context menu, or go to View -> Conditions -> Add, the Available Actions dialog shown below appears:

Actions Selector: Advisory ConditionsFigure 2: Actions Selector: Advisory Conditions

Second, we need to check an action to add and click OK. Finally, we’ll configure it through the Conditions panel. The Conditions panel is also accessible via the Conditions shortcut on the upper right corner of the screen (above the Settings shortcut). Through the Action Settings tab, we’ll need to configure the details of the action, such as a contact to alert, or a statement to execute.

Setting the Actions

Execute Job

First on the list of available actions is Execute Job. Consequently, this requires SQL Server Agent running and the desired job already created on SQL Server to configure this action.

Execute Job SettingsFigure 3: Execute Job Settings

Since this is for a quick example, the “AdvisoryConditionJob” merely performs a select from the SentryOne database. I can look at the Job History on SQL Server to verify its execution:

Executed Job HistoryFigure 4: Executed Job History

Due to checking “Write to the Windows Application event log” for “When the job completes” under Job Properties, SQL Server logs the event to Windows as well:

Executed Job Logged to Windows EventsFigure 5: Executed Job Logged to Windows Events

Execute Process

Next is the option to execute a process based on a condition. In this example, I output the results of netstat -e -s to C:\Output\netstatfile.txt.

Action Settings: Execute ProcessFigure 6: Action Settings: Execute Process

When the condition evaluates to True, the process copies network statistics from netstat into the text file:

Process CompletedFigure 7: Process Completed

This example requires enabling xp_cmdshell. If xp_cmdshell is disabled, the monitoring service sends a notice of the failed action:

[Global]: GLOBAL
[Message]: Monitoring Service: Action Failed
[Action]: Executes a process on a remote SQL Server.
[Error]: An error has occurred:
Message: SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', search for 'xp_cmdshell' in SQL Server Books Online.

 

You may use SentryOne System Parameters when using the Execute Process and Execute SQL actions. See the User Guide for a detailed list of the parameters.

Execute SQL

You may want to execute a SQL statement in response to a condition. Lori Edwards (b|t) walks through an example in her post, “Customizing Your Alert Emails in SentryOne.”

Define the SQL statement to execute when a condition transpires in the Action Settings tab, as shown below:

Action Settings: Execute  SQLFigure 8: Action Settings: Execute SQL

As documented in Lori’s post, you can use more complex SQL statements here to meet your requirements.

Log To Database

Logging Advisory Condition messages to the SentryOne Database is another available action. Conditions logged to the database are viewable through the Actions Log in the SentryOne client. These actions are available directly from the database via ObjectConditionActionHistory and vwObjectConditionActionHistory.


Logged to DatabaseFigure 9: Logged to Database

Note that the Actions Log allows you to see many other actions, such as when the condition was disabled/enabled.

Log To Disk

You can also log Advisory Condition Alerts to a file on the machine running the SentryOne Monitoring Service. To use this option you will need to set the file name and location via the Action Settings tab. In this example, I created a SentryOne folder on the C:\ and a new text file named “advisoryconditions.txt”.

Available Actions - Log to Disk SettingsFigure 10: Log to Disk Settings

When the condition evaluates to True, the related-information for that evaluation is logged to disk:

Logged to DiskFigure 11: Logged to Disk

Log to Windows Event Log

Logging to the Windows Event Log will send pertinent data about the condition to the Application Event Log on the machine running the SentryOne Monitoring Service.

Under the Action Settings tab, you may change the default Log Type and Event ID information. The Log Type may be set to “Information” (the default), “Warning”, or “Error”. The Event ID is “0” by default. You may use an Event ID between “0” and “65535”.

Log to Windows Event Log SettingsFigure 12: Log to Windows Event Log Settings

View logged events under Event Viewer -> Windows Logs -> Application:


Logged to Windows Event LogFigure 13: Logged to Windows Event Log

Run QuickTrace

Run QuickTrace allows you to kick off a QuickTrace whenever a condition occurs. The Action Settings tab provides options for the server, duration, collection of statement events, and a maximum number of rows to collect. Note that a QuickTrace is not filtered to collect only the intensive events, and you’ll want to limit the collection time/rows for performance considerations.

Available Actions - Actions Settings: Run QuickTraceFigure 14: Actions Settings: Run QuickTrace

Details from the QuickTrace appear on the QuickTrace tab in Performance Analysis.

Viewing QuickTraceFigure 15: Viewing QuickTrace

Send Email

This options allows you to send an email (or multiple emails) whenever a condition happens. As mentioned before, Lori walks through an example in her post, “Customizing Your Alert Emails in SentryOne.”

Available Actions Send An Email SettingsFigure 16: Send An Email Settings

In the email settings (above), you also have the option to set the importance of the email, as well as the sender. This can be particularly helpful if you want to set up filters for emails or ensure that important alerts aren’t trapped by your current filters.

Send An EmailFigure 17: Email Received

Send Page

Selecting Send Page from Available Actions sends a page to specified users/groups available in your contacts:

Send PageFigure 18: Send Page Settings

The pager address pulls from the contact information. I don’t have an actual pager service (or pager, for that matter), so I put the text message email address to my phone into that field as shown below:

Contacts Pager AddressFigure 19: Pager Address in Contacts Users/Groups

Finally, I captured a screen of the message on my phone to illustrate what that looks like:

Page MessageFigure 20: Text Message via Page

Send SNMP Trap

This option allows you to send a Simple Network Management Protocol (SNMP) trap notification. Traps are one of the five main types of SNMP messages. See the SentryOne User Guide for information on SNMP configuration. There are no configuration options on the Action Settings tab when using SNMP traps.

To use SNMP Traps, you must configure the SNMP settings under Global Settings in the SentryOne client:

SNMP Global SettingsFigure 21: SentryOne SNMP Global Settings

You’ll need a way to view the SNMP traps, as well. ManageEngine provides a Free SNMP MIB Browser.

Sent to Alerting Channels

This is the default action for all Advisory Conditions. It displays the alert on the client in different areas. For example, I set the Evaluates to True condition to Highlight “Windows: Network In” on the Dashboard Chart.

Highlight on DashboardFigure 22: Highlight on Dashboard

The Action Settings tab allows configuration of the alerting channels as well as the option to auto-assign this event:

Action Settings Alerting ChannelsFigure 23: Action Settings Alerting Channels

As a result of selecting “Windows: Network In” on the condition, that’s where it is highlighted on the Performance Advisor Dashboard:

Alert Highlighted on DashboardFigure 24: Alert Highlighted on Dashboard

Since I assigned Events Log Entries to myself when configuring the action, that is automatically assigned as shown in the Events log for this condition:

Event Logged and AssignedFigure 25: Event Logged and Assigned

Snoozing and Disabling

Snoozing

There may be times when you don’t want a condition to send alerts. For a temporary scenario, you may right-click on a condition in the Conditions list and select Snooze (for this condition or all conditions) to do that for a specified period of time (1 hour, 4 hours, 8 hours, 1 day, 3 days, or 1 week are the choices). This can be undone by right-clicking and selecting Unsnooze.

Disabling

There may also be conditions that are not applicable to your needs (or perhaps you’ve copied and modified conditions to more specifically meet your needs). If you do not want a condition to evaluate, right-click and select Disable. Reverse this setting by right-clicking and selecting Enable.

Summary

As shown in this post, the automatic alerts and responses (e.g. executing a job, process, or SQL statement) available for Advisory Conditions are vast. While many of these examples have been on the simple side of things, I hope you can imagine ways to leverage these available actions to create more complex and creative solutions for your scenarios as-needed.

Melissa is the Product Education Manager at SentryOne. Melissa has over a decade of experience with SQL Server through software performance and scalability testing, analysis and research projects, application development, and technical support.

RELATED ARTICLES

Most Popular

Recent Comments