How to find CPU useage

  • Hi all,

    Can anyone give me the way to monitor CPU useage by using a stored procedure which is scheduled by a job to run in frequent intervals.

    That procedure should be capable of sending a mail or an alert if the CPU useage crosses certain threshold limit.

    Thanks in advance.

    VINU

  • HI,

    Can anyone give some idea on how to acheive this.....

  • Vinu - one way to do this (not using stored procs) is by using the Windows Performance Monitor. In perfmon, you can configure an Alert for object Processor - "%Processor Time". You can set up the threshold value and the program to be run when the value exceeds the threshold. The program can be simple one like a NET SEND or you can write a quick vbscript to send an email using the CDONTS object. Only catch here is that the performance monitor should be running all the time. For this you can save the setting as a file and put it in the Programs -> Startup so that perfmon can come up after a reboot. Its a crude solution but it works.

  • This seems like a nice solution:

    http://www.databasejournal.com/features/mssql/article.php/3500886

    You could then create a stored procedure, that calculates the average cpu usage within the last 15 minutes and make an alert if the average usage is above 85% or something like that.

  • Hi girish,

    Thanks for your info..this method of determinig works but my company will not allow to follow this in all customers.....so can u advice any other solution.......

  • vinu (5/7/2008)


    Hi girish,

    Thanks for your info..this method of determinig works but my company will not allow to follow this in all customers.....so can u advice any other solution.......

    You will have to tell us why this is a problem for your company before we can suggest something else.

    There are really only a few ways of doing this from SQL Server:

    1) with Perfmon, by shelling to the command line

    2) with vbs (or js) scheduled and run by the SQL Agent Job system

    3) with your own program, run by either (1) or (2), above

    or

    4) your own CLR/Assembly.

    Everyone of these approaches has one or more issues when it comes to distributing them to a customer site.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 6 posts - 1 through 5 (of 5 total)

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