How can we help you today? How can we help you today?

exec msdb.dbo.sp_send_dbmail

Hi all,
We are big users of the custom metrics.
We were looking to find ways to enhance them by allowing the metric to send an email when a condition has been met.

When we run the query (exec msdb.dbo.sp_send_dbmail etc.) directly on the SQL instance , an email is sent successfully, however, when we run it via SQL Monitor, nothing happens.

Anyone got any ideas?
Thanks in advance,
Achilleas
achilleas_delenda
0

Comments

3 comments

  • ChrisGStevens
    Be sure to add your SQL Monitor Service Account to the MSDB Database and add it to the DatabaseMailUserRole.
    ChrisGStevens
    0
  • achilleas_delenda
    Thanks for the reply Chris, the SQL Monitor Service Account is a sysadmin on the target server
    achilleas_delenda
    0
  • Alex B
    Hi @achilleas_delenda

    I completely forgot that everything done in the Custom Metric T-SQL section is done in a transaction that is rolled back which stops the email from being sent.

    This is for security reasons and the initial intention of the custom metric was just to gather data not to modify anything.

    I would suggest looking to see if there is a suggestion on https://sqlmonitor.uservoice.com/forums/91743-suggestions for this and if not raising your own.

    Kind regards,
    Alex
    Alex B
    0

Add comment

Please sign in to leave a comment.