{"id":949,"date":"2009-02-23T10:34:00","date_gmt":"2009-02-23T10:34:00","guid":{"rendered":"\/blogs\/paul\/post\/Easy-monitoring-of-high-severity-errors-create-Agent-alerts.aspx"},"modified":"2017-04-13T11:41:55","modified_gmt":"2017-04-13T18:41:55","slug":"easy-monitoring-of-high-severity-errors-create-agent-alerts","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/","title":{"rendered":"Easy monitoring of high-severity errors: create Agent alerts"},"content":{"rendered":"<p><font face=\"verdana,geneva\" size=\"2\"><\/p>\n<p>\nIn my <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/a-little-known-sign-of-impending-doom-error-825\/\">previous post<\/a> today I talked about error 825 and how you should have an Agent alert set up to catch it when it happens. There are two ways you can set up Agent alerts &#8211; using SSMS&nbsp;or using the stored-proc <font face=\"courier new,courier\">sp_add_alert<\/font>. In a post from April 2008 I showed how to create an Operator and alerts using the SSMS wizards (see that post <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/conference-questions-pot-pourri-7-how-to-create-agent-alerts\/\">here<\/a>). To use the SP to create the alert for message 825, the code would be as follows:\n<\/p>\n<p><\/font><font face=\"courier new,courier\" size=\"2\"><\/p>\n<blockquote><p>\n\t<font color=\"#0000ff\">USE<\/font> msdb<font color=\"#808080\">;<\/font><br \/>\n\tGO <\/p>\n<p>\n\t<font color=\"#0000ff\">EXEC<\/font> msdb<font color=\"#808080\">.<\/font>dbo<font color=\"#808080\">.<\/font><font color=\"#800000\">sp_add_alert<\/font> @name <font color=\"#808080\">=<\/font> N<font color=\"#ff0000\">&#39;825 &#8211; Read-Retry Required&#39;<\/font><font color=\"#808080\">,<\/font> <br \/>\n\t&nbsp;&nbsp;&nbsp; @message_id <font color=\"#808080\">=<\/font> 825<font color=\"#808080\">,<\/font><br \/>\n\t&nbsp;&nbsp;&nbsp; @severity <font color=\"#808080\">=<\/font> 0<font color=\"#808080\">,<\/font><br \/>\n\t&nbsp;&nbsp;&nbsp; @enabled <font color=\"#808080\">=<\/font> 1<font color=\"#808080\">,<\/font><br \/>\n\t&nbsp;&nbsp;&nbsp; @delay_between_responses <font color=\"#808080\">=<\/font> 0<font color=\"#808080\">,<\/font><br \/>\n\t&nbsp;&nbsp;&nbsp; @include_event_description_in <font color=\"#808080\">=<\/font> 1<font color=\"#808080\">;<\/font><br \/>\n\tGO\n\t<\/p>\n<\/blockquote>\n<p><\/font><font face=\"verdana,geneva\" size=\"2\"><\/p>\n<p>\nNote the <font face=\"courier new,courier\">@include_event_description<\/font> parameter. This is a <font face=\"courier new,courier\">tinyint<\/font> that says which of the notification mechanisms should include the description. The list of possibilities is:\n<\/p>\n<ul>\n<li>\n<div>\n\t0 &#8211; None\n\t<\/div>\n<\/li>\n<li>\n<div>\n\t1 &#8211; Email\n\t<\/div>\n<\/li>\n<li>\n<div>\n\t2 &#8211; Pager\n\t<\/div>\n<\/li>\n<li>\n<div>\n\t4 &#8211; Net send\n\t<\/div>\n<\/li>\n<\/ul>\n<p>\nSo my value of 1 only includes the description in email, even if I&#39;ve set up the Operator to receive email and a net send. You can get more info about this SP from the following link: <a href=\"https:\/\/msdn.microsoft.com\/Areas\/Epx\/Content\/500.htm?aspxerrorpath=\/en-us\/library\/ms189531.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/ms189531.aspx<\/a>.\n<\/p>\n<p>\nAs to which alerts you should have defined, my advice would be to have one for message 825 and a separate alert for each severity 19, 20, 21, 22, 23, 24, and 25. These are the high-severity errors and are also written to the error log. You can get a complete description of all error severities at <a href=\"https:\/\/msdn.microsoft.com\/Areas\/Epx\/Content\/500.htm?aspxerrorpath=\/en-us\/library\/ms164086.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/ms164086.aspx<\/a>. Note that if you specify <font face=\"courier new,courier\">@severity<\/font>, the <font face=\"courier new,courier\">@message_id<\/font> must be 0 (and vice-versa).\n<\/p>\n<p>\nHappy alerting!\n<\/p>\n<p>\nPS And of course you&#39;ll need to use the SP <font face=\"courier new,courier\">sp_add_notification<\/font> (see <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-stored-procedures\/sp-add-notification-transact-sql\">http:\/\/technet.microsoft.com\/en-us\/library\/ms173843.aspx<\/a>) to hook the alert to an Operator. Thanks Tibor (who just <a href=\"http:\/\/sqlblog.com\/blogs\/tibor_karaszi\/archive\/2009\/02\/23\/where-s-that-sys-messages-management-pack.aspx\">blogged<\/a> about how to determine which errors to alert on) &#8211; got distracted by email while writing this and forgot to include it!\n<\/p>\n<p><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post today I talked about error 825 and how you should have an Agent alert set up to catch it when it happens. There are two ways you can set up Agent alerts &#8211; using SSMS&nbsp;or using the stored-proc sp_add_alert. In a post from April 2008 I showed how to create an [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,52,85,95],"tags":[],"class_list":["post-949","post","type-post","status-publish","format-standard","hentry","category-database-maintenance","category-involuntary-dba","category-sql-agent","category-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"In my previous post today I talked about error 825 and how you should have an Agent alert set up to catch it when it happens. There are two ways you can set up Agent alerts &#8211; using SSMS&nbsp;or using the stored-proc sp_add_alert. In a post from April 2008 I showed how to create an [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2009-02-23T10:34:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T18:41:55+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/\",\"name\":\"Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2009-02-23T10:34:00+00:00\",\"dateModified\":\"2017-04-13T18:41:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Easy monitoring of high-severity errors: create Agent alerts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/","og_locale":"en_US","og_type":"article","og_title":"Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal","og_description":"In my previous post today I talked about error 825 and how you should have an Agent alert set up to catch it when it happens. There are two ways you can set up Agent alerts &#8211; using SSMS&nbsp;or using the stored-proc sp_add_alert. In a post from April 2008 I showed how to create an [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/","og_site_name":"Paul S. Randal","article_published_time":"2009-02-23T10:34:00+00:00","article_modified_time":"2017-04-13T18:41:55+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/","name":"Easy monitoring of high-severity errors: create Agent alerts - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2009-02-23T10:34:00+00:00","dateModified":"2017-04-13T18:41:55+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/easy-monitoring-of-high-severity-errors-create-agent-alerts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Easy monitoring of high-severity errors: create Agent alerts"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=949"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/949\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}