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

Tracking specific error numbers

I'd like to use SQL Monitor to track and alert me when specific SQL errors are generated. At the moment, I'm tracking 833 errors on one of our servers and am using SQL Agent Alerts to email.

Does anyone know a way of doing this on SQL Monitor?

Regards

Andrew
crimdon
0

Comments

3 comments

  • Robyn
    Hi Andrew, 

    Thanks for your post!

    Unfortunately, there is no feature in SQL Monitor to track and send alerts for specific SQL Errors.

    It might be possible using a Custom Metric, but it's not a feature we've provided or tested!
    Robyn
    0
  • crimdon
    Hi there,

    Thanks for your reply. I've decided to do it with a custom metric using this scrip:

    DROP TABLE IF EXISTS #errorLog;

    CREATE TABLE #errorLog
    (
        LogDate DATETIME,
        ProcessInfo VARCHAR(64),
        [Text] VARCHAR(MAX)
    );
    DECLARE @starttime DATETIME = DATEADD(MINUTE, -5, GETDATE()), @now DATETIME = GETDATE()

    INSERT INTO #errorLog
    EXEC xp_readerrorlog 0,1,NULL, NULL, @starttime, @now
    SELECT COUNT(*)
    FROM #errorLog a
    WHERE EXISTS
    (
        SELECT *
        FROM #errorLog b
        WHERE [Text] LIKE '%I/O requests taking longer than 15 seconds%'
              AND a.LogDate = b.LogDate
              AND a.ProcessInfo = b.ProcessInfo
    );

    DROP TABLE IF EXISTS #errorLog;

    Regards


    Andrew
    crimdon
    0
  • Russell D
    It'd be good to submit that to sqlmonitormetrics.com :).
    Russell D
    0

Add comment

Please sign in to leave a comment.