AlwaysOn Failover Alert

  • Hello folks!

    I've been trying to add an alert to be sent on when AG (Role change) or (AG Data Movement - Suspended) or (AG Data Movement - Resumed), but its not working.

    when im checking the logs, i dont see any logs related to these error numbers in the logs(logs are attached).

    As per my understanding, alerts are triggered against errors in logs(is that correct?) if yes, i dont see any logs for (1480, 35264 ,35265) error numbers. Is there a way to enable logging those errors? how?

    ---------- Script ----------

    USE [msdb]

    GO

    EXEC msdb.dbo.sp_add_alert @name=N'AG Role Change',

    @message_id=1480,

    @severity=0,

    @enabled=1,

    @delay_between_responses=0,

    @include_event_description_in=1,

    @job_id=N'00000000-0000-0000-0000-000000000000'

    GO

    EXEC msdb.dbo.sp_add_notification @alert_name=N'AG Role Change', @operator_name=N'XXX', @notification_method = 1

    GO

     

    USE [msdb]

    GO

    EXEC msdb.dbo.sp_add_alert @name=N'AG Data Movement - Suspended',

    @message_id=35264,

    @severity=0,

    @enabled=1,

    @delay_between_responses=0,

    @include_event_description_in=1,

    @job_id=N'00000000-0000-0000-0000-000000000000'

    GO

    EXEC msdb.dbo.sp_add_notification @alert_name=N'AG Data Movement - Suspended', @operator_name=N'XXX', @notification_method = 1

    GO

     

    USE [msdb]

    GO

    EXEC msdb.dbo.sp_add_alert @name=N'AG Data Movement - Resumed',

    @message_id=35265,

    @severity=0,

    @enabled=1,

    @delay_between_responses=0,

    @include_event_description_in=1,

    @job_id=N'00000000-0000-0000-0000-000000000000'

    GO

    EXEC msdb.dbo.sp_add_notification @alert_name=N'AG Data Movement - Resumed', @operator_name=N'XXX', @notification_method = 1

    GO

    ---------- Script ----------

  • It looks like you have cribbed the code from here ..https://www.mssqltips.com/sqlservertip/3489/configure-sql-server-alerts-and-notifications-for-alwayson-availability-groups/

    ...have you updated the job_id to your specific job ids in your code?

    If not use the link as a reference

    Hope this helps

    SQL DBA
    Every day is a school day, and don't trust anyone who tells you any different.
    http://sqlblogness.blogspot.co.uk

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply