I created a component monitor in a SAM template that alerts when it detects a SQL database on a given node has Autoclose set to true=Critical, then built the associated advanced alert using property monitor 'APM: Component' to alert on.
Image may be NSFW.
Clik here to view.
Here's the component monitor script used in the SAM template.
SELECT
count(*)
FROM
master.sys.databases
WHERE
is_auto_close_on = 1
Everything works, but in the message from Advanced Alert, I tried to parse the database name ${DatabaseName} so our DBA's know which one is set to auto close, and it comes up blank.
I was told by SW support that variables aren't supported across different property monitor alert types, so I wondered if my only option is to create a custom SQL alert in Advanced Alert using the same simple script and then build a custom message query?
Another option, I investigated was the available variables in the Advanced Alert property monitors for 'SQL AppInsight' , and see a lot of values to set up conditions, including the variable for ${DatabaseName} for my messaging portion, but nothing specific to the trigger condition of Auto-close I want to alert on. Haven't explored all of the options with AppInsight, so thought I'd mention it as perhaps another avenue I can use.
Thanks in advance.