Setting up email notification
Published 31 January 2017
About email notification
You can set up SQL Monitor to send an email whenever an alert is raised.
Notification behavior is entirely configurable. You can set up SQL Monitor to:
- send an email for every type of alert
- send emails only for those alerts you consider important
- not send emails at all
Once you have set up your basic email notification settings, you can also tweak email notifications at a more granular level - to use a different recipient for an alert on a particular server, for example, or disable notifications for one or more types of alert.
What's in the email?
- the machine and object against which it has been raised
- the alert type and level it was raised at
- the unique ID number that forms part of the URL for this alert
- a hyperlink so that you can open this alert in your browser
Emails sent when a Job failed or Job backup overdue alert is raised will also contain the job name.
Emails sent when a Deadlock alert is raised will contain information about the running SQL processes:
Emails sent when a Long running query alert is raised will contain information about the query:
If you send emails to other people, they'll be prompted for the SQL Monitor password when they follow the link.
When does SQL Monitor send emails?
Each time an alert is raised, it is considered an occurrence of that type of alert, and triggers an email (if email notification is enabled for that type of alert, for that monitored object). For example, if 20 deadlocks occur on one of your instances, 20 emails will be sent, one for each raised alert.
Some types of alerts are continuous (they're raised as Active) and can have a duration. For example, a Backup overdue alert is considered Active until the backup is performed. In this case, only a single email will be sent when the problem is first detected. If the problem escalates, you can choose to receive further emails. See the Also send emails when section below.
Limiting the number of emails sent by SQL Monitor
SQL Monitor limits the number of emails sent to make sure it doesn’t flood your mail servers. It won’t send more than 30 emails per alert, per object, within a 24-hour period.
For example, if 35 deadlocks occur on a particular database within 24 hours, you’ll receive one email for each of the first 30 occurrences, and then a warning email explaining that no more emails will be sent. The warning email also contains instructions for adjusting the daily email limit.
This limit is for all emails from SQL Monitor, regardless of recipient.
To set up email notification
Go to the Configuration tab. Under Alerts and metrics, select Notification settings:
Enabling or disabling all emails
If you want to use email notification in SQL Monitor, select the Send emails when alerts are raised checkbox:
If this checkbox is cleared, SQL Monitor will not send any emails, regardless of all other settings.
Setting up the default email address
Enter an email address that all SQL Monitor emails will be sent to by default in the Send emails to box. This is the email address that will be shown on the Alert settings page as the <Default recipient>:
To add multiple email addresses, separate each with a comma. You can later customize the email recipient for different alert types or servers. If you subsequently change the email address in the Send emails to box, this will be automatically applied to any alerts that use <Default recipient>. Alerts where you have specified a different email recipient will not be affected.
Entering a send from email address
The Send from email address is the email address that will appear in the From field for all email messages sent by SQL Monitor when an alert is raised.
Enter the email address in the format: firstname.lastname@example.org. You can only send a test email when a valid address in the right format has been entered. You can enter the Send emails to and Send from addresses before supplying your mail server details, but you won't be able to send the test email until your mail server details are provided. See Enter your mail server settings below.
Also send emails when
These are global options that apply to alerts that are raised with a status of Active.
Some types of alerts have a status of Event - their level cannot increase, and their status does not change to ended, so these options do not apply. For more information, see List of alerts.
An alert level increases
Some alerts can be configured with multiple thresholds: Low, Medium and High. These alerts are raised with a status of Active and can escalate automatically to a higher level when another threshold is passed. Select An alert level increases to specify that if this happens, a subsequent email should be sent.
No emails will be sent if:
- the level of an Active alert is automatically downgraded (for example, drops from High to Medium)
- an Active alert is downgraded and then subsequently escalates to its previous higher level
An alert's status changes to Ended
Active alerts automatically change to Ended when the condition that triggered them no longer applies; for example if memory used falls below the defined threshold for the alert, or if a backup is performed. Select An alert's status changes to Ended to specify that an email should be sent to inform the recipient that this particular occurrence of the alert has ended.
PagerDuty is an alarm aggregation and dispatching service. It collects alerts from your monitoring tools in a single repository, and notifies users via SMS, phone calls or emails. It enables to you to add alert severity filters, on-call scheduling, escalation policies and incident tracking to SQL Monitor.
How do I integrate SQL Monitor with PagerDuty?
There are integration guidelines in PagerDuty's Red Gate SQL Monitor Integration Guide. The only configuration change required in SQL Monitor is to add the PagerDuty integration email address to the Send emails to section of the Configuration > Email settings page.
Once you've created a SQL Monitor service in PagerDuty, you can edit the service settings. By default, PagerDuty notifies users of alerts with a status of high or medium, and low status alerts are ignored. You can choose to be notified of all alerts, or high status alerts only.
Under the heading Also send emails when, if you select An alert's status changes to Ended (see image below), then when an alert's status changes to Ended, the relevant PagerDuty ticket will be marked as "resolved".
Enter your mail server settings
If you don't know the DNS name or the IP address and port number of your outgoing SMTP mail server, check with your system administrator and enter them in the relevant text boxes.
Select Require a secure (SSL or TLS) connection to enable explicit SSL email. Once the SMTP connection is established, SSL is requested and the message delivered using the supplied credentials.
Also check with your administrator to find out whether your mail server requires a user name and password. If this is the case, select the Mail server requires a user name and password checkbox and enter details.
When SQL Monitor sends an email notification, it includes a hyperlink to the alert. This hyperlink contains the name of your website. In some situations, this link will not work for other people (for example if the URL is localhost:<portnumber> this will only open SQL Monitor on your local computer).
If this is the case, you can enter the fully qualified URL to be included in the email hyperlink. Enter the URL in the Fully qualified website URL box.