SQL 2008R2 - Performance Condition alert for CPU Threshold event

I am trying to use SQLServer Agent alert for Resoure governor setup. I would like to be alerted when CPU threshold -> REQUEST_MAX_CPU_TIME_SEC >  20 -> is crossed for any particular query. I am in RTM version for SQL2008R2. For some reason
the alert never occurs thru SQL Agent Alert.
Here is my alert configuration
EXEC msdb.dbo.sp_add_alert
@name=N'CPU Alert',
@message_id = 0,
@severity = 0,
@enabled = 1,
@delay_between_responses = 60,
@include_event_description_in = 1,
@notification_message = N'Email from alert CPU',
@category_name = N'[Uncategorized]',
@performance_condition = N'MSSQL$XXXXXX:Workload Group Stats|Max request cpu time (ms)|default|>|1',
@job_id = N'00000000-0000-0000-0000-000000000000'
THe same alert is working if I put < 5, I am able to notified by email. But when I put > I dont see any alert.
I have tried changing the default setting for resource governor to various #s (1, 5, 20, 600) . But for any change, if i use perf condition > 5, i dont get any alert. If i use < 5 then i get alerts...
Is it a bug, or am i missing something...
Any help will be much appreciated...

I got the event notifications / service broker solution working.  Thanks to
Aaron Bertrand blog for providing me with a working model.
I ended up using Aaron's code to create a more generic framework to support the processing of any number of trace events (not just exceeding resource governor's max cpu). 
Here it is... use at your own risk:
-- Create the Target Service:
USE msdb;
go
CREATE QUEUE eventNotificationsQueue ;
GO
CREATE SERVICE eventNotificationsService
ON QUEUE eventNotificationsQueue ( [http://schemas.microsoft.com/SQL/Notifications/PostEventNotification] );
GO
CREATE ROUTE eventNotificationsRoute
WITH SERVICE_NAME = 'eventNotificationsService',
ADDRESS = 'LOCAL';
GO
-- Create the event notification:
-- SQL Trace Event Types: http://msdn.microsoft.com/en-us/library/ms186265.aspx
-- drop event NOTIFICATION [CPUThresholdExceededNotification] on server
CREATE EVENT NOTIFICATION CPU_THRESHOLD_EXCEEDEDNotification
    ON SERVER 
WITH FAN_IN
    FOR CPU_THRESHOLD_EXCEEDED
    TO SERVICE 'eventNotificationsService', 'current database';
GO
-- ******************  Add new notifications here ********************
--CREATE EVENT NOTIFICATION CPU_THRESHOLD_EXCEEDEDNotification
--    ON SERVER 
-- WITH
FAN_IN
--    FOR XXXX
--    TO SERVICE 'eventNotificationsService', 'current database';
--GO
USE msdb;
GO
CREATE PROCEDURE [dbo].[dba_processEventNotifications]
WITH EXECUTE AS OWNER
AS 
-- [dbo].[dba_processEventNotifications] - Provides a framework to alert on trace events.
-- Reference: Aaron Bertran's post at http://www.mssqltips.com/sqlservertip/2595/get-alerts-for-specific-sql-server-login-failed-events/
-- Revision History:
-- 20140827 D Turpin Original creation.
-- Candidate events include select * from sys.trace_events
BEGIN
SET NOCOUNT ON;
DECLARE
@message_body XML
, @message
NVARCHAR(max)
, @subject
NVARCHAR(255)
, @recipients
varchar(max);
--SET @recipients = '[email protected]; [email protected]';
SET @recipients = '[email protected]';
WHILE (1 = 1)
BEGIN
WAITFOR (
RECEIVE TOP(1) @message_body = message_body
FROM dbo.eventNotificationsQueue)
, TIMEOUT 1000;
IF (@@ROWCOUNT = 1)
BEGIN
-- Let's see if we can capture the query that is running:
EXECUTE sp_start_job 'DBA Load whoisactive';
IF (@message_body.value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(max)') = N'CPU_THRESHOLD_EXCEEDED')
BEGIN
SELECT @subject =
N'A query on ' + CAST(@@SERVERNAME AS nvarchar(256)) + 
N' exceeded the Resource Governor limit REQUEST_MAX_CPU_TIME_SEC';
SELECT @message = N'Event Notification: User query exceeded REQUEST_MAX_CPU_TIME_SEC at '
+ @message_body.value('(/EVENT_INSTANCE/PostTime)[1]', 'nvarchar(max)' )
+ CHAR(13) + CHAR(10)
+ @message_body.value('(/EVENT_INSTANCE/CPU)[1]', 'nvarchar(max)' ) + ' CPU (ms) '
+ CHAR(13) + CHAR(10)
+ N'SPID: ' + @message_body.value('(/EVENT_INSTANCE/OwnerID)[1]', 'nvarchar(max)' )
+ CHAR(13) + CHAR(10)
+ N' Check dba_baselines.dbo.whoisactive for currently active queries';
--Use this if you want to list the XML nodes/values.
--SELECT @message = CAST(@message_body AS NVARCHAR(max));
END
-- ********************* Add new events here ********************
--IF (@message_body.value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(max)') = N'CPU_THRESHOLD_EXCEEDED')
--BEGIN
-- SELECT @subject = = N'A query on ' + CAST(@@SERVERNAME AS nvarchar(256)) + 
-- N' exceeded the Resource Governor limit REQUEST_MAX_CPU_TIME_SEC';
-- SELECT @message = N'Event Notification: User query exceeded REQUEST_MAX_CPU_TIME_SEC at '
-- + @message_body.value('(/EVENT_INSTANCE/PostTime)[1]', 'nvarchar(max)' )
+ CHAR(13) + CHAR(10)
-- + @message_body.value('(/EVENT_INSTANCE/CPU)[1]', 'nvarchar(max)' ) + ' CPU (ms) '
+ CHAR(13) + CHAR(10)
-- + N'SPID: ' + @message_body.value('(/EVENT_INSTANCE/OwnerID)[1]', 'nvarchar(max)' )
+ CHAR(13) + CHAR(10)
-- + N' Check dba_baselines.dbo.whoisactive for currently active queries';
--END
EXECUTE msdb.dbo.sp_send_dbmail
@profile_name = 'DBMailProfile'
, @recipients = @recipients
, @subject =
@subject
, @body =
@message;
END
END
END
GO
ALTER QUEUE eventNotificationsQueue
WITH ACTIVATION (
STATUS = ON
, PROCEDURE_NAME = [dbo].[dba_processEventNotifications]
, MAX_QUEUE_READERS = 1
, EXECUTE AS OWNER );
GO

Similar Messages

  • Alerts for CPU,Memory Utilizations

    Hi all,
    In the last few weeks we have been encountering,  Server Re-starts due to  memory Shoots ups.
    We are planning to have alerts for CPU, memory utlizations.
    These would be triggered before a Standard Threshold is reached.  This would avoid issues after threshold in production environment.
    Are there any pointers, blogs etc available on how to achieve the same.
    Thanks in advance,
    Best regards
    Abhishek

    Basic alert funtionality of XI won't help. You must have CCMS configured in your landscape. It could be then used to raise alert for such issues. Have a look here
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00c7270b-1111-2a10-198b-cf7adc86d695
    Regards,
    Prateek

  • Snmp alerts for CPU utilization

    Hi,
    I want to enable snmp alerts on l2 and l3 switches to monitor CPU utilization.
    I have Opmanager which is acting as SNMP server.
    I have switches L2 and L3 which are running IOS 12.0, 12.1, 12.2
    Do all these IOS versions support SNMP alerts?
    And also I want to know the commands to be configured on switches for this.
    Regards
    skrao

    You can configure SNMP traps for CPU Thresholding Notification.
    http://www.cisco.com/en/US/products/ps6350/products_configuration_guide_chapter09186a0080455772.html
    You should be ok with the versions you list but check exact IOS version supports it at http://www.cisco.com/go/fn
    If you do not want to use traps then there are specific oids that can be polled for 1minute average (1.3.6.1.4.1.9.2.1.57) and also 5 minute average (1.3.6.1.4.1.9.2.1.58). I've used these in the past with no problems. These oids may have been superceeded so check for latest. You can always snmpwalk a device to check oids.
    The cisco SNMP navigator is helpful when it comes to oids.
    http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en
    If you haven't got any SNMP configured yet on the switch check out http://forum.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Network%20Infrastructure&topic=Network%20Management&CommCmd=MB%3Fcmd%3Ddisplay_location%26location%3D.1ddb4e54
    HTH
    --Phil

  • How to set automatic e-mail alert for 90% threshold reach for MAXDBdatabase

    Hi,
    I want to set automate e-mail alert for 90% threshold reach for MAXDB database i.e. data area. I want to know where i can set the automate e-mail alert for data area in MAXDB database? As i have already have script for oracle tablespace alert if tablespace reaches 90% it sends me an auotmated e-mail.
    Please let me know where to do the settings or any script available for MAXDB database data area automate e-mail alert....
    Thanks,
    Narendra

    Hello,
    What is the version of your database?
    Are you SAP customer?
    Please see the MAXDB documentation,
    Review the Standard Events at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Glossary -> Event
    And u201CMonitoring Free Memory in the Data Areau201D section at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Database Administration
    -> Monitoring Databases
    see example at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Tutorials ->Database Manager CLI Tutorial
    -> Using the Event Dispatcher Function
    -> Event-Controlled Sending of E-mails
    Thank you and best regards, Natalia Khlopina

  • How can I override an alert for a particular event?

    I'm using Calendar 6.0 in Mountain Lion. I have set default alert times, but sometimes I want to set a different alert for a particular event. This is something that is easy to do in other calendar programs but seems impossible in Calendar. If I edit the alert time and date, it always reverts back to the default once I close the editing window or click apply.

    See this support article. <br />
    https://support.mozilla.com/en-US/kb/Creating+a+desktop+shortcut+to+a+web+page

  • How do I set up an email Alert for a Calendar event?

    I can't figure out how to set up an email Alert for a Calendar event at icloud.com or on an iOS device.  Am I missing something?

    Try this support article Dave..
    iCloud: Calendar Events, Reminders, To Dos, and Tasks behavior differs by application

  • Email alerts for CPU and Memory status of CUCM

    Hi All,
    can anybody help me here?
    Will RTMT trigger the daily email notification for CPU and Memory status of CUCM? If yes, kindly let me know the procedure.
    Thanks in advance !!!!

    Hi Hariharan,
    In addition to Atul's link please refer the below mentioned link CPU and Memory usage
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/managed_services/cucm_health.html#wp1101115
    Tx,
    Hope this helps
    Shalu

  • Why is ical creating unwanted alerts for all-day events?

    If anyone can point to what might be going wrong here I'd be grateful. This is becoming a daily irritant. I have a number of all-day events listed for most week days in my diary which help me to know what is happening that day with childcare for my son. I don't need alerts to be reminded of these - they are just notes I put to myself in adavnce that let me know how my day is configured. Now, I sync my ical from my home imac to my work imac, my macbook, my iphone and my ipad. On none of these devices do I have default alerts set. I never set any alerts for any of these 'events'. But then, at 9am the day before each one I get an alert. In fact, I get a 9am alert for any all-day event, regardless of whether I set an alert for then, or at all. As I say, I've checked all devices and the default alert a=on all is set to 'none'. Does anyone know why this is happening and how I stop it?

    Thanks Malcolm.I'm afraid this issue started for me after updating to iOS6!

  • Why am I getting double popup alerts for Google Calendar events on iPhone?

    This is happening on both mine and my wife's iPhones (mine is a 4 and hers is a 3GS) which are both on the latest iOS (6.0.1).  This is what I've figured out:
    On iPhones: Default is to set no alerts/reminder for calendar events
    On Google Calendar: Default is to set a popup alert 1 hour before event & email 1 hour before event
    When I create a new event on my iPhone: It saves with no alerts set, then after uploading to google calendar it shows as having two alerts 1 hour before the event.  If I go into Google Calendar, it shows that 1 popup and 1 email are each set for 1 hour before the event.
    When I create a new event on in Google Calendar: It saves with 1 popup and 1 email are each set for 1 hour before the event per the default settings.  If I go to my iPhone, it shows that I have 2 alerts, both for 1 hour before the event.
    So it seems that the iPhone is seeing both the popup and email alerts and creating two popup alerts on my phone!
    Is there anyway to fix this?  I've tried setting up the calendar on my iPhone through Gmail account, Exchange account and CalDav account and it's all the same.

    I figured it out.  It has to do with which calendars you want displayed.  Duplications come from multiple calender selections.

  • Conditional Alerting For Servers and Network Device

    We have a management server here in the states with sites across the pond with servers there as well. All servers point back to the sole management server.
    I have setup a subscription on Failed to Connect to Computer with a 90 second threshold. The problem is if the VPN between sites goes down we get alerts on all the servers being down.
    Is it possible to setup a condition that if the VPN does go down, do not generate "Failed to Connect to Computer" alerts on those servers?
    Environment is SCOM 2012 R2

    I moved this over to the Authoring forum for you - might be a better place to get more feedback.
    Basically, what needs to be done (from an authoring perspective) is a diagnostic task could first check if the servers are on the particular network (like on your VPN network). Do not set state to critical if the VPN link is unavailable. Do set state to
    critical if the  VPN link is available, but server is not.
    If you have orchestrator, there may be other options...
    Jonathan Almquist | SCOMskills, LLC (http://scomskills.com)

  • Why do I get so many Calendar alerts for US holiday events?

    All of a sudden for US holidays I get dozens and dozens of the alerts the day before reminding me of them. This does not happen for calendar entries that I have made.This just started this week with Lincoln's birthday and again repeated for Valentine's Day tomorrow. Any suggestions?

    Look Here.... Everything you ever wanted to know about Reminders and then some..... 
    http://support.apple.com/kb/HT4861

  • Calendar alerts for all day events

    Am I missing something??? Is there anyway to set an alert to go off on the date of an all day event but not at midnight the night before? It would be so much better if the user could choose what time the alert should go off, like 9am for instance. Who wants an alert at midnight!

    Isnt there any other way than doing it manually? I have a lot of birthdays and anne. saved on the contacts info on my outlook with the alert set to go off at 8 AM but as the previous person said....all alerts tend to go off at 12 midnight which is quite irritating.

  • Using WMI alert for mirroring in Sql server 2012

    We are using mirroring in Sql Server 2012  and we are using WMI alerts for some of events such as Connection lost,Manual failover,...
    In alert definition we have set the followings:
    Type: WMI event alert
    NameSpace:
    \\.\root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER
    Query: select * from DATABASE_MIRRORING_STATE_CHANGE where State = 6
    The alert is bing triggered correctly,but on email description instead of having meaningful explaination like 'Connection lost',We have the same query:
    Query: select * from DATABASE_MIRRORING_STATE_CHANGE where State = 6
    We have used the same implementation in our Sql Server 2008 servers and it is working fine.This mashine (Sql Server 2012) is a new mashine.
    I would appreciate if someone help me on this.AlsoI checked and 'Include body of e-mail in notification message' was already set.
    Thanks
    Aspet
    A.G

    Are you looking for alerting related to mirroring like below ?
    http://www.mssqltips.com/sqlservertip/1859/monitoring-sql-server-database-mirroring-with-email-alerts/
    http://technet.microsoft.com/en-us/library/cc966392.aspx
    Raju Rasagounder Sr MSSQL DBA

  • SQL Broker Performance Reports are empty

    Good day,
    I'm running SCOM 2012 SP1. I was requested to deliver a couple reports for an SQL migration/upgrade.
    The relevant data is in The SQL Broker Performance Reports both for SQL 2008 and 2012.
    I have been looking at troubleshooting article such as: http://support.microsoft.com/kb/2573329
    And all my system configs are OK, as well as positive logs. I have reviewed overrides and enable all performance ovverides on SQL MP just to see if it was going to make a change. I added an MP from VEEAM (quite cool actually) thinking I would get better
    results but that also failed.
    Has anyone encountered this issue before. The funny thing is that other reports give data :-).
    Is there something I need to enable further, am no SQL guru.
    Best regards,
    Dominique.

    Hi,
    How about Clear the Cache for the SQL agent by following the below steps?
    In the Monitoring workspace, expand Operations Manager and then expand
    Agent Details.
    Click Agent Health State.
    In Agent State, click an agent.
    In the Tasks pane, click Flush Health Service State and Cache
    In addition, we may
    1) stop scom agent Service (OPsMgr Health service)
    2) rename forlder.C:\Program Files\System Center Operations Manager 2012\health service state.
    3) start scom agent Service.
    Hope this helps.
    Regards,
    Yan Li
    Regards, Yan Li

  • Alert for SCEP Clients at risk

    Hi there
    I've got some SCEP Clients in my Environment which are listed in the Endpoint Protection Dashboard with Status "At risk". These are Clients which were offline for an amount of time and now report an old Update Definition. Normally these
    Clients get's updated and disappear from the Dashboard.
    However in some case, the Clients Fails to get the newest update, and there are in our Network without being compliant. Is it possible to create an alert for Clients which doesn't have an up-to-date endpoint protection definitions (Those with Status "At
    risk").
    Now, i Need to manually check the Dashboard every morning if there are some new Clients with the Status at risk.
    Thank you in advance!
    Best regards, Simon

    I haven't done anything with alerts and SCEP, what I have done is create Device Collections with a membership rule based upon certain states of the SCEP client. I have a collection for Virus Definitions 3-7 days old, and 7+ days old, SCEP installation
    failed and SCEP Policy Application failed.
    On my collections with old definitions I deploy the full definition update package. I update the package source once a day with powershell, and have the package set to redistribute once a day. Alerts for deployment thresholds are pretty easy to create, so
    if the extra remediation of definitions doesn't fix non compliant computers, you can get alerts on those that fail...
    I know the above isn't quite the solution you was looking for, but perhaps it can help.

Maybe you are looking for

  • How to set jpeg resolution when saving pdf file as jpeg

    I'm running Acrobat using interprocess api, I can invoke a script to save a pdf file as JPEG, but I need to be able to set the resolution of the saved jpeg file. Any clues as to how I can do that ? Peter

  • Itunes crashed, lost files??, files wont play.

    i just tried itunes for the first time, i am running windows vista and if i had bean aware of the problems between itunes and vista i probably would not have done this. anways my problem. when i first installed itunes it ran good and i setup an accou

  • Migrate from PS Album SE 3.2 to PS Elements 9?

    Hello everybody. I've been using Adobe PhotoShop Album SE 3.2 to import and organize the pictures taken with my iPhone 3Gs. Then I changed my iPhone 3Gs with the new iPhone 4 and suddenly PS Album 3.2 stopped working and it didn't import pictures any

  • How to make text fields grow dynamically without overlapping the text below it?

    Hi..I'm a newbie to Adobe Livecycle and I need a create a form that has a textfield that should grow dynamically and expand without overlapping the text below it. I tried using subforms, saving as Dyanmic PDF, checking expand to fit option but nothin

  • Do I need to upload entire site after every change?

    Publishing to a folder, then uploading with Fetch. If I make a change in on one page (and my site has 11 pages), do I need to upload the entire site every-time? I make changes and additions all the time. iWeb 1.1.1. Sorry if this topic has been discu