Extracting monthly statistics from daily SCOM data

logitech 135 Reputation points
2024-05-29T16:18:02.24+00:00

Hi there,

I would like to generate a monthly report that shows Capacity Memory/CPU/Disk usage and Availability metrics. Specifically, I need the minimum, maximum, and average values for each metric.

Can someone help me with an SQL query or report that can achieve this?

Thank you.

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,440 questions
0 comments No comments
{count} votes

Accepted answer
  1. XinGuo-MSFT 15,781 Reputation points
    2024-05-30T06:36:15.1433333+00:00

    Hi,

    Thank you for asking this. For a quick lab test, I've created a dashboard view with 7 grid columns and add the PowerShell Grid Widget for one of them. And the PowerShell is something like this.

    $class = Get-SCOMClass -Name Microsoft.Windows.Computer  
    $computers = Get-SCOMClassInstance -Class $class  
    $i=1  
    foreach ($computer in $computers)  
    {  
        $cpu_usage = (Get-WmiObject -ComputerName $computer -Class win32_processor | Measure-Object -Property LoadPercentage -Average | Select-Object Average).Average.ToString()  
        $mem_usage = Get-WmiObject win32_operatingsystem -ComputerName $computer | Foreach {"{0:N2}" -f ((($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)*100)/ $_.TotalVisibleMemorySize)}  
        $disk_usage_c = Get-WmiObject Win32_Volume -ComputerName $computer -Filter "DriveLetter = 'C:'" | Foreach {"{0:N2}" -f (($_.FreeSpace / $_.Capacity)*100)}  
        $disk_usage_d = Get-WmiObject Win32_Volume -ComputerName $computer -Filter "DriveLetter = 'D:'" | Foreach {"{0:N2}" -f (($_.FreeSpace / $_.Capacity)*100)}  
        $dataObject=$ScriptContext.CreateFromObject($computer,"Id=Id,HealthState=HealthState,DisplayName=DisplayName",$null)  
        $dataObject["Index"]=$i  
        $dataObject["CPU%"]=$cpu_usage  
        $dataObject["Memory%"]=$mem_usage  
        $dataObject["C:Drive"]=$disk_usage_c  
        $dataObject["D:Drive"]=$disk_usage_d  
        $ScriptContext.ReturnCollection.Add($dataObject)  
        $i++  
    }  
      
    

    Screenshot for your reference:

    113144-scom-pwershell-dashboard-02.png

    Note: Get-WmiObject need remote administration permission on target computer.

    As long as the data is collected by SCOM and therefore stored in the Datawarehouse, you can display it with whatever tool you like.

    0 comments No comments

0 additional answers

Sort by: Most helpful