How to see current customized alert settings in Redgate Monitor How to see current customized alert settings in Redgate Monitor

How to see current customized alert settings in Redgate Monitor

There are two ways to view the currently customized alert settings in Redgate Monitor.

Using the Redgate Monitor UI

On the Configuration > Alert settings page, at the left of the screen, there is a hierarchy tree of all the entities.  Any entity that is bold in this list indicates that there is an alert customized at this level and the number in parentheses after the entity name indicates the number of alerts customized at that specific level. This count does not include any at sub-levels. You may need to click the + symbol on the vertical line to expand the left panel.

In this image you can see there is one alert customized at the "All Servers" level, two alerts customized at the "Production" group level, one at the "ps-alexb2" machine level and one each at "sql2008r2" and "sql2012" instance levels:


When you select the entity level in the hierarchy tree, on the right-hand side you will then see the customized alerts are in bold font and have <This level> in the "Inherited from" column.

Using the support log retrieval

A CSV containing a list of the customized alerts is provided from the support log retrieval function on the Configuration page by clicking on the "Retrieve all log files" link in the Diagnostics section. There are not entries for alerts with the default settings.

This will produce a zip file that includes the AlertConfiguration.csv file with every customized alert and the details thereof listed.  Inside of the zip file there will be a folder for each base monitor found in the Configuration > Base Monitor connections page.  Inside of the base monitor folder open the RepositoryInformation folder and then choose the aforementioned AlertConfiguration.csv file.

The file lists all of the customized alerts and also includes all alerts for custom metrics at the root level (in addition to any other customization). The first column indicates at what level of the hierarchy the alert is customized, the name of the entity is in columns 2-4, the alert type and name is in columns 5 and 6, with the sub-type for custom metrics that you can correlate to the the [settings].[CustomAlertDefinitions] table in column 7. The actual configuration XML is listed in column 8, whether it is enabled (0 or 1) is in column 9, whether any alert notification types are disabled (0 or 1) column 10 and the custom email addresses in column 11.

Using the PowerShell API

Another option is to use the PowerShell API-  you can see examples of how to use this from within the product at Configuration > View example PowerShell scripts. The Get-SqlMonitorAlertSettings​ will get settings related to the entities and you could use something like the following to get various information about them.

This relatively basic example shows alert settings for the standalone machine alert types $StandaloneMachineAlertTypes for all the entities on the given base monitor, but there are a variety of built in ones you can use that can apply to different entity type/level (the intellisense will suggest the names for these when you type a $)

MonitoredObject = Get-SqlMonitorBaseMonitor -Name "MyBaseMonitorName"

$MonitoredEntities = Get-SqlMonitorMachine -BaseMonitor $MonitoredObject

foreach ($MonitoredEntity in $MonitoredEntities)
Write-host $MonitoredEntity

foreach ($alertTypeValue in $StandaloneMachineAlertTypes.Values)
$alertSetting = Get-SqlMonitorAlertSettings -MonitoredObject $MonitoredEntity -AlertType $alertTypeValue

Write-Host ($AlertTypes.GetEnumerator() | Where-Object {$_.Value -eq $alertTypeValue.ToString()}).name
Write-Host $alertSetting.Status # 0 = inherited, 1= customized, 2 = disabled
Write-Host $alertSetting.SpecificSettings.IgnoreJobNameRegexes
Write-Host $alertSetting.SpecificSettings.IgnoreJobOwnerRegexes
Write-Host $alertSetting.SpecificSettings.SingleSeverityAlertSetting
Write-Host $alertSetting.NotificationSettings.EmailAddresses
write-host $alertSetting.NotificationSettings.EMailNotificationOption
Write-Host $alertSetting.NotificationSettings.SlackEnabled
Write-Host $alertSetting.NotificationSettings.SnmpEnabled
Write-Host $alertSetting.NotificationSettings.WebhookEnabled
Write-Host $alertSetting.Comments
Write-Host "------------"