Server Management Suite

 View Only
  • 1.  SQL Question

    Posted Aug 12, 2011 10:36 AM

    Hi All

    I am trying to create a new report that will pull the top ten CPU users in the company. I have a SQL query. however I want it to list the results in a percent. Any thoughts on how I can do that

     

    Below is the query I am using

     

    select top 10 [owner] [Owner Name], sum(cpu) [CPU Usage Total] from vmonitorprocessdata
    where [owner] not in (
     'system',
     'root',
     'network service',
     'administrator',
     'local service')
    group by [owner]
    order by [CPU Usage Total] desc

     

    How can I convert this to list the results in a percent?



  • 2.  RE: SQL Question

    Posted Aug 12, 2011 05:21 PM

    I'm not sure what your results look like, but you just do some math.  Do you actually want the percent symbol?

    If the statement above returns values like 98, 72, 24 for CPU Usage Total, then add a /100 to change it to [CPU Usage Total]/100

    If it returns values like .98, .72, .24, make it *100

    Is this making sense?  Can you provide a screenshot of your report and what you would like to see?



  • 3.  RE: SQL Question

    Posted Aug 14, 2011 01:24 PM

    Thanks for the reply, Here is the results of the query, I believe the results are in MB. when I add the /100 it just removes 2 decimals places

    Username 12876
    Username 4018
    Username 3808
    Username 1682
    Username 1521
    Username 1443
    Username 1033
    Username 1004
    Username 826
    Username 814



  • 4.  RE: SQL Question

    Posted Aug 15, 2011 03:12 AM

    Hi,

    I believe you should first know what are you retriving from the query, the value type. Also you should check what is the maximum value a client can generate and then do the math calculations to return the percentile



  • 5.  RE: SQL Question

    Posted Aug 15, 2011 08:42 AM

    thanks for the reply, I am try to determine a users CPU usage in a percent. There will be know max value because it will never be the same and it will always be changing. is there a way i can modify the query to output a percent? I tried avg instead of sum with no luck.



  • 6.  RE: SQL Question

    Posted Aug 15, 2011 11:46 AM

    I haven't used monitor solution in 6.x, but I'm guessing you need to join the vMonitorData table to a different table using the GUID.  The different table, of course, will include the max CPU speed for that system -- which Altiris has matched by using the GUID.

    select top 10 [owner] [Owner Name], sum(cpu) [CPU Usage Total] from vmonitorprocessdata

    JOIN Inv_AeX_HW_CPU ON Inv_AeX_HW_CPU.MachineGuid = vMonitorProcessData.MachineGuid


    where [owner] not in (
     'system',
     'root',
     'network service',
     'administrator',
     'local service')
    group by [owner]
    order by [CPU Usage Total] desc

    This is approximate -- dive into the DB for details.  This would work for a single CPU system, anyway -- might need additional tweaking to add up total CPU capacity for a system with multiple CPUs.  But right here you could do

    [vMonitorProcessData].[CPU Usage Total] / [Inv_AeX_HW_CPU].[Speed]